On Thu, 23 Oct 2025 at 13:22, Harsh Prateek Bora <[email protected]> wrote:
>
> From: BALATON Zoltan <[email protected]>
>
> We generate a flattened device tree programmatically for VOF. Change
> this to load the static parts from a device tree blob and only
> generate the parts that depend on run time conditions such as CPU
> type, memory size and PCI devices. Moving the static parts in a dts
> makes the board code simpler and more generic.
>
> Signed-off-by: BALATON Zoltan <[email protected]>
> Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
> Link:
> https://lore.kernel.org/qemu-devel/383891fc2696609b27d2de9773efe1b4f493e333.1761176219.git.bala...@eik.bme.hu
> Signed-off-by: Harsh Prateek Bora <[email protected]>
Hi; Coverity points out (CID 1642027) that this change
accidentally introduces a memory leak:
> @@ -780,7 +675,10 @@ static void add_pci_device(PCIBus *bus, PCIDevice *d,
> void *opaque)
> pci_get_word(&d->config[PCI_VENDOR_ID]),
>
> pci_get_word(&d->config[PCI_DEVICE_ID]));
>
> - if (pci_get_word(&d->config[PCI_CLASS_DEVICE]) ==
> + if (!strcmp(pn, "pci1106,8231")) {
> + return; /* ISA bridge and devices are included in dtb */
> + }
In this function we define at the top:
GString *node = g_string_new(NULL);
This change introduces an early-return which does not free
the GString.
The simplest fix is probably to declare node as
g_autoptr(GString) node = g_string_new(NULL);
and delete the now-superfluous g_string_free() from the
bottom of the function.
thanks
-- PMM