patch-2.4.0-test7 linux/drivers/net/3c501.c

Next file: linux/drivers/net/3c59x.c
Previous file: linux/drivers/mtd/Config.in
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test6/linux/drivers/net/3c501.c linux/drivers/net/3c501.c
@@ -280,6 +280,13 @@
 	int i;
 
 	/*
+	 *	Reserve I/O resource for exclusive use by this driver
+	 */
+
+	if (!request_region(ioaddr, EL1_IO_EXTENT, dev->name))
+		return -ENODEV;
+
+	/*
 	 *	Read the station address PROM data from the special port.
 	 */
 
@@ -302,15 +309,10 @@
 	{
 		mname = "NP943";
     	}
-    	else
-		return -ENODEV;
-
-	/*
-	 *	Grab the region so we can find the another board if autoIRQ fails.
-	 */
-
-	if (!request_region(ioaddr, EL1_IO_EXTENT,"3c501"))
+    	else {
+		release_region(ioaddr, EL1_IO_EXTENT);
 		return -ENODEV;
+	}
 
 	/*
 	 *	We auto-IRQ by shutting off the interrupt line and letting it float
@@ -332,6 +334,7 @@
 		{
 			printk("%s probe at %#x failed to detect IRQ line.\n",
 				mname, ioaddr);
+			release_region(ioaddr, EL1_IO_EXTENT);
 			return -EAGAIN;
 		}
 	}
@@ -360,8 +363,10 @@
 	 */
 
 	dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL);
-	if (dev->priv == NULL)
+	if (dev->priv == NULL) {
+		release_region(ioaddr, EL1_IO_EXTENT);
 		return -ENOMEM;
+	}
 	memset(dev->priv, 0, sizeof(struct net_local));
 
 	lp=dev->priv;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)