Hi,
Please take a look and consider applying.
Question: do we need to really use this:
static inline void dev_init_buffers(struct net_device *dev)
{
/* DO NOTHING */
}
its in include/linux/netdevice.h, is this for future features to
be implemented?
- Arnaldo
--- linux-2.4.0-test6-pre9/drivers/net/tokenring/abyss.c Sat Apr 29 03:00:05 2000
+++ linux-2.4.0-test6-pre9.acme/drivers/net/tokenring/abyss.c Wed Aug 9 13:06:16 2000
@@ -12,9 +12,16 @@
* Maintainer(s):
* AF Adam Fritzler mid@auk.cx
*
+ * Contributors:
+ * acme Arnaldo Carvalho de Melo acme@conectiva.com.br
+ *
* Modification History:
* 30-Dec-99 AF Split off from the tms380tr driver.
* 22-Jan-00 AF Updated to use indirect read/writes
+ * 09-Aug-00 acme check kmalloc return in abyss_probe,
+ * no need for register_trdev, init_trdev
+ * already does the register_netdevice,
+ * release resources on failure
*
*
* TODO:
@@ -23,7 +30,7 @@
* config registers)
*
*/
-static const char *version = "abyss.c: v1.01 22/01/2000 by Adam Fritzler\n";
+static const char *version = "abyss.c: v1.02 09/08/2000 by Adam Fritzler\n";
#include <linux/module.h>
#include <linux/kernel.h>
@@ -96,14 +103,14 @@
struct pci_dev *pdev = NULL ;
struct net_device *dev;
struct net_local *tp;
- int i;
+ int i, ret;
+ unsigned long pci_ioaddr;
if (!pci_present())
return (-1); /* No PCI present. */
while ( (pdev=pci_find_class(PCI_CLASS_NETWORK_TOKEN_RING<<8, pdev))) {
unsigned int pci_irq_line;
- unsigned long pci_ioaddr;
struct tms_abyss_card *card;
/* We only support Madge Smart 16/4 PCI Mk2 (Abyss) cards */
@@ -134,8 +141,9 @@
if(request_irq(pdev->irq, tms380tr_interrupt, SA_SHIRQ,
"abyss", dev)) {
- release_region(pci_ioaddr, ABYSS_IO_EXTENT) ;
- /* XXX free trdev */
+ release_region(pci_ioaddr, ABYSS_IO_EXTENT);
+ unregister_netdev(dev);
+ kfree(dev);
continue; /*return (-ENODEV);*/ /* continue; ?? */
}
@@ -158,9 +166,10 @@
dev->base_addr += 0x10;
if (tmsdev_init(dev)) {
- printk("%s: unable to get memory for dev->priv.\n",
+ printk(KERN_ERR "%s: unable to get memory for dev->priv.\n",
dev->name);
- return 0;
+ ret = 0;
+ goto fail_alloc_dev_priv;
}
abyss_read_eeprom(dev);
@@ -184,25 +193,34 @@
dev->open = abyss_open;
dev->stop = abyss_close;
- if (register_trdev(dev) == 0) {
- /* Enlist in the card list */
- card = kmalloc(sizeof(struct tms_abyss_card),
- GFP_KERNEL);
- card->next = abyss_card_list;
- abyss_card_list = card;
- card->dev = dev;
- card->pci_dev = pdev;
- } else {
- printk("abyss: register_trdev() returned non-zero.\n");
- kfree(dev->priv);
- kfree(dev);
- return -1;
+ /* Enlist in the card list */
+ card = kmalloc(sizeof(struct tms_abyss_card), GFP_KERNEL);
+
+ if (!card) {
+ printk(KERN_ERR "abyss: out of memory.\n");
+ ret = -1;
+ goto fail_alloc;
}
+
+ card->next = abyss_card_list;
+ abyss_card_list = card;
+ card->dev = dev;
+ card->pci_dev = pdev;
}
if (abyss_card_list)
return 0;
return (-1);
+
+fail_alloc:
+ kfree(dev->priv);
+ dev->priv = NULL;
+fail_alloc_dev_priv:
+ release_region(pci_ioaddr, ABYSS_IO_EXTENT) ;
+ free_irq(pdev->irq, dev);
+ unregister_netdev(dev);
+ kfree(dev);
+ return ret;
}
unsigned short abyss_setnselout_pins(struct net_device *dev)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:18 EST