patch-2.4.1 linux/drivers/net/myri_sbus.c

Next file: linux/drivers/net/pcnet32.c
Previous file: linux/drivers/net/hamradio/scc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0/linux/drivers/net/myri_sbus.c linux/drivers/net/myri_sbus.c
@@ -892,6 +892,9 @@
 	DET(("myri_ether_init(%p,%p,%d):\n", dev, sdev, num));
 	dev = init_etherdev(0, sizeof(struct myri_eth));
 
+	if (!dev)
+		return -ENOMEM;
+
 	if (version_printed++ == 0)
 		printk(version);
 
@@ -982,7 +985,7 @@
 					mp->reg_size, "MyriCOM Regs");
 		if (!mp->regs) {
 			printk("MyriCOM: Cannot map MyriCOM registers.\n");
-			return -ENODEV;
+			goto err;
 		}
 		mp->lanai = (unsigned short *) (mp->regs + (256 * 1024));
 		mp->lanai3 = (unsigned int *) mp->lanai;
@@ -1059,7 +1062,7 @@
 	if (request_irq(dev->irq, &myri_interrupt,
 			SA_SHIRQ, "MyriCOM Ethernet", (void *) dev)) {
 		printk("MyriCOM: Cannot register interrupt handler.\n");
-		return -ENODEV;
+		goto err;
 	}
 
 	DET(("ether_setup()\n"));
@@ -1083,6 +1086,9 @@
 	root_myri_dev = mp;
 #endif
 	return 0;
+err:	unregister_netdev(dev);
+	kfree(dev);
+	return -ENODEV;
 }
 
 static int __init myri_sbus_match(struct sbus_dev *sdev)

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