hw/ppc/spapr_numa.c: simplify spapr_numa_write_assoc_lookup_arrays()
commit1628293727f1872d1add9dc53897b2b262ed5fe9
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 2 Mar 2022 05:51:40 +0000 (2 06:51 +0100)
committerCédric Le Goater <clg@kaod.org>
Wed, 2 Mar 2022 05:51:40 +0000 (2 06:51 +0100)
treec99e22c02e145064cd6f259ab81c18c470649a39
parent5436eee1aceff14e301fce6d2385cc253a3b6473
hw/ppc/spapr_numa.c: simplify spapr_numa_write_assoc_lookup_arrays()

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 <danielhb413@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220228175004.8862-12-danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
hw/ppc/spapr_numa.c