From d612405ed2a1163a142f94552a9874ad4b02de30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 17 Nov 2021 18:43:31 +0100 Subject: hw/i386/microvm: Reduce annoying debug message in dt_setup_microvm() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: f5918a99283 ("microvm: add device tree support.") Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Sergio Lopez Reviewed-by: Darren Kenny Message-Id: <20211117174331.1715144-1-philmd@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/i386/microvm-dt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c index 875ba91963..6ee6c42904 100644 --- a/hw/i386/microvm-dt.c +++ b/hw/i386/microvm-dt.c @@ -327,7 +327,9 @@ void dt_setup_microvm(MicrovmMachineState *mms) dt_setup_sys_bus(mms); /* add to fw_cfg */ - fprintf(stderr, "%s: add etc/fdt to fw_cfg\n", __func__); + if (debug) { + fprintf(stderr, "%s: add etc/fdt to fw_cfg\n", __func__); + } fw_cfg_add_file(x86ms->fw_cfg, "etc/fdt", mms->fdt, size); if (debug) { -- cgit v1.2.3 From 1b38ccc9a1fa865a8838c89216dc36df87e9c9d5 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 8 Nov 2021 14:07:17 +0100 Subject: microvm: add missing g_free() call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: CID 1465240 Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20211108130718.840216-2-kraxel@redhat.com> --- hw/i386/microvm-dt.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'hw') diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c index 6ee6c42904..a6a59a6e12 100644 --- a/hw/i386/microvm-dt.c +++ b/hw/i386/microvm-dt.c @@ -143,6 +143,8 @@ static void dt_add_pcie(MicrovmMachineState *mms) nr_pcie_buses = PCIE_ECAM_SIZE / PCIE_MMCFG_SIZE_MIN; qemu_fdt_setprop_cells(mms->fdt, nodename, "bus-range", 0, nr_pcie_buses - 1); + + g_free(nodename); } static void dt_add_ioapic(MicrovmMachineState *mms, SysBusDevice *dev) -- cgit v1.2.3 From b9e5628ca5d42994cc6f82752d9bf0bc98f51f64 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Mon, 8 Nov 2021 14:07:18 +0100 Subject: microvm: check g_file_set_contents() return value Fixes: CID 1465239 Signed-off-by: Gerd Hoffmann Message-Id: <20211108130718.840216-3-kraxel@redhat.com> --- hw/i386/microvm-dt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c index a6a59a6e12..9c3c4995b4 100644 --- a/hw/i386/microvm-dt.c +++ b/hw/i386/microvm-dt.c @@ -336,7 +336,10 @@ void dt_setup_microvm(MicrovmMachineState *mms) if (debug) { fprintf(stderr, "%s: writing microvm.fdt\n", __func__); - g_file_set_contents("microvm.fdt", mms->fdt, size, NULL); + if (!g_file_set_contents("microvm.fdt", mms->fdt, size, NULL)) { + fprintf(stderr, "%s: writing microvm.fdt failed\n", __func__); + return; + } int ret = system("dtc -I dtb -O dts microvm.fdt"); if (ret != 0) { fprintf(stderr, "%s: oops, dtc not installed?\n", __func__); -- cgit v1.2.3