From patchwork Mon Jan 22 22:15:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1889415 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=iuKOMvdX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TJl2q1qNTz1yS7 for ; Tue, 23 Jan 2024 09:17:39 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rS2aM-0004qx-MQ; Mon, 22 Jan 2024 17:16:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rS2a0-0004nD-Ki for qemu-devel@nongnu.org; Mon, 22 Jan 2024 17:15:44 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rS2Zz-0005uo-63 for qemu-devel@nongnu.org; Mon, 22 Jan 2024 17:15:44 -0500 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1d7354ba334so17575515ad.1 for ; Mon, 22 Jan 2024 14:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1705961741; x=1706566541; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NzHL8aJDpNvMBJ2WBWw1qBXQpPaYiy2l39AZTY8wyvQ=; b=iuKOMvdXhVRrMPHY1vS1xuCSkKWfzDw98+EhppFz+AKMyNcnodpVhefWAMXzKhn+RZ LlZu3CtLvrNe31qdC11aBlM4EEdF5GPZKg5WfVFgUFQ1j2RChEIv0RE4Qx01RTLTZFr4 BaqyNGM9iMZEZsKs1IMN9r+PjlcRbDyiTmtPeGVspr6TmSL5+sXp89EinOsxeAlX+xnm w6tO7buYiFneFgaR4CmVkxkzW7OXk1gkMez7Zs5gqcx8Llmcmrhf70bny0aQFmBIekca R986YN2BjMfaLBcKoFGEuQsAqXS+ilk+A8LrYdhGB6BkC6S924lTonqXLoHt/1iH7BM2 YBPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705961741; x=1706566541; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NzHL8aJDpNvMBJ2WBWw1qBXQpPaYiy2l39AZTY8wyvQ=; b=SI04tuuJHQjnT/eyh0a4Fq15RmEeW2b2wYibHTr6SgrV/7R3nWc2YsDBPc+d3uercO Xz1VDNEL8zGMZBvQ+PaaEsu9qyVgMNQHvHy/3OO/ehSLPCk2uCPeTwyJObawwUPm42u2 qrVyqesb1qxIbMDcz5BJSuAs+B9/XkYM9s0kSyWHMEVbItAygMa2a/yRiemc89SBSqqg sgvdWUQBK9IsKz5nBLBz+KBk9QGaxQsKXX5H0oymVpBNvYtzK1e4iLldtOxzAT9MJCMZ G002QBKCV57cYlzOvGSGkcFuxJgnw5rHHH4eF2Pj2pBSATfrvoT57rFen45wq5t8eJZ7 CA7w== X-Gm-Message-State: AOJu0YzF0oWLNgy6EQbA5dwoChP/d7oTqSPqVqx+lQh8XQArX3+E1ccx 6KXNMrHnxylFgNdEZopIwXrkx8HoolJHHcvNcrjcGyUg/RtWSpA4OA7Bers9Req5nZv3Ys9mL6R B X-Google-Smtp-Source: AGHT+IGzsf37BmxGv7KeuB1LO0dV+L3lL+X9Y8JQx+fmpMyYbXTJosc/Eamursw+m9Hv82BYymEMdg== X-Received: by 2002:a17:902:650e:b0:1d5:efcb:3cd1 with SMTP id b14-20020a170902650e00b001d5efcb3cd1mr4636841plk.81.1705961741183; Mon, 22 Jan 2024 14:15:41 -0800 (PST) Received: from grind.. ([152.234.127.94]) by smtp.gmail.com with ESMTPSA id kr8-20020a170903080800b001d7338977e6sm4029104plb.223.2024.01.22.14.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 14:15:40 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, Daniel Henrique Barboza Subject: [PATCH 2/7] hw/riscv/numa.c: use g_autofree in socket_fdt_write_distance_matrix() Date: Mon, 22 Jan 2024 19:15:24 -0300 Message-ID: <20240122221529.86562-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122221529.86562-1-dbarboza@ventanamicro.com> References: <20240122221529.86562-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=dbarboza@ventanamicro.com; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Use g_autofree in 'dist_matrix' to avoid the manual g_free(). Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- hw/riscv/numa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/riscv/numa.c b/hw/riscv/numa.c index d319aefb45..cf686f4ff1 100644 --- a/hw/riscv/numa.c +++ b/hw/riscv/numa.c @@ -167,7 +167,8 @@ void riscv_socket_fdt_write_id(const MachineState *ms, const char *node_name, void riscv_socket_fdt_write_distance_matrix(const MachineState *ms) { int i, j, idx; - uint32_t *dist_matrix, dist_matrix_size; + g_autofree uint32_t *dist_matrix = NULL; + uint32_t dist_matrix_size; if (numa_enabled(ms) && ms->numa_state->have_numa_distance) { dist_matrix_size = riscv_socket_count(ms) * riscv_socket_count(ms); @@ -189,7 +190,6 @@ void riscv_socket_fdt_write_distance_matrix(const MachineState *ms) "numa-distance-map-v1"); qemu_fdt_setprop(ms->fdt, "/distance-map", "distance-matrix", dist_matrix, dist_matrix_size); - g_free(dist_matrix); } }