patch-2.4.3 linux/drivers/net/macsonic.c

Next file: linux/drivers/net/natsemi.c
Previous file: linux/drivers/net/macmace.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.2/linux/drivers/net/macsonic.c linux/drivers/net/macsonic.c
@@ -59,8 +59,8 @@
 
 #include "sonic.h"
 
-static int sonic_debug = 0;
-static int sonic_version_printed = 0;
+static int sonic_debug;
+static int sonic_version_printed;
 
 extern int macsonic_probe(struct net_device* dev);
 extern int mac_onboard_sonic_probe(struct net_device* dev);
@@ -272,7 +272,7 @@
 int __init mac_onboard_sonic_probe(struct net_device* dev)
 {
 	/* Bwahahaha */
-	static int once_is_more_than_enough = 0;
+	static int once_is_more_than_enough;
 	struct sonic_local* lp;
 	int i;
 	
@@ -316,9 +316,14 @@
 
 	if (dev) {
 		dev = init_etherdev(dev, sizeof(struct sonic_local));
+		if (!dev)
+			return -ENOMEM;
 		/* methinks this will always be true but better safe than sorry */
-		if (dev->priv == NULL)
+		if (dev->priv == NULL) {
 			dev->priv = kmalloc(sizeof(struct sonic_local), GFP_KERNEL);
+			if (!dev->priv) /* FIXME: kfree dev if necessary */
+				return -ENOMEM;
+		}
 	} else {
 		dev = init_etherdev(NULL, sizeof(struct sonic_local));
 	}
@@ -438,7 +443,7 @@
 
 int __init mac_nubus_sonic_probe(struct net_device* dev)
 {
-	static int slots = 0;
+	static int slots;
 	struct nubus_dev* ndev = NULL;
 	struct sonic_local* lp;
 	unsigned long base_addr, prom_addr;
@@ -567,11 +572,7 @@
 
 #ifdef MODULE
 static char namespace[16] = "";
-static struct net_device dev_macsonic = {
-        NULL,
-        0, 0, 0, 0,
-        0, 0,
-        0, 0, 0, NULL, NULL };
+static struct net_device dev_macsonic;
 
 MODULE_PARM(sonic_debug, "i");
 

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