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

Next file: linux/drivers/net/appletalk/cops.c
Previous file: linux/drivers/net/acenic_firmware.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.2/linux/drivers/net/aironet4500_card.c linux/drivers/net/aironet4500_card.c
@@ -370,7 +370,15 @@
 		request_region(isa_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr");
 
 		if (!dev) {
-			dev = init_etherdev(dev, 0 );	
+			dev = init_etherdev(NULL, 0);	
+			if (!dev) {
+				release_region(isa_ioaddr, AIRONET4X00_IO_SIZE);
+				isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER,
+						 logdev->PNP_DEV_NUMBER);
+				isapnp_deactivate(logdev->PNP_DEV_NUMBER);
+				isapnp_cfg_end();
+				return -ENOMEM;
+			}
 		}
 		dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL );
 		memset(dev->priv,0,sizeof(struct awc_private));
@@ -524,7 +532,7 @@
 	printk(KERN_WARNING "     Use aironet4500_pnp if any problems(i.e. card malfunctioning). \n");
 	printk(KERN_WARNING "     Note that this isa probe is not friendly... must give exact parameters \n");
 
-	while (irq[card] !=0){
+	while (irq[card] != 0){
 	
 		isa_ioaddr = io[card];
 		isa_irq_line = irq[card];
@@ -532,7 +540,11 @@
 		request_region(isa_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr");
 
 		if (!dev) {
-			dev = init_etherdev(dev, 0 );	
+			dev = init_etherdev(NULL, 0);	
+			if (!dev) {
+				release_region(isa_ioaddr, AIRONET4X00_IO_SIZE);
+				return (card == 0) ? -ENOMEM : 0;
+			}
 		}
 		dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL );
 		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)