From patchwork Sun Jun 5 13:21:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 9155577 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6643560573 for ; Sun, 5 Jun 2016 13:39:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A4C3268AE for ; Sun, 5 Jun 2016 13:39:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D1C627D45; Sun, 5 Jun 2016 13:39:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D1C7D268AE for ; Sun, 5 Jun 2016 13:39:34 +0000 (UTC) Received: from localhost ([::1]:37193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9YH6-0003Oq-KQ for patchwork-qemu-devel@patchwork.kernel.org; Sun, 05 Jun 2016 09:39:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9Y0B-0003Ft-2X for qemu-devel@nongnu.org; Sun, 05 Jun 2016 09:22:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9Y03-00050T-SZ for qemu-devel@nongnu.org; Sun, 05 Jun 2016 09:22:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9Y03-00050M-Mq for qemu-devel@nongnu.org; Sun, 05 Jun 2016 09:21:55 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 59F458E39A; Sun, 5 Jun 2016 13:21:55 +0000 (UTC) Received: from redhat.com (vpn1-7-180.ams2.redhat.com [10.36.7.180]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u55DLrjj017254; Sun, 5 Jun 2016 09:21:54 -0400 Date: Sun, 5 Jun 2016 16:21:53 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1465132825-14242-20-git-send-email-mst@redhat.com> References: <1465132825-14242-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1465132825-14242-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sun, 05 Jun 2016 13:21:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 19/25] acpi: cleanup bios_linker_loader_cleanup() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Igor Mammedov bios_linker_loader_cleanup() is called only from one place and returned value is immediately freed wich makes returning pointer from bios_linker_loader_cleanup() useless. Cleanup bios_linker_loader_cleanup() by freeing data there so that caller won't have to free it. Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/bios-linker-loader.h | 2 +- hw/acpi/aml-build.c | 3 +-- hw/acpi/bios-linker-loader.c | 8 +++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/include/hw/acpi/bios-linker-loader.h b/include/hw/acpi/bios-linker-loader.h index bee6dee..564e192 100644 --- a/include/hw/acpi/bios-linker-loader.h +++ b/include/hw/acpi/bios-linker-loader.h @@ -26,5 +26,5 @@ void bios_linker_loader_add_pointer(BIOSLinker *linker, void *pointer, uint8_t pointer_size); -void *bios_linker_loader_cleanup(BIOSLinker *linker); +void bios_linker_loader_cleanup(BIOSLinker *linker); #endif diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index bff2599..66e9bf8 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1548,8 +1548,7 @@ void acpi_build_tables_init(AcpiBuildTables *tables) void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre) { - void *linker_data = bios_linker_loader_cleanup(tables->linker); - g_free(linker_data); + bios_linker_loader_cleanup(tables->linker); g_array_free(tables->rsdp, true); g_array_free(tables->table_data, true); g_array_free(tables->tcpalog, mfre); diff --git a/hw/acpi/bios-linker-loader.c b/hw/acpi/bios-linker-loader.c index a2f20ec..7a2e4d2 100644 --- a/hw/acpi/bios-linker-loader.c +++ b/hw/acpi/bios-linker-loader.c @@ -128,14 +128,12 @@ BIOSLinker *bios_linker_loader_init(void) return linker; } -/* Free linker wrapper and return the linker commands array. */ -void *bios_linker_loader_cleanup(BIOSLinker *linker) +/* Free linker wrapper */ +void bios_linker_loader_cleanup(BIOSLinker *linker) { - void *cmd_blob = g_array_free(linker->cmd_blob, false); - + g_array_free(linker->cmd_blob, true); g_array_free(linker->file_list, true); g_free(linker); - return cmd_blob; } static const BiosLinkerFileEntry *