patch-1.3.25 linux/drivers/net/at1700.c

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

diff -u --recursive --new-file v1.3.24/linux/drivers/net/at1700.c linux/drivers/net/at1700.c
@@ -263,8 +263,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		= net_open;
@@ -660,6 +661,8 @@
 	else
 	{
 		unregister_netdev(&dev_at1700);
+		kfree(dev_at1700.priv);
+		dev_at1700.priv = NULL;
 
 		/* If we don't do this, we can't re-insmod it later. */
 		free_irq(dev_at1700.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