patch-1.3.25 linux/drivers/net/3c507.c

Next file: linux/drivers/net/3c509.c
Previous file: linux/drivers/net/3c505.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.24/linux/drivers/net/3c507.c linux/drivers/net/3c507.c
@@ -416,8 +416,9 @@
 		printk(version);
 
 	/* Initialize the device structure. */
+	dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL);
 	if (dev->priv == NULL)
-		dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL);
+		return -ENOMEM;
 	memset(dev->priv, 0, sizeof(struct net_local));
 
 	dev->open		= el16_open;
@@ -914,6 +915,8 @@
 	else
 	{
 		unregister_netdev(&dev_3c507);
+		kfree(dev_3c507.priv);
+		dev_3c507.priv = NULL;
 
 		/* If we don't do this, we can't re-insmod it later. */
 		free_irq(dev_3c507.irq);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this