Commit aa8c20c2 authored by Herbert Xu's avatar Herbert Xu Committed by Linus Torvalds

[PATCH] Fixed MCA resource bugs in at1700

This patch fixes an incorrect MCA check as well as a leak on probe
failure in at1700.
parent a7ec2bbb
...@@ -242,7 +242,7 @@ static void cleanup_card(struct net_device *dev) ...@@ -242,7 +242,7 @@ static void cleanup_card(struct net_device *dev)
{ {
#ifdef CONFIG_MCA #ifdef CONFIG_MCA
struct net_local *lp = netdev_priv(dev); struct net_local *lp = netdev_priv(dev);
if (lp->mca_slot) if (lp->mca_slot >= 0)
mca_mark_as_unused(lp->mca_slot); mca_mark_as_unused(lp->mca_slot);
#endif #endif
free_irq(dev->irq, NULL); free_irq(dev->irq, NULL);
...@@ -444,11 +444,11 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr) ...@@ -444,11 +444,11 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr)
break; break;
} }
if (i == 8) { if (i == 8) {
goto err_out; goto err_mca;
} }
} else { } else {
if (fmv18x_probe_list[inb(ioaddr + IOCONFIG) & 0x07] != ioaddr) if (fmv18x_probe_list[inb(ioaddr + IOCONFIG) & 0x07] != ioaddr)
goto err_out; goto err_mca;
irq = fmv_irqmap[(inb(ioaddr + IOCONFIG)>>6) & 0x03]; irq = fmv_irqmap[(inb(ioaddr + IOCONFIG)>>6) & 0x03];
} }
} }
...@@ -546,11 +546,16 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr) ...@@ -546,11 +546,16 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr)
if (ret) { if (ret) {
printk (" AT1700 at %#3x is unusable due to a conflict on" printk (" AT1700 at %#3x is unusable due to a conflict on"
"IRQ %d.\n", ioaddr, irq); "IRQ %d.\n", ioaddr, irq);
goto err_out; goto err_mca;
} }
return 0; return 0;
err_mca:
#ifdef CONFIG_MCA
if (slot >= 0)
mca_mark_as_unused(slot);
#endif
err_out: err_out:
#ifndef CONFIG_X86_PC9800 #ifndef CONFIG_X86_PC9800
release_region(ioaddr, AT1700_IO_EXTENT); release_region(ioaddr, AT1700_IO_EXTENT);
......
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