From patchwork Mon Feb 28 17:49:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763592 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1AA3EC433EF for ; Mon, 28 Feb 2022 17:51:51 +0000 (UTC) Received: from localhost ([::1]:34514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkBa-0004sY-NB for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 12:51:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAB-00020R-MC; Mon, 28 Feb 2022 12:50:23 -0500 Received: from [2607:f8b0:4864:20::332] (port=46594 helo=mail-ot1-x332.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAA-0007pi-7l; Mon, 28 Feb 2022 12:50:23 -0500 Received: by mail-ot1-x332.google.com with SMTP id p12-20020a05683019cc00b005af1442c9e9so10086690otp.13; Mon, 28 Feb 2022 09:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xrwLekCaz1dVcDl6Q8AHFt/pNZ/bdVatNhyZ7TCu4uQ=; b=VsVhuZACDTigZYeYOSLyHNHmO8s4OKClBHZNvL2YEZXHdB30IaiSkY3fnarpcazrgJ nQ+pqBIh9EjwTghu5BYMQdm3qoIXADvwDWyf87Gn5uN5oR/d9Mbsfk0yrTFSqQmPbcYl yVtQ6Q39zRMFLDdG2FZzxwWSQpFDkdlYgMJ+MU5wcogiCeIv/7q0MLZTaF8bque9lOpi Cz9fAYk4mkvxOAzXyo8S0TpqvpnHd19Yh8cfkVhbZVRwivhTF9c/spMTDzLp1DeF9Ihq chTuDvbHawl7+hn5re02bltlyV3zaYge90OKQCmJcmRAve4vGZ/L0LM2qB7pAXjkyGsI gxXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xrwLekCaz1dVcDl6Q8AHFt/pNZ/bdVatNhyZ7TCu4uQ=; b=zrk02wvLClHTIDAAxmLK/bgeTbdAvAnvx7xR5qE20hVMCq+8dJkdx9scEdRGFXqc8c EKjI9hd8wAcwJGx5/4Czj9EvQYXU+l2TFP08qwP8QaZaVJ7mae0N25RbbQpgtidUZ4A9 37UfGUQ6WTKmyxfJsU+bQ6k7/1b8xZh1duWpCyfac3y5FtyD67oCtG38cdwWQrgyq3L+ T5oTEmWryvWm65rtaubOi1qI42ftm3MY53sCscxLkIrZVjeW0xferJrBTp/5QALrJ19i 8PqRYkzjndHb4hTKcIsGwFMBV43s76sG/+1NIVhhZOjDGkLF0hT8FOD17yRyKvovGhJS NMRQ== X-Gm-Message-State: AOAM532bcvXQPT3QG7luKN7KGBojsu8lcM08daVwRBkAOQjhEGQufWQJ on8RdgHD737fdpyO2eUdGPb/3IhWT5o= X-Google-Smtp-Source: ABdhPJwlxJt//BA5s95xAAbl7qOPSqpU3ly7PwpPjfRUtoTAE7y3ba9gAM3ZCUyuU4dalEWmzikjPg== X-Received: by 2002:a9d:8b5:0:b0:5a4:9db6:92b4 with SMTP id 50-20020a9d08b5000000b005a49db692b4mr9764289otf.14.1646070620618; Mon, 28 Feb 2022 09:50:20 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:20 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 01/14] hw/ppc/spapr.c: use g_autofree in spapr_dt_chosen() Date: Mon, 28 Feb 2022 14:49:51 -0300 Message-Id: <20220228175004.8862-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::332 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x332.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson --- hw/ppc/spapr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index f0b75b22bb..c74543ace3 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1018,9 +1018,9 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset) if (reset) { const char *boot_device = spapr->boot_device; - char *stdout_path = spapr_vio_stdout_path(spapr->vio_bus); + g_autofree char *stdout_path = spapr_vio_stdout_path(spapr->vio_bus); size_t cb = 0; - char *bootlist = get_boot_devices_list(&cb); + g_autofree char *bootlist = get_boot_devices_list(&cb); if (machine->kernel_cmdline && machine->kernel_cmdline[0]) { _FDT(fdt_setprop_string(fdt, chosen, "bootargs", @@ -1087,9 +1087,6 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset) } spapr_dt_ov5_platform_support(spapr, fdt, chosen); - - g_free(stdout_path); - g_free(bootlist); } _FDT(spapr_dt_ovec(fdt, chosen, spapr->ov5_cas, "ibm,architecture-vec-5")); From patchwork Mon Feb 28 17:49:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7865BC433EF for ; Mon, 28 Feb 2022 17:54:22 +0000 (UTC) Received: from localhost ([::1]:43114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkE1-000299-Hx for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 12:54:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAG-00025F-84; Mon, 28 Feb 2022 12:50:28 -0500 Received: from [2607:f8b0:4864:20::336] (port=46027 helo=mail-ot1-x336.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAD-0007q9-Av; Mon, 28 Feb 2022 12:50:26 -0500 Received: by mail-ot1-x336.google.com with SMTP id g6-20020a9d6486000000b005acf9a0b644so10091335otl.12; Mon, 28 Feb 2022 09:50:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9mxy1cshybqQSvMZopsk6bW7FYYsX3Wy2RNzLNjGm4I=; b=k1O7CVYKVXVqivDeDQkTSh9xEecimui/OIwv5R1zC0cHd6iK1o3xBH5ZAfNVvk/mAj EPuO0MV9E5uBvbz5YjLjqg0qeCikAzzLQxjDbmJF9nR47+SD/+oKDQv+aDYdJ7tHw5Vv bJPZBGtaWDEZRRxhzPfUjFk8JQ0OOi3kiF58SL3tMgd8PN1uXdiPDIcg+KYChJ/w6C8b VWGBckmUeuyxDq2vPPUYR8NgWlovn8xjztRU9rDzbBPJMgqcIbvjaHKfHdTB8HyMzumc v98gADhjNg6s1MxFhCE5X1nYslMrRit0uPfQQZqO4enQZqkdhRA6aH07GpfsNtv2+UEH Osyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9mxy1cshybqQSvMZopsk6bW7FYYsX3Wy2RNzLNjGm4I=; b=OlAaAbf/QVV7SP8ilHYfqR3PO5qvVY5bXcQ1WjUUo3MlOSb14BoE3U1kxwQXD6aomm SQy8Gi+ygSercU58AEY5wNEoeRB8udvGWXpvfMPl+Q7SQAnx0WQzLslPtvio6d4fuvki lIS3Dn8q/4DchoincKbbdMw/3mPix/EMac+aNrXqDt2VP1lG+ZnqpXaK958D3/LGe4wv PZg3jIs+uwB00MAGOZQOkAfJ1unGaTauoms5s77iwEyNEALOLXn5zFzK7kbWh6CJ8P+l eHREpTOOESUjSPgWkrKtK9KO+H1nqQHylvbhYgy9+YoFpqZixinSNvmdV8Oj2al9h7rN 3+Zg== X-Gm-Message-State: AOAM531k82M+dRfgCnKyc3qoSfDUPeu5oYb7aSoqtN2z8Px7zATWOHgV uhIpIPngTF8dw6T3+Z1UuknUpQC433c= X-Google-Smtp-Source: ABdhPJw4/kfNfzj5qumFkmCE1SxN+OkCgec6zzV95OrK4mgC5aeusEnsZGnVYFxGRk56E0dS7gdUkQ== X-Received: by 2002:a9d:22c8:0:b0:599:bcf4:1b57 with SMTP id y66-20020a9d22c8000000b00599bcf41b57mr9671173ota.247.1646070623211; Mon, 28 Feb 2022 09:50:23 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:23 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 02/14] hw/ppc/spapr.c: fail early if no firmware found in machine_init() Date: Mon, 28 Feb 2022 14:49:52 -0300 Message-Id: <20220228175004.8862-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::336 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::336; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x336.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The firmware check consists on a file search (qemu_find_file) and load it via load_imag_targphys(). This validation is not dependent on any other machine state but it currently being done at the end of spapr_machine_init(). This means that we can do a lot of stuff and end up failing at the end for something that we can verify right out of the gate. Move this validation to the start of spapr_machine_init() to fail earlier. While we're at it, use g_autofree in the 'filename' pointer. Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson --- hw/ppc/spapr.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c74543ace3..4cc204f90d 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2707,15 +2707,25 @@ static void spapr_machine_init(MachineState *machine) MachineClass *mc = MACHINE_GET_CLASS(machine); const char *bios_default = spapr->vof ? FW_FILE_NAME_VOF : FW_FILE_NAME; const char *bios_name = machine->firmware ?: bios_default; + g_autofree char *filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); const char *kernel_filename = machine->kernel_filename; const char *initrd_filename = machine->initrd_filename; PCIHostState *phb; int i; MemoryRegion *sysmem = get_system_memory(); long load_limit, fw_size; - char *filename; Error *resize_hpt_err = NULL; + if (!filename) { + error_report("Could not find LPAR firmware '%s'", bios_name); + exit(1); + } + fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE); + if (fw_size <= 0) { + error_report("Could not load LPAR firmware '%s'", filename); + exit(1); + } + /* * if Secure VM (PEF) support is configured, then initialize it */ @@ -2996,18 +3006,6 @@ static void spapr_machine_init(MachineState *machine) } } - filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - if (!filename) { - error_report("Could not find LPAR firmware '%s'", bios_name); - exit(1); - } - fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE); - if (fw_size <= 0) { - error_report("Could not load LPAR firmware '%s'", filename); - exit(1); - } - g_free(filename); - /* FIXME: Should register things through the MachineState's qdev * interface, this is a legacy from the sPAPREnvironment structure * which predated MachineState but had a similar function */ From patchwork Mon Feb 28 17:49:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763593 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ADDD1C43217 for ; Mon, 28 Feb 2022 17:51:53 +0000 (UTC) Received: from localhost ([::1]:34614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkBc-0004wD-Sh for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 12:51:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAH-000274-D7; Mon, 28 Feb 2022 12:50:29 -0500 Received: from [2607:f8b0:4864:20::22d] (port=39871 helo=mail-oi1-x22d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAE-0007rU-Nm; Mon, 28 Feb 2022 12:50:29 -0500 Received: by mail-oi1-x22d.google.com with SMTP id q5so13916602oij.6; Mon, 28 Feb 2022 09:50:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BGZpXuBmFzrRnKmQswNCtyLKVKEPO84WJlehYraDfT8=; b=qlX5PWvKnCixxKimPJOWFJX9ixVax8SI4bMB1TdmacFqZWNgrclQw3EyQy6E3Uf8Lj JyrvCGuYEGNJdHS8lwd76EZepXcVYqonSDy5RehhuL/79RywOZHTliHCORiqtIOfGvWG fGgqzm6IQv4YKEKRJGtM1JJhQKLUMDZqtL2SyTBuGZ00DIxcnrUFi3mLpTNjkMLYmCZ5 JCSERm700xYUbNAPVMry4hE11fJhDnsx7ui99Jq446X/i6BYkVi0E83bzhUmxkDlDSFu XyliVXmIhJoHaCOn0V+CYyaIYcb2y2o3TBt912iH0or0RV+HGhSa+Uq5JZl6mw8nM0VJ wRsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BGZpXuBmFzrRnKmQswNCtyLKVKEPO84WJlehYraDfT8=; b=HmHzg/3Pp5dv60w89j6C0PVKBzWiu+I4YNMFC1gh3GK1fwwWYM3EWrdJTfd/ZkqXce PBs2g60u/DjMmbGK1aDpCxkecSiPPczwYgl3AMmyXVSJCxT3JKYMmRJ7gF4RY0VARvYZ 8e8SvSCde6bF7zSYN2Knq+UsBDZRQdG40FveQS0GccOhMGpeOktL3aKS4LaWeFBxM9Pj 705rTSyR039KSpxkYyPpjjk2hKVi+TDZ8X3erpUyDS6rAUVt8W9ZxQV1qSu3bCW0xna6 czUJ45MGF2CNP4i/hCooY6y8aYtfSbGsrIeZI0zyFCoxILYkfjoUBqQXbJMeA+H7UBoE c5dw== X-Gm-Message-State: AOAM53153xOHM1N5UU84JPwi72j66FprqcknO3g6BS8irSFKLm7HrGA3 ZEgVJH1yZJglqbEmF318gwGWP61h4SE= X-Google-Smtp-Source: ABdhPJzEgEqIjT0h/tpyGs4GKUwdTCG8bQGte3s2XadtNJU7KXTHKETAbjFC5jM9PRleKjqnEWGXMw== X-Received: by 2002:a05:6808:2020:b0:2d4:df44:17cb with SMTP id q32-20020a056808202000b002d4df4417cbmr9541935oiw.69.1646070625023; Mon, 28 Feb 2022 09:50:25 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:24 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 03/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_set_string() Date: Mon, 28 Feb 2022 14:49:53 -0300 Message-Id: <20220228175004.8862-4-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::22d (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::22d; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x22d.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" And get rid of the 'out' label since it's now used. Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson --- hw/ppc/spapr_caps.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 6167431271..aab313ffb1 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -120,7 +120,7 @@ static void spapr_cap_set_string(Object *obj, Visitor *v, const char *name, SpaprCapabilityInfo *cap = opaque; SpaprMachineState *spapr = SPAPR_MACHINE(obj); uint8_t i; - char *val; + g_autofree char *val = NULL; if (!visit_type_str(v, name, &val, errp)) { return; @@ -128,20 +128,18 @@ static void spapr_cap_set_string(Object *obj, Visitor *v, const char *name, if (!strcmp(val, "?")) { error_setg(errp, "%s", cap->possible->help); - goto out; + return; } for (i = 0; i < cap->possible->num; i++) { if (!strcasecmp(val, cap->possible->vals[i])) { spapr->cmd_line_caps[cap->index] = true; spapr->eff.caps[cap->index] = i; - goto out; + return; } } error_setg(errp, "Invalid capability mode \"%s\" for cap-%s", val, cap->name); -out: - g_free(val); } static void spapr_cap_get_pagesize(Object *obj, Visitor *v, const char *name, From patchwork Mon Feb 28 17:49:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763594 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D44C6C433EF for ; Mon, 28 Feb 2022 17:52:31 +0000 (UTC) Received: from localhost ([::1]:35772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkCE-0005ia-RV for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 12:52:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAI-0002AP-O5; Mon, 28 Feb 2022 12:50:31 -0500 Received: from [2607:f8b0:4864:20::32e] (port=34536 helo=mail-ot1-x32e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAH-0007tH-CK; Mon, 28 Feb 2022 12:50:30 -0500 Received: by mail-ot1-x32e.google.com with SMTP id 40-20020a9d032b000000b005b02923e2e6so808141otv.1; Mon, 28 Feb 2022 09:50:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sv6PV5zO6SxCyrgKDKbOdeQ/0Zn4Tq3YRWmr8mzA1H0=; b=EbaT4gR7540h+wYcWGIjhIYq5QjnL30VrNQPt1DxLfZFaJFY2XkK1UsGCnjDJglkcH Am3ZX2RcX2+JUKZctVLKFN1Uqw6r57dXbr4hDueOBRCd/tNE4yjPA2KQYRA0kpivriPD MZ937w0zwyEKKp8vSCsSrfE4eeD2xExAZg6lRN7M/OH1uyEr2G1mBZAcM04P+g3nK7kx 725wwBlHhQZP4oVdfiD+uAkgnx+CtuiyHoo4+vngcvhZEOAlB+7UXPIeQeu/yP2Xlq7S egDhAQp2pXhcyv/yjYxzTie4T6TTtHdziA4ql/ShqyEUKpaQV6Wwi6XdnPQ63ouAMvUN BcTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sv6PV5zO6SxCyrgKDKbOdeQ/0Zn4Tq3YRWmr8mzA1H0=; b=ARtTWnTyG8TYf9EWxoWpnFRHjwxWNPuoP7CP1KVIaFyOGd8dQRs3Xsll8PM/zQeEgi kvrnvRrG15bbYMJxzoV63D+EEAFe0dap5az4wheU9fbyGFiwoqC9MisxrLkZzCXpJqRw V422/fPIsh+q8CJuKgJ/urN99NJ2GL3VWH+QgGjrFqM71uMYQcEzr/LL/MzPzsRVAXlB oELEz/1MlZmj9bpU/tFcr51AyXVJSa9+uY5iAGZSsxeNOtt8svwZ9Cpf9GUjVDAXEvdr +CyR4w8ehQ4/sYTHyqdRzATvNQ2qUEeEgHdSs1sUdCGS7mmkd7yg0sOYy8hxLaLCMY1h MPfw== X-Gm-Message-State: AOAM530nSfQzcZKLGzDJrX5AyrLeG/ga/Yn3S1kuXqBDLXoBBQajRjdA KGxoQ5Jil2yg82ICoUKslwYCpQgeJhU= X-Google-Smtp-Source: ABdhPJycV4ghV1QDOgD1Rhxaou6RvOhcPC4ZMYu1id6/ZroHuW1fyX8Y9y3QsGYSP5FJ2cWswna7Pg== X-Received: by 2002:a9d:6f82:0:b0:5af:1555:5a9b with SMTP id h2-20020a9d6f82000000b005af15555a9bmr10434721otq.289.1646070627362; Mon, 28 Feb 2022 09:50:27 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:27 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 04/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_get_string() Date: Mon, 28 Feb 2022 14:49:54 -0300 Message-Id: <20220228175004.8862-5-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::32e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32e.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson --- hw/ppc/spapr_caps.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index aab313ffb1..2773f9db9e 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -95,12 +95,12 @@ static void spapr_cap_set_bool(Object *obj, Visitor *v, const char *name, } -static void spapr_cap_get_string(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void spapr_cap_get_string(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { SpaprCapabilityInfo *cap = opaque; SpaprMachineState *spapr = SPAPR_MACHINE(obj); - char *val = NULL; + g_autofree char *val = NULL; uint8_t value = spapr_get_cap(spapr, cap->index); if (value >= cap->possible->num) { @@ -111,7 +111,6 @@ static void spapr_cap_get_string(Object *obj, Visitor *v, const char *name, val = g_strdup(cap->possible->vals[value]); visit_type_str(v, name, &val, errp); - g_free(val); } static void spapr_cap_set_string(Object *obj, Visitor *v, const char *name, From patchwork Mon Feb 28 17:49:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763600 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 775ACC4167D for ; Mon, 28 Feb 2022 17:54:24 +0000 (UTC) Received: from localhost ([::1]:43378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkE3-0002JM-LQ for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 12:54:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAK-0002Er-DV; Mon, 28 Feb 2022 12:50:32 -0500 Received: from [2607:f8b0:4864:20::233] (port=43532 helo=mail-oi1-x233.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAJ-0007v4-1K; Mon, 28 Feb 2022 12:50:32 -0500 Received: by mail-oi1-x233.google.com with SMTP id s5so13902234oic.10; Mon, 28 Feb 2022 09:50:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rzmueRPm0t5lahZZ3XOoI/QZfiygf1QukvIl5O1pQwQ=; b=LQqjIwXpeibOeUpJPmLmbkt5ioXQu+8Y1Wjjm+eAiLK5o5oSRMqahH0OJjoLguqaa5 Nq8i77dvFlhnjd+LqqWu7gQgpXNf+dQ8UTzr//fkovcJnC3ckVqQEwd0gfwN9SnDtswZ 3cGC868BVYJ+CiEVnWnQeHLd4F+WUk6ORER1IkrJI5R81KW3E9nXICdCclfFeX99dKs3 VEZEHsOPw6YVca525jPpm9P8PzwROvxPnIGM9sodt+r8Yj3cxmtYCdxg5nMH+rdygfq2 taWDS90rpBHAxcSAjislP2PhZkZS0g7ohpRjB2bxHPc5Edpra4JFTiyS8HhMksWFfw+Z V7HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rzmueRPm0t5lahZZ3XOoI/QZfiygf1QukvIl5O1pQwQ=; b=BWGqtBqAWBNRzUnKl+XdVg6XUJLbaD3odP2u/rfDVOMr59GDIEtw1Oc9nVManTDhEh arD9w/kn48b7PKIVvjUkU+f+hHJxRh7GyTubHUCj1wJqyjYgEnvHiFCbuQsqCcmuh7rs YggqBqTexvtApmyeJ3uK4bsBOelB2tzF3PTbqwlrueM68QpzTxB1M0jQIr5zee45t1x4 AP7kxxeMWrH2vvn1rfc1oJJ/SlsJ77Mg/Gpz//Fql8bc2ebN/N2X+kTrnXYUcU+j88np R3IZyBZxaQcgD4M764v1+TXTSN38ab8hR1oR295+TmzHAUqejpbVEAVJPfMeszLj31kz dLDA== X-Gm-Message-State: AOAM532dlygPIGJbMEJOMEFiKh6UW6lY39v6QLro4RqnuJV2M4paoRna cEtwAiDTcsXIfeV0PI6iwZLtFrncFtU= X-Google-Smtp-Source: ABdhPJzYP5SNRKq5Cgwc/7QpDTm4LXnGS4b9tHCUWMnYL8d3EjGPty/OaQXOxXp7wZx7/x5BNj+mHQ== X-Received: by 2002:aca:ba83:0:b0:2d4:13f1:8530 with SMTP id k125-20020acaba83000000b002d413f18530mr9471998oif.169.1646070629547; Mon, 28 Feb 2022 09:50:29 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:29 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 05/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_caps_add_properties() Date: Mon, 28 Feb 2022 14:49:55 -0300 Message-Id: <20220228175004.8862-6-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::233 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::233; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x233.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson --- hw/ppc/spapr_caps.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 2773f9db9e..655ab856a0 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -930,16 +930,13 @@ void spapr_caps_add_properties(SpaprMachineClass *smc) for (i = 0; i < ARRAY_SIZE(capability_table); i++) { SpaprCapabilityInfo *cap = &capability_table[i]; - char *name = g_strdup_printf("cap-%s", cap->name); - char *desc; + g_autofree char *name = g_strdup_printf("cap-%s", cap->name); + g_autofree char *desc = g_strdup_printf("%s", cap->description); object_class_property_add(klass, name, cap->type, cap->get, cap->set, NULL, cap); - desc = g_strdup_printf("%s", cap->description); object_class_property_set_description(klass, name, desc); - g_free(name); - g_free(desc); } } From patchwork Mon Feb 28 17:49:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763605 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4775EC433EF for ; Mon, 28 Feb 2022 17:58:15 +0000 (UTC) Received: from localhost ([::1]:53612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkHm-0000ye-BM for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 12:58:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAM-0002L6-Ou; Mon, 28 Feb 2022 12:50:34 -0500 Received: from [2607:f8b0:4864:20::229] (port=39868 helo=mail-oi1-x229.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAL-0007vv-7p; Mon, 28 Feb 2022 12:50:34 -0500 Received: by mail-oi1-x229.google.com with SMTP id q5so13916914oij.6; Mon, 28 Feb 2022 09:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cKCiBrKTpz0FpPLTRoThOF+LwZQzRV6UTVC7peKxeeQ=; b=jsRNjT/gueV+der7gW9FbvOeiLSJlOcbiwDEQuGaLJbNrixB4M7oBbkWBtIexb8GaV cA8uQcFJIPSIfAsCuwc/25B/1SK6YJjkpYNyKOEPBxUY2Yvod7QwgKkv9bUDuPvcgXGY ua+ue5Axyn+n5Gjo6/vYmZ/oEfArNYEr5urqA41JB4dJDui2q36tF8gs/fno9NRQIHJl /pbUjbw2uircknOaA2wZ/ooR8W1sMoXFtKkYqNwySTA6/1UU/0wpTdlwM4wR92a+IHRy GVjXExKAU2QONK08a6XHiJK8VE/lcNEW4KyMI91polT0Ysu7ZZGKWcD/OXhJyowalwvp 7q/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cKCiBrKTpz0FpPLTRoThOF+LwZQzRV6UTVC7peKxeeQ=; b=pqFB2v1YtLkRfIiNfYoaglKcuuS/96S+RIQbLGEMWKslEBNUVPbCcE3zDbgEh5ccLL cI59htUV2uNv3cZ0zEq602X8pZkFOLI26GDdRqq2WlC5dh/oGrSR9C4qL++Gtp3yrcWX Lj4h3jIJBxpDi7ryI+6QXBII/XFSMJOxz72GZyITiYdse80tO+KZzFYVHO+Rdo04BpIL 3/YMjMo/JfWjZrCj3db4VeXAZ/FAEpHGeJtVZl9dZZXHp0IDK9Tlm1G6aT0nStz+mB4R HC9DADV8QVF3bkP1KlfV24t9PeEx9H05913PFE3s91NaS+gODcBQC/oV2fbL/OeYlKxf /8XQ== X-Gm-Message-State: AOAM533k/q9lF+KU7zlr3fRCTzM7o3m7nS+9YSoWFyD5KRuT15r74nav dM5YdUUu9OrliNlrSwlqfwNUAJeMg38= X-Google-Smtp-Source: ABdhPJyYX2RXsxKt3TFBuwQWu9Y4SbpKrD2kCFrgPC1IwRWCSSvT+oGyMjI/JbwTdXrB5g/o3K/f5w== X-Received: by 2002:a05:6808:13d6:b0:2d6:7f1a:9390 with SMTP id d22-20020a05680813d600b002d67f1a9390mr9592351oiw.159.1646070631649; Mon, 28 Feb 2022 09:50:31 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:31 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 06/14] hw/ppc/spapr_drc.c: use g_auto in spapr_dt_drc() Date: Mon, 28 Feb 2022 14:49:56 -0300 Message-Id: <20220228175004.8862-7-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::229 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::229; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x229.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use g_autoptr() with GArray* and GString* pointers to avoid calling g_free() and the need for the 'out' label. 'drc_name' can also be g_autofreed to avoid a g_free() call at the end of the while() loop. Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr_drc.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index f8ac0a10df..0ba84063aa 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -841,8 +841,14 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask) ObjectProperty *prop; ObjectPropertyIterator iter; uint32_t drc_count = 0; - GArray *drc_indexes, *drc_power_domains; - GString *drc_names, *drc_types; + g_autoptr(GArray) drc_indexes = g_array_new(false, true, + sizeof(uint32_t)); + g_autoptr(GArray) drc_power_domains = g_array_new(false, true, + sizeof(uint32_t)); + g_autoptr(GString) drc_names = g_string_set_size(g_string_new(NULL), + sizeof(uint32_t)); + g_autoptr(GString) drc_types = g_string_set_size(g_string_new(NULL), + sizeof(uint32_t)); int ret; /* @@ -857,12 +863,8 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask) * reserve the space now and set the offsets accordingly so we * can fill them in later. */ - drc_indexes = g_array_new(false, true, sizeof(uint32_t)); drc_indexes = g_array_set_size(drc_indexes, 1); - drc_power_domains = g_array_new(false, true, sizeof(uint32_t)); drc_power_domains = g_array_set_size(drc_power_domains, 1); - drc_names = g_string_set_size(g_string_new(NULL), sizeof(uint32_t)); - drc_types = g_string_set_size(g_string_new(NULL), sizeof(uint32_t)); /* aliases for all DRConnector objects will be rooted in QOM * composition tree at DRC_CONTAINER_PATH @@ -874,7 +876,7 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask) Object *obj; SpaprDrc *drc; SpaprDrcClass *drck; - char *drc_name = NULL; + g_autofree char *drc_name = NULL; uint32_t drc_index, drc_power_domain; if (!strstart(prop->type, "link<", NULL)) { @@ -908,7 +910,6 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask) drc_name = spapr_drc_name(drc); drc_names = g_string_append(drc_names, drc_name); drc_names = g_string_insert_len(drc_names, -1, "\0", 1); - g_free(drc_name); /* ibm,drc-types */ drc_types = g_string_append(drc_types, drck->typename); @@ -928,7 +929,7 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask) drc_indexes->len * sizeof(uint32_t)); if (ret) { error_report("Couldn't create ibm,drc-indexes property"); - goto out; + return ret; } ret = fdt_setprop(fdt, offset, "ibm,drc-power-domains", @@ -936,29 +937,22 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask) drc_power_domains->len * sizeof(uint32_t)); if (ret) { error_report("Couldn't finalize ibm,drc-power-domains property"); - goto out; + return ret; } ret = fdt_setprop(fdt, offset, "ibm,drc-names", drc_names->str, drc_names->len); if (ret) { error_report("Couldn't finalize ibm,drc-names property"); - goto out; + return ret; } ret = fdt_setprop(fdt, offset, "ibm,drc-types", drc_types->str, drc_types->len); if (ret) { error_report("Couldn't finalize ibm,drc-types property"); - goto out; } -out: - g_array_free(drc_indexes, true); - g_array_free(drc_power_domains, true); - g_string_free(drc_names, true); - g_string_free(drc_types, true); - return ret; } From patchwork Mon Feb 28 17:49:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763602 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95BD4C433FE for ; Mon, 28 Feb 2022 17:54:59 +0000 (UTC) Received: from localhost ([::1]:45154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkEc-0003TQ-QI for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 12:54:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAO-0002PW-9N; Mon, 28 Feb 2022 12:50:36 -0500 Received: from [2607:f8b0:4864:20::22d] (port=43527 helo=mail-oi1-x22d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAM-0007x7-RZ; Mon, 28 Feb 2022 12:50:35 -0500 Received: by mail-oi1-x22d.google.com with SMTP id s5so13902425oic.10; Mon, 28 Feb 2022 09:50:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JbJ9Jy11cDYW/fcjCdWMlx85wNlNZDPtHScmitgTyE0=; b=U/t8oyEtXHt5l7QZwUadX5cEP+exsVAiknjC2aTH3ol2NPSLnVqL3pFYQa5Ps5PX3F VjhT3SG0g31/MMqhmaBgn/Qv8I0vFUIMebMvWQ1Lkhb1PoNwYVeBtBjvuQjygeXBUYJO nD4XlZFsjjkMtkP5msI6OWDcM7YcombnSiZsECMAF8gaVX8+3/gxjUmciuh2f5eaWrmx 6tsa7kyNi0DyoPrlpTMjs0tUm0FGFKjO89mlCykNNyiTEw5gV8/x+snEccd5XDYGHqUN yL4zmyKnXeGHYXNbQEndgDJ5maRGtuleYokWFhDDXGBgXjVeUMOO7w0sWQcx1cxWXLy3 gCbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JbJ9Jy11cDYW/fcjCdWMlx85wNlNZDPtHScmitgTyE0=; b=TXzTtfKKU5QkhzgzNAtFq5J2vosmlOkZRpRFhExR98QWV6un3NfseOL66WCaP2CoYY niUsjdKrJuRv37cK3+DQvk58DcxwxLjPZm5wxa1oMPBH1FzX1uzin/GTGPdeKmYN8uU+ KwjcIjL6g0k+mmbixG6M0OAWfdCT23nxWKkRb5a3qfxKcRmWZcPKoxnE4K+2K/v1R6gq jEXSrRoZAdkPSTIV0IHqNY8PiE0ys/lIfYJgGCPa4rHOPl6PHcSUpPhGYJFJsEligtND 6i28mK5hrWd4lxllQwHhl+oW/zqSyJdn2pE52Du00kdKLb72gUhMOZABZ4IOp7hpMwKP /cog== X-Gm-Message-State: AOAM533YoMbliJ0SOUu+9RaZbppSEOpwKif6IywAEMYnxKLJO6w8eA3W kOm94wxAb1l1VHlT0GcsU6o5kxhLWqo= X-Google-Smtp-Source: ABdhPJz6mi76U1O51/0s0vvnKcvstEpQC0HazupyNtZzyC3LPx/xmfktbYx6eL8+gaYIhcPhKoMmEQ== X-Received: by 2002:a05:6808:138b:b0:2d5:1fc2:b718 with SMTP id c11-20020a056808138b00b002d51fc2b718mr11384086oiw.119.1646070633449; Mon, 28 Feb 2022 09:50:33 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:33 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 07/14] hw/ppc/spapr_drc.c: use g_autofree in drc_realize() Date: Mon, 28 Feb 2022 14:49:57 -0300 Message-Id: <20220228175004.8862-8-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::22d (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::22d; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x22d.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr_drc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 0ba84063aa..251201fab3 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -519,8 +519,8 @@ static const VMStateDescription vmstate_spapr_drc = { static void drc_realize(DeviceState *d, Error **errp) { SpaprDrc *drc = SPAPR_DR_CONNECTOR(d); + g_autofree gchar *link_name = g_strdup_printf("%x", spapr_drc_index(drc)); Object *root_container; - gchar *link_name; const char *child_name; trace_spapr_drc_realize(spapr_drc_index(drc)); @@ -532,12 +532,10 @@ static void drc_realize(DeviceState *d, Error **errp) * existing in the composition tree */ root_container = container_get(object_get_root(), DRC_CONTAINER_PATH); - link_name = g_strdup_printf("%x", spapr_drc_index(drc)); child_name = object_get_canonical_path_component(OBJECT(drc)); trace_spapr_drc_realize_child(spapr_drc_index(drc), child_name); object_property_add_alias(root_container, link_name, drc->owner, child_name); - g_free(link_name); vmstate_register(VMSTATE_IF(drc), spapr_drc_index(drc), &vmstate_spapr_drc, drc); trace_spapr_drc_realize_complete(spapr_drc_index(drc)); From patchwork Mon Feb 28 17:49:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763609 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB855C433EF for ; Mon, 28 Feb 2022 18:00:43 +0000 (UTC) Received: from localhost ([::1]:60394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkKA-0005Ts-QV for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 13:00:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAQ-0002Xp-9h; Mon, 28 Feb 2022 12:50:38 -0500 Received: from [2607:f8b0:4864:20::22a] (port=40790 helo=mail-oi1-x22a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAO-0007xU-Rb; Mon, 28 Feb 2022 12:50:37 -0500 Received: by mail-oi1-x22a.google.com with SMTP id j2so13889194oie.7; Mon, 28 Feb 2022 09:50:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ff+w9iWXeiR1/IzEOsrDIWGlDl1RPZPJn7h1o/fwJG0=; b=FxDyPzaKQZ2HSryrJ/Tl+lV42z78KJGfikTsVC3yZTO75B4xUHRMv7jKCAHxP8G2UR 8UisTTaZi6Mt+gnt1uuLal5Usb1jIFzsVeaYhEMuevl6RxXeus6MIk/sIVKEQ1kx3GvD LI02cbu+pzL6FXjQIjLbXUoTC9xswkWR0yKhFE5+9hB59dP6wWdR4c1n1zEoH/KSgTYx 49iSofAycrJYQ0vq7PP91EIwvViIZ7MQ1GipqrJWpDFuWK+GrUeqMhCuxNOFO5NgdIL7 wEclOmCyxyM32k/e0zIE89tNuZGwshHTgXpTCFzmCjbMcMfzPPctPtnTb78NqkD7Vmkx cXeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ff+w9iWXeiR1/IzEOsrDIWGlDl1RPZPJn7h1o/fwJG0=; b=hpfubbv7ICvThaGfQTSqK3zql6MeeDwakbEH48OKjg6VcrsHFsuhzIb9Mn0oX7kH0b OvT/jDC3UyOgdwEM84W2r31x95exBeHxWoadWQB/ntZ8163ne9t59AQqg9YOHGH4q2JF hz8akSFJ0wMtLDzo9KXOAjGpRZyaz11QQD9wErYLoprbeCSufhd3lJ9DeushMyWHvmZP AgRFj27cWTkhFOa19B3doHPk+nVpmN+3UBK+GaUGb9mzHPOkiliEnUH/BJNQUoZpqS8r y5T9/+ad7dJYiMcUqI64T8wvHWTFPgMfCpa5oJkaKigHanLqvRv3OQSbrNckbDkAmoGa wdXQ== X-Gm-Message-State: AOAM533plhKEWziEByw+8mXo/w197d647nCatHJoE2SZwgThfAKKdytO +3KBBRbTvAhZPJUpE4BJ924aXnIOsVY= X-Google-Smtp-Source: ABdhPJxSEw5JCXga24qkcaRH7VbDCTw5jbpHF1b2PV9Ygg4OY9TsZDCL45ytRpRURQJFAjhB8b3ktg== X-Received: by 2002:a05:6808:1884:b0:2d5:1d96:deed with SMTP id bi4-20020a056808188400b002d51d96deedmr9551651oib.95.1646070635479; Mon, 28 Feb 2022 09:50:35 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:35 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 08/14] hw/ppc/spapr_drc.c: use g_autofree in drc_unrealize() Date: Mon, 28 Feb 2022 14:49:58 -0300 Message-Id: <20220228175004.8862-9-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::22a (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::22a; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x22a.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr_drc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 251201fab3..b2a365baf1 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -544,15 +544,13 @@ static void drc_realize(DeviceState *d, Error **errp) static void drc_unrealize(DeviceState *d) { SpaprDrc *drc = SPAPR_DR_CONNECTOR(d); + g_autofree gchar *name = g_strdup_printf("%x", spapr_drc_index(drc)); Object *root_container; - gchar *name; trace_spapr_drc_unrealize(spapr_drc_index(drc)); vmstate_unregister(VMSTATE_IF(drc), &vmstate_spapr_drc, drc); root_container = container_get(object_get_root(), DRC_CONTAINER_PATH); - name = g_strdup_printf("%x", spapr_drc_index(drc)); object_property_del(root_container, name); - g_free(name); } SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type, From patchwork Mon Feb 28 17:49:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763610 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40A7EC433F5 for ; Mon, 28 Feb 2022 18:02:00 +0000 (UTC) Received: from localhost ([::1]:35036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkLP-0007UA-6p for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 13:01:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAS-0002gg-OB; Mon, 28 Feb 2022 12:50:40 -0500 Received: from [2607:f8b0:4864:20::22c] (port=42648 helo=mail-oi1-x22c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAR-0007y0-4v; Mon, 28 Feb 2022 12:50:40 -0500 Received: by mail-oi1-x22c.google.com with SMTP id a6so13891185oid.9; Mon, 28 Feb 2022 09:50:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oKD/C7wjIjDJYk8HQQyKcIQhAW36scXHc1YW7sGgnZ8=; b=StBzxM+0SkG8c7xcr+LYkEITxSQJBhvLLjJLj3v7GwSnveKPPKuUri9zrIJq9Fce8f ft2A0P3fXtyNeK5LEtYG8m9OCHgLoUJzy6tsNUzmuWEXWqv4hJARebHtKnDH58KdulmI xsc9f1Z3wmGiXcn/cabmLbdspuQlyzUQ8hLEJ8zOErqTUewFGZG1R01BQ3DDpXNts9CW tfSW5Hw7Ts2Bv/Gf52gbUUBcs0DKatVCCdOFHtrmWFDqsALuJy7WgxFcZQIufrrtwJFM cNqVyFmmPB63Mux3a6AgyLhJ78xBxY1+9W97I/dcjmCJxzyrcZzR+5WxFiGvRE8EUXxs tnrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oKD/C7wjIjDJYk8HQQyKcIQhAW36scXHc1YW7sGgnZ8=; b=r+uuvX6mWv3BdtDTb8t8d8hm8fd9VGZyCk/6ch9sRAMpC2bXOv7GXKPq1yNWk64UP+ /jYhBfIVEIjZo8eAkyEueWVwxxlYAa8ludhhmH4dUnvqX122uWL+BvMHNr+V10c9ZQRo jCS11s/ngg4FjH/m9CkbG9/QzeIptUUHBiJhTLogczcCj16CxK9uYpkV6unD5EsvvCYH EJTUbiPJ6nl84FHoHYUQqrvlEx0Eyc1rlu3qNeZHabWIaw25wVf4wVGtqxegs4KOV3o4 kHiByffjZtoMWKp/d6Z6fX1a1gBJ397KRVvdBkI6z8lsJZ2FLGByQDXC/MV0f9mFIk+9 ZjCg== X-Gm-Message-State: AOAM531S3BW9rR4DIBoO7VEJX7coQzPsuLFPC0/7FvqS0PlNNodRLi7l 6YU1jDhYPP2zxxinTujyhrZgaG0noGM= X-Google-Smtp-Source: ABdhPJyV97D7S3Cnf/ticF1TKmLITahzEwrvtNy5AQyyS5EXqxXRCODutTi9HwqUSU2dCtvXMamE3w== X-Received: by 2002:aca:bd87:0:b0:2cf:4801:c2b5 with SMTP id n129-20020acabd87000000b002cf4801c2b5mr11457952oif.104.1646070637471; Mon, 28 Feb 2022 09:50:37 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:37 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 09/14] hw/ppc/spapr_drc.c: use g_autofree in spapr_dr_connector_new() Date: Mon, 28 Feb 2022 14:49:59 -0300 Message-Id: <20220228175004.8862-10-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::22c (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x22c.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr_drc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index b2a365baf1..ac4067625e 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -557,7 +557,7 @@ SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type, uint32_t id) { SpaprDrc *drc = SPAPR_DR_CONNECTOR(object_new(type)); - char *prop_name; + g_autofree char *prop_name = NULL; drc->id = id; drc->owner = owner; @@ -566,7 +566,6 @@ SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type, object_property_add_child(owner, prop_name, OBJECT(drc)); object_unref(OBJECT(drc)); qdev_realize(DEVICE(drc), NULL, NULL); - g_free(prop_name); return drc; } From patchwork Mon Feb 28 17:50:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F211C433EF for ; Mon, 28 Feb 2022 17:52:49 +0000 (UTC) Received: from localhost ([::1]:36364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkCV-00066r-2A for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 12:52:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAU-0002kg-9b; Mon, 28 Feb 2022 12:50:42 -0500 Received: from [2607:f8b0:4864:20::22d] (port=42649 helo=mail-oi1-x22d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAS-0007yL-QN; Mon, 28 Feb 2022 12:50:41 -0500 Received: by mail-oi1-x22d.google.com with SMTP id a6so13891253oid.9; Mon, 28 Feb 2022 09:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i8RO+JATm4l+COyg80pLCIUyiGIxBD1Ri+dzPXkEvEM=; b=FLOsrujslmy6o5A/AGtWgPHumFYzQjZwip47n1V85yIxYdoJk/rtUkrVBMCPrwUUFs bN4sYYDJ6q9DBxOLuofxOMeRkGg5SVwAbDpV7uvAUyHnSJa1go1ETnNw4v7EejFJy5oV MCaJJ3t+ODOnVgOeD7MOPTBh1vQcsVLLi76ABLsMnkLKt2zMeJ82YHEpLmzFXWETTH+V HEs4Kv6ZoSaltGd6UmWOhzkFEtwueV+06m4lOENU3X8gDNQFBLs/6awjN2aCEFTtgTVR zbWavGUPYLpLxkSsFgH5l+IBkR/3ZqityvCONYljeO4NIa1hzrCIzDNZKENBbiU4uUBr efjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i8RO+JATm4l+COyg80pLCIUyiGIxBD1Ri+dzPXkEvEM=; b=MXNKlk6NDhkCweWr/4pJ5YWskcAvKmUPAKqUxvEM8Av0H9BUv+Vk12ACvDKxkX2nUw EH3SaRxkF/GN5xbdfhpkfAuuIhC/E80m5U27QeyazcRmYrTNX25nka2DYp78IL+UOT6L AtPqxw3LdnVVvqn7JLK7t3BeeoQep9Cc1UIwd3FTKplGambtoSg+i6mE1eKibijJ6xx3 C71mQUeqrMtvdDcK3jMzrEkr4anbAXTxqzzECKZ92Yzt5Se7iVrM5oivDu/EI8Ww3W+P /l6dBTHcoTVakmmL0NLIgkTQB6W6tHXlTVgXcMfjYHWlgdGogAfI9/ZlXc5MzqOZ2JGn ADvg== X-Gm-Message-State: AOAM530SAGqWGYyZHMwBnGHVEJSupKViE4DpI4yUXnHvOa5nRvxiqRKf mWdzEvTFuqzMi0Td83sioRTLkBeLzp0= X-Google-Smtp-Source: ABdhPJzwbFV7Iyn0RAc6pQPqnAsvJLjgvi0R/frYqCP23pEZl0tYLBXiZM/TAeIt/gN+CC8Yd2q42g== X-Received: by 2002:a05:6808:309e:b0:2d5:35e5:e1ac with SMTP id bl30-20020a056808309e00b002d535e5e1acmr9826573oib.86.1646070639370; Mon, 28 Feb 2022 09:50:39 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:39 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 10/14] hw/ppc/spapr_drc.c: use g_autofree in spapr_drc_by_index() Date: Mon, 28 Feb 2022 14:50:00 -0300 Message-Id: <20220228175004.8862-11-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::22d (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::22d; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x22d.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr_drc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index ac4067625e..76bc5d42a0 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -798,11 +798,9 @@ static const TypeInfo spapr_drc_pmem_info = { SpaprDrc *spapr_drc_by_index(uint32_t index) { Object *obj; - gchar *name; - - name = g_strdup_printf("%s/%x", DRC_CONTAINER_PATH, index); + g_autofree gchar *name = g_strdup_printf("%s/%x", DRC_CONTAINER_PATH, + index); obj = object_resolve_path(name, NULL); - g_free(name); return !obj ? NULL : SPAPR_DR_CONNECTOR(obj); } From patchwork Mon Feb 28 17:50:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763608 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4C19C433EF for ; Mon, 28 Feb 2022 17:59:10 +0000 (UTC) Received: from localhost ([::1]:56608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkIg-0002xm-0s for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 12:59:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAl-000331-As; Mon, 28 Feb 2022 12:50:59 -0500 Received: from [2607:f8b0:4864:20::232] (port=33737 helo=mail-oi1-x232.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAW-0007ys-Al; Mon, 28 Feb 2022 12:50:59 -0500 Received: by mail-oi1-x232.google.com with SMTP id x193so13990321oix.0; Mon, 28 Feb 2022 09:50:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vYwp80VwgpkGj27dkmK9wKIAecowSu10UxZ5mM4Cdr0=; b=TcKHqV9/pH1BVeOdgAOuIoJCXc7zCh7BIF2dqJtCUT6KYWm9AXmzRbR2AhTAx4Fg/e LpeEr5ioya1SZVjQd1uryRPMbnRE+V1wlCdYINpH2Fx4qdKwm6asdDSmo6XSXVY1Q3BS r+k8cA/3tJDBZ37JjsNnZSIuXif5L9hswNjRlEoctK/qu9h63fCBZq3a+RH5Qaxm87sa W0sW0wvG0Dt4StCVmh5srOIgf60h0ggsRDX6LzHTadEVWd3EWiXx0B+CZO4GtfIB45BL W1NXSW8UhwZxZV1R+D2/Yn4rYJEojc9iNktEhCuoRX92FvdZVrscYdWTazsN4R//5TaV 7yNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vYwp80VwgpkGj27dkmK9wKIAecowSu10UxZ5mM4Cdr0=; b=OoKjrXr6cwqCXtFdS8pOzygvLBtmKamsoQ90Pg9CsnA8mudFmKIkJ2YgWLenL+tqac N4ZnI+Zh9eKUTFFy3LJkov8yhYQDWSRfEmhMxFKRPzHY2M0qWKGFqGwdeb0BQVR7b5gl V/BXEnuQIHuKyrNmJyy8iKhk3EOnAgNsFzsnPwgHMXjXMWd5K+518W5rIMhU/8D5SOtX wZlLyqB5HSGAhG8yOlDTz90Cl/B0xiFF26E/gWUxC/cStwvzTP/lzd6kxDcH6ZUg8ySI NxV4jdVx12G5xpbI77kJ1MGWvIVnkCArs71XXZeSv4FhdVBONpwXpeOcOXp1qwpQ9Kls FQIw== X-Gm-Message-State: AOAM5331mI2dJHZ3LeiD2Y9O4Kg0aE8AxBkwT+7UoVR4BjRYs9D0VI2C Nifv5QYHD3ifaupPVYGwE3xi5s9Wo90= X-Google-Smtp-Source: ABdhPJymlNUcpsxj7K2J2sEyUnRpCGDplcdSXmfU//O/EZtEVTqM4XlmCd2B3Q+bL7Coc7E+KDHgSA== X-Received: by 2002:a05:6808:3021:b0:2d4:40f3:6b30 with SMTP id ay33-20020a056808302100b002d440f36b30mr11577629oib.31.1646070641195; Mon, 28 Feb 2022 09:50:41 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:41 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 11/14] hw/ppc/spapr_numa.c: simplify spapr_numa_write_assoc_lookup_arrays() Date: Mon, 28 Feb 2022 14:50:01 -0300 Message-Id: <20220228175004.8862-12-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::232 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x232.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We can get the job done in spapr_numa_write_assoc_lookup_arrays() a bit cleaner: - 'cur_index = int_buf = g_malloc0(..)' is doing a g_malloc0() in the 'int_buf' pointer and making 'cur_index' point to 'int_buf' all in a single line. No problem with that, but splitting into 2 lines is clearer to follow - use g_autofree in 'int_buf' to avoid a g_free() call later on - 'buf_len' is only being used to store the size of 'int_buf' malloc. Remove the var and just use the value in g_malloc0() directly - remove the 'ret' var and just return the result of fdt_setprop() Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr_numa.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index e9ef7e7646..4f93bdefec 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -431,12 +431,14 @@ int spapr_numa_write_assoc_lookup_arrays(SpaprMachineState *spapr, void *fdt, int max_distance_ref_points = get_max_dist_ref_points(spapr); int nb_numa_nodes = machine->numa_state->num_nodes; int nr_nodes = nb_numa_nodes ? nb_numa_nodes : 1; - uint32_t *int_buf, *cur_index, buf_len; - int ret, i; + g_autofree uint32_t *int_buf = NULL; + uint32_t *cur_index; + int i; /* ibm,associativity-lookup-arrays */ - buf_len = (nr_nodes * max_distance_ref_points + 2) * sizeof(uint32_t); - cur_index = int_buf = g_malloc0(buf_len); + int_buf = g_malloc0((nr_nodes * max_distance_ref_points + 2) * + sizeof(uint32_t)); + cur_index = int_buf; int_buf[0] = cpu_to_be32(nr_nodes); /* Number of entries per associativity list */ int_buf[1] = cpu_to_be32(max_distance_ref_points); @@ -451,11 +453,9 @@ int spapr_numa_write_assoc_lookup_arrays(SpaprMachineState *spapr, void *fdt, sizeof(uint32_t) * max_distance_ref_points); cur_index += max_distance_ref_points; } - ret = fdt_setprop(fdt, offset, "ibm,associativity-lookup-arrays", int_buf, - (cur_index - int_buf) * sizeof(uint32_t)); - g_free(int_buf); - return ret; + return fdt_setprop(fdt, offset, "ibm,associativity-lookup-arrays", + int_buf, (cur_index - int_buf) * sizeof(uint32_t)); } static void spapr_numa_FORM1_write_rtas_dt(SpaprMachineState *spapr, From patchwork Mon Feb 28 17:50:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763604 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC568C433F5 for ; Mon, 28 Feb 2022 17:58:14 +0000 (UTC) Received: from localhost ([::1]:53626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkHl-0000z6-VW for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 12:58:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAc-0002uc-Mu; Mon, 28 Feb 2022 12:50:50 -0500 Received: from [2607:f8b0:4864:20::230] (port=43531 helo=mail-oi1-x230.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAX-0007z2-GR; Mon, 28 Feb 2022 12:50:50 -0500 Received: by mail-oi1-x230.google.com with SMTP id s5so13902860oic.10; Mon, 28 Feb 2022 09:50:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sAwShS4RASMJ0Mkxwt+AWlFFgAVeu3eOY016igiya50=; b=nph/pyaZctNWCPpGJ0s9atF2oIZaAxdv42VAkPE413Aq678GhMmA5sNO1HdD2sgGEB 8O1uFOt3ZpQEYT5qwNnXtRpoWmE3Vb5KPXmRLuIVfBv0I5C/3yylpi/gpzFTXamu7rTj oateLTq2R+XV18dnRcx3xw9Cw2mB+Nn7GjlZbZdZgrJXYD01/9ijNf9HxD1ZE7yD7DO2 AONhn0GDLB0JWKTMKhS7FTu0/xuc/PZXvnHWlVvTUbjJjRr2PCZxGOcNYEg3K1gzD0jg 12hNQqjxlwoVCVmXpWVXwlcnxBB4VzvpKzx+EaL92MWoEOAG2zS1hYGjIvnwqLokt7IA z4xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sAwShS4RASMJ0Mkxwt+AWlFFgAVeu3eOY016igiya50=; b=YGzoOOeko5cnI3vWdvldJANWi+0w4QXA3dPq2eHyMuLKeiQhuEndHYReBOaL5SACn9 Dz8kTwSGbmY165Oh5PNGiOiMIPfwg5Urapf0jjtymz2yyolh3uNgUnmxL82yJaYHs6or cOlfDQf3tqFkdXrC+yeuIaNgKRFK0LaV0sfJu1rAQrEYIfxtAhZ5ShtQHuGZ5XGqA9JN aBwB7WLPrZabqcREdv7R62FDMuIyVQMukc9oYET+OWmMYEGTZFNPCnaYYe/gaDJRlF4O XgiZKQgqFozNNtKcK+WrqaU1Rz29CEhI3Zkm3zUnjsnEJf5D4L1xiK+A9MexIqwMqSZd wwmw== X-Gm-Message-State: AOAM532NP9M+LCZCpT5VpUWCsjOfesE2GbMN47WwTHjacSOC63LCjv0t U4B3pRpFXXlgL67WAKns0rl2XE8CUx8= X-Google-Smtp-Source: ABdhPJwfb0vDT2PTVoyLtVphS8xwQtP/PyV+zeri1K3bGmd0HH2kHRXrd/K1o5TX7tv5hkJ+7wGEag== X-Received: by 2002:a54:4611:0:b0:2d7:988a:5784 with SMTP id p17-20020a544611000000b002d7988a5784mr2898247oip.156.1646070643208; Mon, 28 Feb 2022 09:50:43 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:43 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 12/14] spapr_pci_nvlink2.c: use g_autofree in spapr_phb_nvgpu_ram_populate_dt() Date: Mon, 28 Feb 2022 14:50:02 -0300 Message-Id: <20220228175004.8862-13-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::230 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x230.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr_pci_nvlink2.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/ppc/spapr_pci_nvlink2.c b/hw/ppc/spapr_pci_nvlink2.c index 7fb0cf4d04..4678c79235 100644 --- a/hw/ppc/spapr_pci_nvlink2.c +++ b/hw/ppc/spapr_pci_nvlink2.c @@ -320,7 +320,7 @@ void spapr_phb_nvgpu_populate_dt(SpaprPhbState *sphb, void *fdt, int bus_off, void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, void *fdt) { int i, j, linkidx, npuoff; - char *npuname; + g_autofree char *npuname = NULL; if (!sphb->nvgpus) { return; @@ -333,11 +333,10 @@ void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, void *fdt) _FDT(fdt_setprop_cell(fdt, npuoff, "#size-cells", 0)); /* Advertise NPU as POWER9 so the guest can enable NPU2 contexts */ _FDT((fdt_setprop_string(fdt, npuoff, "compatible", "ibm,power9-npu"))); - g_free(npuname); for (i = 0, linkidx = 0; i < sphb->nvgpus->num; ++i) { for (j = 0; j < sphb->nvgpus->slots[i].linknum; ++j) { - char *linkname = g_strdup_printf("link@%d", linkidx); + g_autofree char *linkname = g_strdup_printf("link@%d", linkidx); int off = fdt_add_subnode(fdt, npuoff, linkname); _FDT(off); @@ -347,7 +346,6 @@ void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, void *fdt) _FDT((fdt_setprop_cell(fdt, off, "phandle", PHANDLE_NVLINK(sphb, i, j)))); _FDT((fdt_setprop_cell(fdt, off, "ibm,npu-link-index", linkidx))); - g_free(linkname); ++linkidx; } } @@ -360,7 +358,8 @@ void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, void *fdt) &error_abort); uint64_t size = object_property_get_uint(nv_mrobj, "size", NULL); uint64_t mem_reg[2] = { cpu_to_be64(nvslot->gpa), cpu_to_be64(size) }; - char *mem_name = g_strdup_printf("memory@%"PRIx64, nvslot->gpa); + g_autofree char *mem_name = g_strdup_printf("memory@%"PRIx64, + nvslot->gpa); int off = fdt_add_subnode(fdt, 0, mem_name); _FDT(off); @@ -378,7 +377,6 @@ void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, void *fdt) sizeof(mem_reg)))); _FDT((fdt_setprop_cell(fdt, off, "phandle", PHANDLE_GPURAM(sphb, i)))); - g_free(mem_name); } } From patchwork Mon Feb 28 17:50:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CD04DC433F5 for ; Mon, 28 Feb 2022 17:54:58 +0000 (UTC) Received: from localhost ([::1]:44916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkEb-0003Jj-TH for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 12:54:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42776) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAa-0002sd-AT; Mon, 28 Feb 2022 12:50:48 -0500 Received: from [2607:f8b0:4864:20::c2e] (port=42581 helo=mail-oo1-xc2e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAY-00080D-Q0; Mon, 28 Feb 2022 12:50:48 -0500 Received: by mail-oo1-xc2e.google.com with SMTP id s203-20020a4a3bd4000000b003191c2dcbe8so19637331oos.9; Mon, 28 Feb 2022 09:50:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hhvHRAqMDp+f6RDeOM0Xwma/ZY8DYhuGMgeOoiLgxxc=; b=lSDU8pmalQnOcA6grWM02tRVh0XVJ6aaM6omRifkhh5BCx/NrFwofC6W7IQHIpazUz dERN7Yb1k8Ih/pmuxpT97wziY3UwCzN45Y/CetxYdIxXn/cD4HzIZDbWK8PPrarUMUN9 /BG2fkdwN3JVhivuG7nY7+WpCqByZZC3LGpYxMRHX/19jL00hmw/b6e44SBnkaFngwnJ lmuhJLrsQtheyNw9yYxQj0lwx9soJOqiAeqMhDukZnBd1dNiO3AnO1cKtV0aovIxF+IT P9pnh2mdxoZvptn+RDhhWvEZO2GUb23CAXeTD8p6PK0XL4gzMzCmEoacqRTtczJOl0aX TqCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hhvHRAqMDp+f6RDeOM0Xwma/ZY8DYhuGMgeOoiLgxxc=; b=iWrWt9qvPhQq2H4jyFHDXmmEdgebPhSNUbcMNcs26EHBiTuWiRwnDP6+ZUbqR3dLQi Pfz5xNo4zixwE2UgLLM+WkE2JuZIp4B+yCVJE4LGRbVgrvDngMrA0hSEXTj5emHtiaFR uRPVIAp8TxGZAPTt6HT6JnzxU8XvZfBSOVlDe2/I6YgkVFEw0Oo+TL8e+S+0UyWd8VoA DNsZ/99Uws6WNBD+0S6Mm892+gx/rWNTl40NoZYBuYv3+4izW7dUxTDum0rxyhkxmjQm 3e7S3lzhqIJdLKwsR8RGP5p1hnO8bxXniKBhm/Jva/+CTECZCKLLlzdyqbqipJ/V1tu8 I3tw== X-Gm-Message-State: AOAM531zNWnEUPhwnIuthUDYHN0mu1zOqGrxvqxp9C3Sg/K36J9l1r45 O7rAX/Oa5dJG4RbZABWHHCLevQB1E3c= X-Google-Smtp-Source: ABdhPJxE1H4RFLsZS5KCXKhPnyjl5OXY2yVVBQyMTUpQNzg/Rsd592NttmBaRhLHnydde0G1xMui8Q== X-Received: by 2002:a05:6870:311:b0:d2:c4c0:942a with SMTP id m17-20020a056870031100b000d2c4c0942amr8923121oaf.92.1646070645375; Mon, 28 Feb 2022 09:50:45 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:45 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 13/14] hw/ppc/spapr_rtas.c: use g_autofree in rtas_ibm_get_system_parameter() Date: Mon, 28 Feb 2022 14:50:03 -0300 Message-Id: <20220228175004.8862-14-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::c2e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::c2e; envelope-from=danielhb413@gmail.com; helo=mail-oo1-xc2e.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr_rtas.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index b476382ae6..d7c04237fe 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -279,30 +279,29 @@ static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu, switch (parameter) { case RTAS_SYSPARM_SPLPAR_CHARACTERISTICS: { - char *param_val = g_strdup_printf("MaxEntCap=%d," - "DesMem=%" PRIu64 "," - "DesProcs=%d," - "MaxPlatProcs=%d", - ms->smp.max_cpus, - ms->ram_size / MiB, - ms->smp.cpus, - ms->smp.max_cpus); + g_autofree char *param_val = g_strdup_printf("MaxEntCap=%d," + "DesMem=%" PRIu64 "," + "DesProcs=%d," + "MaxPlatProcs=%d", + ms->smp.max_cpus, + ms->ram_size / MiB, + ms->smp.cpus, + ms->smp.max_cpus); if (pcc->n_host_threads > 0) { - char *hostthr_val, *old = param_val; - /* * Add HostThrs property. This property is not present in PAPR but * is expected by some guests to communicate the number of physical * host threads per core on the system so that they can scale * information which varies based on the thread configuration. */ - hostthr_val = g_strdup_printf(",HostThrs=%d", pcc->n_host_threads); + g_autofree char *hostthr_val = g_strdup_printf(",HostThrs=%d", + pcc->n_host_threads); + char *old = param_val; + param_val = g_strconcat(param_val, hostthr_val, NULL); - g_free(hostthr_val); g_free(old); } ret = sysparm_st(buffer, length, param_val, strlen(param_val) + 1); - g_free(param_val); break; } case RTAS_SYSPARM_DIAGNOSTICS_RUN_MODE: { From patchwork Mon Feb 28 17:50:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 12763611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D8C6CC43217 for ; Mon, 28 Feb 2022 18:04:27 +0000 (UTC) Received: from localhost ([::1]:40930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOkNm-00032D-S4 for qemu-devel@archiver.kernel.org; Mon, 28 Feb 2022 13:04:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOkAc-0002uJ-If; Mon, 28 Feb 2022 12:50:50 -0500 Received: from [2607:f8b0:4864:20::329] (port=43883 helo=mail-ot1-x329.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOkAa-00080w-TE; Mon, 28 Feb 2022 12:50:49 -0500 Received: by mail-ot1-x329.google.com with SMTP id j9-20020a9d7d89000000b005ad5525ba09so10075550otn.10; Mon, 28 Feb 2022 09:50:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HWQSY6AW0ufVgup1Eft5QjjEIsECY/xMODO8cltOgnQ=; b=W78UuLO8f8eLcL0FNiORhlNX+c/GCBgVy97tmNpgg+HgAm+Hra1G0HIeajSXhztA+E F/EkDg1C+8pGv6COPRwQ15PdFbeSXRp0bLPHdnhDjlFjbPd7Wtsih6CLI8ItIHmJ1Bhv E30vq3+1VdexrXR+ZEfyhMbPjgpM0ewv/HS6obZgH2Dc7F+wOywaebednQbD3A5akfKh 1SjVspIhzSPp7SQTarGhft0M3oMytqSsE9VMA1p64CG4aiCGG7TDz4MaIQDvC64lM/YS jHFDiI+ZMH6nHulvR7HatlbhYJIlzidN71KrsLmxT+a6F4lylkA+rnD/n++d9XCM4T0a ewUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HWQSY6AW0ufVgup1Eft5QjjEIsECY/xMODO8cltOgnQ=; b=B9RggYhP/sRnowIQPMbDQEo/E1NbsqZVTbodXWNkR0IEq51DaG1JVS7CNhW0O2v16V OOJTPTtqsSTy4Ekx4pymk7vF269HDLFtq0lMCURHZwzsKiBhEI8bN4xQctXlM1ni1g1c dDlx4e9k8IRh4B6Z05LxyPA4HDHzyD/HeIQuUK2YojHhwaIpAU6rNnWYsGT5dcWYuX4S LPivHaKpc064xqZRX/zvkWx8TwHDWYnF+pPtyZ17lTXlZgSqGdYQH0Oi8QR363Uql2iJ OUNgdt2vvDHXjBwTwXVHxl0qGFY6XnhQd6D+aLg8UCOuph/VDm98R+csHhPsLJjH5uKb iO1w== X-Gm-Message-State: AOAM531MN0ijTwDB9GPERHTF1OlGmFsYcSUGlEWER0GQhF3rFiExSYub sKoAiVaMIdrfJ0lGUJ9Cr6lvJMlZoUU= X-Google-Smtp-Source: ABdhPJzK3MZxsfj2LwNQBmCmjs8cq0jsuIEdSzIJY78L0w80BqBTc1O48RZmkP/3WGHzCrK0EK0Law== X-Received: by 2002:a9d:714a:0:b0:5ad:f8f9:b50d with SMTP id y10-20020a9d714a000000b005adf8f9b50dmr9893011otj.47.1646070647456; Mon, 28 Feb 2022 09:50:47 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:bec1:d9bb:8ce0:5ce7:a377]) by smtp.gmail.com with ESMTPSA id a12-20020a9d5c8c000000b005ad51592bd8sm5368481oti.49.2022.02.28.09.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:50:47 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH 14/14] hw/ppc/spapr_vio.c: use g_autofree in spapr_dt_vdevice() Date: Mon, 28 Feb 2022 14:50:04 -0300 Message-Id: <20220228175004.8862-15-danielhb413@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228175004.8862-1-danielhb413@gmail.com> References: <20220228175004.8862-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::329 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::329; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x329.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Daniel Henrique Barboza , qemu-ppc@nongnu.org, clg@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" And return the result of g_strdup_printf() directly instead of using the 'path' var. Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr_vio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c index b975ed29ca..9d4fec2c04 100644 --- a/hw/ppc/spapr_vio.c +++ b/hw/ppc/spapr_vio.c @@ -726,7 +726,7 @@ void spapr_dt_vdevice(SpaprVioBus *bus, void *fdt) gchar *spapr_vio_stdout_path(SpaprVioBus *bus) { SpaprVioDevice *dev; - char *name, *path; + g_autofree char *name = NULL; dev = spapr_vty_get_default(bus); if (!dev) { @@ -734,8 +734,6 @@ gchar *spapr_vio_stdout_path(SpaprVioBus *bus) } name = spapr_vio_get_dev_name(DEVICE(dev)); - path = g_strdup_printf("/vdevice/%s", name); - g_free(name); - return path; + return g_strdup_printf("/vdevice/%s", name); }