Commit 0af1d03e authored by Karol Kasprzak's avatar Karol Kasprzak Committed by Linus Torvalds

dgrs net driver janitor fixes:

	o check return code of request_region function
	o let free irq, if something was wrong during driver 
	  initialization.
	o litle printk cleanup
parent bd4370a0
...@@ -1153,9 +1153,7 @@ dgrs_probe1(struct net_device *dev) ...@@ -1153,9 +1153,7 @@ dgrs_probe1(struct net_device *dev)
*/ */
rc = dgrs_download(dev); rc = dgrs_download(dev);
if (rc) if (rc)
{ goto err_out;
return rc;
}
/* /*
* Get ether address of board * Get ether address of board
...@@ -1169,7 +1167,8 @@ dgrs_probe1(struct net_device *dev) ...@@ -1169,7 +1167,8 @@ dgrs_probe1(struct net_device *dev)
if (dev->dev_addr[0] & 1) if (dev->dev_addr[0] & 1)
{ {
printk("%s: Illegal Ethernet Address\n", dev->name); printk("%s: Illegal Ethernet Address\n", dev->name);
return (-ENXIO); rc = -ENXIO;
goto err_out;
} }
/* /*
...@@ -1178,9 +1177,10 @@ dgrs_probe1(struct net_device *dev) ...@@ -1178,9 +1177,10 @@ dgrs_probe1(struct net_device *dev)
*/ */
if (priv->plxreg) if (priv->plxreg)
OUTL(dev->base_addr + PLX_LCL2PCI_DOORBELL, 1); OUTL(dev->base_addr + PLX_LCL2PCI_DOORBELL, 1);
rc = request_irq(dev->irq, &dgrs_intr, SA_SHIRQ, "RightSwitch", dev); rc = request_irq(dev->irq, &dgrs_intr, SA_SHIRQ, "RightSwitch", dev);
if (rc) if (rc)
return (rc); goto err_out;
priv->intrcnt = 0; priv->intrcnt = 0;
for (i = jiffies + 2*HZ + HZ/2; time_after(i, jiffies); ) for (i = jiffies + 2*HZ + HZ/2; time_after(i, jiffies); )
...@@ -1191,16 +1191,22 @@ dgrs_probe1(struct net_device *dev) ...@@ -1191,16 +1191,22 @@ dgrs_probe1(struct net_device *dev)
} }
if (priv->intrcnt < 2) if (priv->intrcnt < 2)
{ {
printk("%s: Not interrupting on IRQ %d (%d)\n", printk(KERN_ERR "%s: Not interrupting on IRQ %d (%d)\n",
dev->name, dev->irq, priv->intrcnt); dev->name, dev->irq, priv->intrcnt);
return (-ENXIO); rc = -ENXIO;
goto err_free_irq;
} }
/* /*
* Register the /proc/ioports information... * Register the /proc/ioports information...
*/ */
request_region(dev->base_addr, 256, "RightSwitch"); if (!request_region(dev->base_addr, 256, "RightSwitch")) {
printk(KERN_ERR "%s: io 0x%3lX, which is busy.\n", dev->name,
dev->base_addr);
rc = -EBUSY;
goto err_free_irq;
}
/* /*
* Entry points... * Entry points...
*/ */
...@@ -1211,7 +1217,12 @@ dgrs_probe1(struct net_device *dev) ...@@ -1211,7 +1217,12 @@ dgrs_probe1(struct net_device *dev)
dev->set_multicast_list = &dgrs_set_multicast_list; dev->set_multicast_list = &dgrs_set_multicast_list;
dev->do_ioctl = &dgrs_ioctl; dev->do_ioctl = &dgrs_ioctl;
return (0); return rc;
err_free_irq:
free_irq(dev->irq, dev);
err_out:
return rc;
} }
int __init int __init
......
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