Commit d53e22b2 authored by Alexander Viro's avatar Alexander Viro Committed by Stephen Hemminger

[netdrvr depca] fix leaks on error

parent f5d1862d
...@@ -681,8 +681,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device) ...@@ -681,8 +681,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
lp->sh_mem = ioremap(mem_start, mem_len); lp->sh_mem = ioremap(mem_start, mem_len);
if (lp->sh_mem == NULL) { if (lp->sh_mem == NULL) {
printk(KERN_ERR "depca: cannot remap ISA memory, aborting\n"); printk(KERN_ERR "depca: cannot remap ISA memory, aborting\n");
release_mem_region (mem_start, mem_len); goto out1;
goto out_priv;
} }
lp->mem_start = mem_start; lp->mem_start = mem_start;
...@@ -771,7 +770,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device) ...@@ -771,7 +770,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
status = -ENXIO; status = -ENXIO;
if (!irqnum) { if (!irqnum) {
printk(" and failed to detect IRQ line.\n"); printk(" and failed to detect IRQ line.\n");
goto out_priv; goto out2;
} else { } else {
for (dev->irq = 0, i = 0; (depca_irq[i]) && (!dev->irq); i++) for (dev->irq = 0, i = 0; (depca_irq[i]) && (!dev->irq); i++)
if (irqnum == depca_irq[i]) { if (irqnum == depca_irq[i]) {
...@@ -781,7 +780,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device) ...@@ -781,7 +780,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
if (!dev->irq) { if (!dev->irq) {
printk(" but incorrect IRQ line detected.\n"); printk(" but incorrect IRQ line detected.\n");
return -ENXIO; goto out2;
} }
} }
} else { } else {
...@@ -807,11 +806,14 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device) ...@@ -807,11 +806,14 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
device->driver_data = dev; device->driver_data = dev;
SET_NETDEV_DEV (dev, device); SET_NETDEV_DEV (dev, device);
register_netdev (dev); status = register_netdev(dev);
return 0; if (status == 0)
return 0;
out_priv: out2:
iounmap(lp->sh_mem);
out1:
release_mem_region (mem_start, mem_len);
out_priv:
return status; return status;
} }
......
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