Re: [PATCH 1/1] hw/arm: do not free machine->fdt in arm_load_dtb()

2023-03-23 Thread Daniel Henrique Barboza
On 3/23/23 14:59, Peter Maydell wrote: On Thu, 23 Mar 2023 at 17:54, Daniel Henrique Barboza wrote: On 3/23/23 14:38, Peter Maydell wrote: On Thu, 23 Mar 2023 at 16:11, Daniel Henrique Barboza wrote: -g_free(fdt); +/* Set ms->fdt for 'dumpdtb' QMP/HMP command */ +ms->fdt =

Re: [PATCH 1/1] hw/arm: do not free machine->fdt in arm_load_dtb()

2023-03-23 Thread Peter Maydell
On Thu, 23 Mar 2023 at 17:54, Daniel Henrique Barboza wrote: > > > > On 3/23/23 14:38, Peter Maydell wrote: > > On Thu, 23 Mar 2023 at 16:11, Daniel Henrique Barboza > > wrote: > >> -g_free(fdt); > >> +/* Set ms->fdt for 'dumpdtb' QMP/HMP command */ > >> +ms->fdt = fdt; > > > > With

Re: [PATCH 1/1] hw/arm: do not free machine->fdt in arm_load_dtb()

2023-03-23 Thread Daniel Henrique Barboza
On 3/23/23 14:38, Peter Maydell wrote: On Thu, 23 Mar 2023 at 16:11, Daniel Henrique Barboza wrote: At this moment, arm_load_dtb() can free machine->fdt when binfo->dtb_filename is NULL. If there's no 'dtb_filename', 'fdt' will be retrieved by binfo->get_dtb(). If get_dtb() returns

Re: [PATCH 1/1] hw/arm: do not free machine->fdt in arm_load_dtb()

2023-03-23 Thread Peter Maydell
On Thu, 23 Mar 2023 at 16:11, Daniel Henrique Barboza wrote: > > At this moment, arm_load_dtb() can free machine->fdt when > binfo->dtb_filename is NULL. If there's no 'dtb_filename', 'fdt' will be > retrieved by binfo->get_dtb(). If get_dtb() returns machine->fdt, as is > the case of

[PATCH 1/1] hw/arm: do not free machine->fdt in arm_load_dtb()

2023-03-23 Thread Daniel Henrique Barboza
At this moment, arm_load_dtb() can free machine->fdt when binfo->dtb_filename is NULL. If there's no 'dtb_filename', 'fdt' will be retrieved by binfo->get_dtb(). If get_dtb() returns machine->fdt, as is the case of machvirt_dtb() from hw/arm/virt.c, fdt now has a pointer to machine->fdt. And, in