patch-2.4.3 linux/drivers/net/pcmcia/aironet4500_cs.c

Next file: linux/drivers/net/pcmcia/fmvj18x_cs.c
Previous file: linux/drivers/net/pcmcia/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.2/linux/drivers/net/pcmcia/aironet4500_cs.c linux/drivers/net/pcmcia/aironet4500_cs.c
@@ -177,8 +177,14 @@
 
 	/* Create the PC card device object. */
 	link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
-	memset(link, 0, sizeof(struct dev_link_t));
+	if (!link)
+		return NULL;
 	link->dev = kmalloc(sizeof(struct dev_node_t), GFP_KERNEL);
+	if (!link->dev) {
+		kfree(link);
+		return NULL;
+	}
+	memset(link, 0, sizeof(struct dev_link_t));
 	memset(link->dev, 0, sizeof(struct dev_node_t));
 
 	link->release.function = &awc_release;
@@ -199,7 +205,6 @@
 	/* Create the network device object. */
 
 	dev = kmalloc(sizeof(struct net_device ), GFP_KERNEL);
-	memset(dev,0,sizeof(struct net_device));
 //	dev =  init_etherdev(0, sizeof(struct awc_private) );
 	if (!dev ) {
 		printk(KERN_CRIT "out of mem on dev alloc \n");
@@ -207,6 +212,7 @@
 		kfree(link);
 		return NULL;
 	};
+	memset(dev,0,sizeof(struct net_device));
 	dev->priv = kmalloc(sizeof(struct awc_private), GFP_KERNEL);
 	if (!dev->priv ) {printk(KERN_CRIT "out of mem on dev priv alloc \n"); return NULL;};
 	memset(dev->priv,0,sizeof(struct awc_private));

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