[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/14] hw/ppc/spapr_vio.c: use g_autofree in spapr_dt_vdevice()
From: |
Daniel Henrique Barboza |
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 |
And return the result of g_strdup_printf() directly instead of using the
'path' var.
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
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);
}
--
2.35.1
- [PATCH 01/14] hw/ppc/spapr.c: use g_autofree in spapr_dt_chosen(), (continued)
- [PATCH 01/14] hw/ppc/spapr.c: use g_autofree in spapr_dt_chosen(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 03/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_set_string(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 02/14] hw/ppc/spapr.c: fail early if no firmware found in machine_init(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 04/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_get_string(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 05/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_caps_add_properties(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 06/14] hw/ppc/spapr_drc.c: use g_auto in spapr_dt_drc(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 07/14] hw/ppc/spapr_drc.c: use g_autofree in drc_realize(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 08/14] hw/ppc/spapr_drc.c: use g_autofree in drc_unrealize(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 09/14] hw/ppc/spapr_drc.c: use g_autofree in spapr_dr_connector_new(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 10/14] hw/ppc/spapr_drc.c: use g_autofree in spapr_drc_by_index(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 14/14] hw/ppc/spapr_vio.c: use g_autofree in spapr_dt_vdevice(),
Daniel Henrique Barboza <=
- [PATCH 13/14] hw/ppc/spapr_rtas.c: use g_autofree in rtas_ibm_get_system_parameter(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 12/14] spapr_pci_nvlink2.c: use g_autofree in spapr_phb_nvgpu_ram_populate_dt(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 11/14] hw/ppc/spapr_numa.c: simplify spapr_numa_write_assoc_lookup_arrays(), Daniel Henrique Barboza, 2022/02/28
- Re: [PATCH 00/14] simple cleanups in spapr files, Philippe Mathieu-Daudé, 2022/02/28