Skip to content

Commit

Permalink
m68k/PCI: Fix a memory leak in an error handling path
Browse files Browse the repository at this point in the history
If 'ioremap' fails, we must free 'bridge', as done in other error handling
path bellow.

Fixes: 19cc4c8 ("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>
  • Loading branch information
Christophe JAILLET authored and Greg Ungerer committed May 25, 2020
1 parent 9cb1fd0 commit c3f4ec0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/m68k/coldfire/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c3f4ec0

Please sign in to comment.