[PATCH] powerpc/pasemi: Fix PCI device reference leak on error path
Markus Elfring
Markus.Elfring at web.de
Wed Sep 3 00:34:28 AEST 2025
> Fix iob_pdev reference leak in pasemi_dma_init() when dma_pdev
> allocation fails. Ensure pci_dev_put(iob_pdev) is called on
> both success and error paths.
How do you think about to increase the application of scope-based resource management?
…
> +++ b/arch/powerpc/platforms/pasemi/dma_lib.c
> @@ -530,7 +530,7 @@ int pasemi_dma_init(void)
> BUG();
> pr_warn("Can't find DMA controller\n");
> err = -ENODEV;
> - goto out;
Is it sufficient to add the function call “pci_dev_put(iob_pdev)”
in this if branch?
> + goto out_put_iob;
> }
> dma_regs = map_onedev(dma_pdev, 0);
…
Regards,
Markus
More information about the Linuxppc-dev
mailing list