]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
m68k/PCI: Fix a memory leak in an error handling path
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 18 Apr 2020 07:07:51 +0000 (09:07 +0200)
committerGreg Ungerer <gerg@kernel.org>
Mon, 25 May 2020 00:32:20 +0000 (10:32 +1000)
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 <christophe.jaillet@wanadoo.fr>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
arch/m68k/coldfire/pci.c

index 62b0eb6cf69a357bc3f921a22f20a638d5eb55e3..84eab0f5e00afcca64b2df762c9ffac5e7c72590 100644 (file)
@@ -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);