From nobody Tue Nov 26 19:44:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1705961858; cv=none; d=zohomail.com; s=zohoarc; b=WQ8eoJwB04n+TLji7Ytd1n5beP7XpJqCDFua4GilQpdgF95j74tZ1D5WRLX34lMWGxNRJCVop7kUdGsVBnu+bMWoBzvMKWE1bMc8B1hhJm5QgjlIggBpguJ45LOdfw9Zf+Ld47buxoMx97mA2tO8KM4HxcN3lDHlRPuqIF/tNjE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705961858; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NzHL8aJDpNvMBJ2WBWw1qBXQpPaYiy2l39AZTY8wyvQ=; b=M61FTQaOJTt0iqNeOQrd6PsRwm1qfqUZrAdvfCdzakpCJ7i2gwAeJqvVTlANQ670a7vkD+hI5L74LRCFTpOvQ/lTU+sOYbg0sQ+6g7i5qJOfecFOCVUfA2YpGvTH+JUby0sEQFtZOobXOavqeBfv3abfQownj+/a6NBGXVqM5oo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705961858350515.2987540368579; Mon, 22 Jan 2024 14:17:38 -0800 (PST) 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) 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) 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1705961860138100001 Content-Type: text/plain; charset="utf-8" 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 =3D NULL; + uint32_t dist_matrix_size; =20 if (numa_enabled(ms) && ms->numa_state->have_numa_distance) { dist_matrix_size =3D riscv_socket_count(ms) * riscv_socket_count(m= s); @@ -189,7 +190,6 @@ void riscv_socket_fdt_write_distance_matrix(const Machi= neState *ms) "numa-distance-map-v1"); qemu_fdt_setprop(ms->fdt, "/distance-map", "distance-matrix", dist_matrix, dist_matrix_size); - g_free(dist_matrix); } } =20 --=20 2.43.0