From: Christophe JAILLET Date: Sat, 18 Apr 2020 07:07:51 +0000 (+0200) Subject: m68k/PCI: Fix a memory leak in an error handling path X-Git-Tag: v5.10.7~2349^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c3f4ec050f56eeab7c1f290321f9b762c95bd332;p=platform%2Fkernel%2Flinux-rpi.git m68k/PCI: Fix a memory leak in an error handling path If 'ioremap' fails, we must free 'bridge', as done in other error handling path bellow. Fixes: 19cc4c843f40 ("m68k/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks") Signed-off-by: Christophe JAILLET Reviewed-by: Geert Uytterhoeven Signed-off-by: Greg Ungerer --- diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c index 62b0eb6..84eab0f 100644 --- a/arch/m68k/coldfire/pci.c +++ b/arch/m68k/coldfire/pci.c @@ -216,8 +216,10 @@ static int __init mcf_pci_init(void) /* Keep a virtual mapping to IO/config space active */ iospace = (unsigned long) ioremap(PCI_IO_PA, PCI_IO_SIZE); - if (iospace == 0) + if (iospace == 0) { + pci_free_host_bridge(bridge); return -ENODEV; + } pr_info("Coldfire: PCI IO/config window mapped to 0x%x\n", (u32) iospace);