patch-2.4.3 linux/drivers/net/arcnet/com20020-pci.c
Next file: linux/drivers/net/arlan-proc.c
Previous file: linux/drivers/net/arcnet/arcnet.c
Back to the patch index
Back to the overall index
- Lines: 49
- Date:
Tue Mar 6 19:28:35 2001
- Orig file:
v2.4.2/linux/drivers/net/arcnet/com20020-pci.c
- Orig date:
Wed Feb 21 18:20:25 2001
diff -u --recursive --new-file v2.4.2/linux/drivers/net/arcnet/com20020-pci.c linux/drivers/net/arcnet/com20020-pci.c
@@ -78,8 +78,10 @@
if (!dev)
return err;
lp = dev->priv = kmalloc(sizeof(struct arcnet_local), GFP_KERNEL);
- if (!lp)
- return -ENOMEM;
+ if (!lp) {
+ err = -ENOMEM;
+ goto out_dev;
+ }
memset(lp, 0, sizeof(struct arcnet_local));
pdev->driver_data = dev;
@@ -98,17 +100,30 @@
if (check_region(ioaddr, ARCNET_TOTAL_SIZE)) {
BUGMSG(D_INIT, "IO region %xh-%xh already allocated.\n",
ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1);
- return -EBUSY;
+ err = -EBUSY;
+ goto out_priv;
}
if (ASTATUS() == 0xFF) {
BUGMSG(D_NORMAL, "IO address %Xh was reported by PCI BIOS, "
"but seems empty!\n", ioaddr);
- return -EIO;
+ err = -EIO;
+ goto out_priv;
+ }
+ if (com20020_check(dev)) {
+ err = -EIO;
+ goto out_priv;
}
- if (com20020_check(dev))
- return -EIO;
- return com20020_found(dev, SA_SHIRQ);
+ if ((err = com20020_found(dev, SA_SHIRQ)) != 0)
+ goto out_priv;
+
+ return 0;
+
+out_priv:
+ kfree(dev->priv);
+out_dev:
+ kfree(dev);
+ return err;
}
static void __devexit com20020pci_remove(struct pci_dev *pdev)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)