patch-2.4.21 linux-2.4.21/drivers/net/tokenring/madgemc.c
Next file: linux-2.4.21/drivers/net/tokenring/olympic.c
Previous file: linux-2.4.21/drivers/net/tokenring/lanstreamer.c
Back to the patch index
Back to the overall index
- Lines: 126
- Date:
2003-06-13 07:51:35.000000000 -0700
- Orig file:
linux-2.4.20/drivers/net/tokenring/madgemc.c
- Orig date:
2001-09-13 16:04:43.000000000 -0700
diff -urN linux-2.4.20/drivers/net/tokenring/madgemc.c linux-2.4.21/drivers/net/tokenring/madgemc.c
@@ -164,7 +164,7 @@
if (!MCA_bus)
return -1;
-
+
while (slot != MCA_NOTFOUND) {
/*
* Currently we only support the MC16/32 (MCA ID 002d)
@@ -181,8 +181,11 @@
if ((dev = init_trdev(NULL, 0))==NULL) {
printk("madgemc: unable to allocate dev space\n");
+ if (madgemc_card_list)
+ return 0;
return -1;
}
+ SET_MODULE_OWNER(dev);
dev->dma = 0;
/*
@@ -194,6 +197,9 @@
card = kmalloc(sizeof(struct madgemc_card), GFP_KERNEL);
if (card==NULL) {
printk("madgemc: unable to allocate card struct\n");
+ kfree(dev); /* release_trdev? */
+ if (madgemc_card_list)
+ return 0;
return -1;
}
card->dev = dev;
@@ -224,19 +230,15 @@
if (dev->irq == 0) {
printk("%s: invalid IRQ\n", dev->name);
- goto getout;
+ goto getout1;
}
- request_region(dev->base_addr, MADGEMC_IO_EXTENT, "madgemc");
-#if 0
- /* why is this not working? */
- if (request_region(dev->base_addr, MADGEMC_IO_EXTENT,
+ if (!request_region(dev->base_addr, MADGEMC_IO_EXTENT,
"madgemc")) {
printk(KERN_INFO "madgemc: unable to setup Smart MC in slot %d because of I/O base conflict at 0x%04lx\n", slot, dev->base_addr);
dev->base_addr += MADGEMC_SIF_OFFSET;
- goto getout;
+ goto getout1;
}
-#endif
dev->base_addr += MADGEMC_SIF_OFFSET;
/*
@@ -353,6 +355,14 @@
if (tmsdev_init(dev, ISA_MAX_ADDRESS, NULL)) {
printk("%s: unable to get memory for dev->priv.\n",
dev->name);
+ release_region(dev->base_addr-MADGEMC_SIF_OFFSET,
+ MADGEMC_IO_EXTENT);
+
+ kfree(card);
+ tmsdev_term(dev);
+ kfree(dev);
+ if (madgemc_card_list)
+ return 0;
return -1;
}
tp = (struct net_local *)dev->priv;
@@ -381,10 +391,14 @@
madgemc_card_list = card;
} else {
printk("madgemc: register_trdev() returned non-zero.\n");
+ release_region(dev->base_addr-MADGEMC_SIF_OFFSET,
+ MADGEMC_IO_EXTENT);
kfree(card);
tmsdev_term(dev);
kfree(dev);
+ if (madgemc_card_list)
+ return 0;
return -1;
}
@@ -394,6 +408,7 @@
getout:
release_region(dev->base_addr-MADGEMC_SIF_OFFSET,
MADGEMC_IO_EXTENT);
+ getout1:
kfree(card);
kfree(dev); /* release_trdev? */
slot++;
@@ -519,7 +534,7 @@
*
* Register selection is normally done via three contiguous
* bits. However, some boards (such as the MC16/32) use only
- * two bits, plus a seperate bit in the glue chip. This
+ * two bits, plus a separate bit in the glue chip. This
* sets the SRSX bit (the top bit). See page 4-17 in the
* Yellow Book for which registers are affected.
*
@@ -634,7 +649,7 @@
/*
* Read the card type (MC16 or MC32) from the card.
*
- * The configuration registers are stored in two seperate
+ * The configuration registers are stored in two separate
* pages. Pages are flipped by clearing bit 3 of CONTROL_REG0 (PAGE)
* for page zero, or setting bit 3 for page one.
*
@@ -701,7 +716,6 @@
*/
madgemc_chipset_init(dev);
tms380tr_open(dev);
- MOD_INC_USE_COUNT;
return 0;
}
@@ -709,7 +723,6 @@
{
tms380tr_close(dev);
madgemc_chipset_close(dev);
- MOD_DEC_USE_COUNT;
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)