From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: guangrong.xiao@linux.intel.com, ehabkost@redhat.com,
mst@redhat.com, qemu-arm@nongnu.org, zhaoshenglong@huawei.com
Subject: [Qemu-devel] [PATCH v2 3/6] acpi: cleanup bios_linker_loader_cleanup()
Date: Thu, 19 May 2016 15:19:27 +0200 [thread overview]
Message-ID: <1463663970-23661-4-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1463663970-23661-1-git-send-email-imammedo@redhat.com>
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 <imammedo@redhat.com>
---
hw/acpi/aml-build.c | 3 +--
hw/acpi/bios-linker-loader.c | 8 +++-----
include/hw/acpi/bios-linker-loader.h | 2 +-
3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 8104d06..42955d6 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1531,8 +1531,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 *
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
--
1.8.3.1
next prev parent reply other threads:[~2016-05-19 13:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-19 13:19 [Qemu-devel] [PATCH v2 0/6] acpi: simplify bios_linker API Igor Mammedov
2016-05-19 13:19 ` [Qemu-devel] [PATCH v2 1/6] acpi: convert linker from GArray to BIOSLinker structure Igor Mammedov
2016-05-19 13:19 ` [Qemu-devel] [PATCH v2 2/6] acpi: simplify bios_linker API by removing redundant 'table' argument Igor Mammedov
2016-05-19 13:19 ` Igor Mammedov [this message]
2016-05-19 13:19 ` [Qemu-devel] [PATCH v2 4/6] tpm: apci: cleanup TCPA table initialization Igor Mammedov
2016-05-19 13:19 ` [Qemu-devel] [PATCH v2 5/6] acpi: make bios_linker_loader_add_pointer() API offset based Igor Mammedov
2016-05-19 13:19 ` [Qemu-devel] [PATCH v2 6/6] acpi: make bios_linker_loader_add_checksum() " Igor Mammedov
2016-05-31 15:09 ` [Qemu-devel] [PATCH v2 0/6] acpi: simplify bios_linker API Igor Mammedov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1463663970-23661-4-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=ehabkost@redhat.com \
--cc=guangrong.xiao@linux.intel.com \
--cc=mst@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=zhaoshenglong@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).