patch-2.1.105 linux/drivers/net/smc-ultra32.c

Next file: linux/drivers/net/wd.c
Previous file: linux/drivers/net/smc-ultra.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.104/linux/drivers/net/smc-ultra32.c linux/drivers/net/smc-ultra32.c
@@ -148,6 +148,9 @@
 	if ((checksum & 0xff) != 0xff)
 		return ENODEV;
 
+	if (load_8390_module("smc-ultra32.c"))
+		return -ENOSYS;
+
 	/* We should have a "dev" from Space.c or the static module table. */
 	if (dev == NULL) {
 		printk("smc-ultra32.c: Passed a NULL device.\n");
@@ -386,13 +389,16 @@
 		dev->name = namelist+(NAMELEN*this_dev);
 		dev->init = ultra32_probe;
 		if (register_netdev(dev) != 0) {
-			if (found > 0) return 0; /* Got at least one. */
+			if (found > 0) { /* Got at least one. */
+				lock_8390_module();
+				return 0;
+			}
 			printk(KERN_WARNING "smc-ultra32.c: No SMC Ultra32 found.\n");
 			return -ENXIO;
 		}
 		found++;
 	}
-
+	lock_8390_module();
 	return 0;
 }
 
@@ -403,13 +409,15 @@
 	for (this_dev = 0; this_dev < MAX_ULTRA32_CARDS; this_dev++) {
 		struct device *dev = &dev_ultra[this_dev];
 		if (dev->priv != NULL) {
-			/* NB: ultra32_close_card() does free_irq + irq2dev */
 			int ioaddr = dev->base_addr - ULTRA32_NIC_OFFSET;
-			kfree(dev->priv);
-			dev->priv = NULL;
+			void *priv = dev->priv;
+			/* NB: ultra32_close_card() does free_irq */
 			release_region(ioaddr, ULTRA32_IO_EXTENT);
+			dev->priv = NULL;
 			unregister_netdev(dev);
+			kfree(priv);
 		}
 	}
+	unlock_8390_module();
 }
 #endif /* MODULE */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov