Commit dedfe385 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] applicom: fix LEAK, unwind on errors

From: "Randy.Dunlap" <rddunlap@osdl.org>

Fix a permanent resource leak and also some resource leaks on error paths.
parent 87e628f7
......@@ -214,6 +214,7 @@ int __init applicom_init(void)
if (!RamIO) {
printk(KERN_INFO "ac.o: Failed to ioremap PCI memory space at 0x%lx\n", dev->resource[0].start);
pci_disable_device(dev);
return -EIO;
}
......@@ -225,12 +226,14 @@ int __init applicom_init(void)
(unsigned long)RamIO,0))) {
printk(KERN_INFO "ac.o: PCI Applicom device doesn't have correct signature.\n");
iounmap(RamIO);
pci_disable_device(dev);
continue;
}
if (request_irq(dev->irq, &ac_interrupt, SA_SHIRQ, "Applicom PCI", &dummy)) {
printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq);
iounmap(RamIO);
pci_disable_device(dev);
apbs[boardno - 1].RamIO = 0;
continue;
}
......@@ -257,12 +260,6 @@ int __init applicom_init(void)
/* Now try the specified ISA cards */
#warning "LEAK"
RamIO = ioremap(mem, LEN_RAM_IO * MAX_ISA_BOARD);
if (!RamIO)
printk(KERN_INFO "ac.o: Failed to ioremap ISA memory space at 0x%lx\n", mem);
for (i = 0; i < MAX_ISA_BOARD; i++) {
RamIO = ioremap(mem + (LEN_RAM_IO * i), LEN_RAM_IO);
......@@ -285,7 +282,8 @@ int __init applicom_init(void)
iounmap((void *) RamIO);
apbs[boardno - 1].RamIO = 0;
}
apbs[boardno - 1].irq = irq;
else
apbs[boardno - 1].irq = irq;
}
else
apbs[boardno - 1].irq = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment