[PATCH 2.5 15/25] 8390-cleanup ffor ne2k-pci

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



make ne2.c allocating the net_device's using the new ei_alloc_dev() function,
ethdev_init() is killed. also fix a mem-leak this way (dev->priv was not freed
on exit). compile tested.


--- 1.11/drivers/net/ne2k-pci.c	Wed May 21 05:02:19 2003
+++ edited/ne2k-pci.c	Sun Jun 29 18:55:00 2003
@@ -259,7 +259,7 @@
 		}
 	}
 
-	dev = alloc_etherdev(0);
+	dev = ei_alloc_dev();
 	if (!dev) {
 		printk (KERN_ERR PFX "cannot allocate ethernet device\n");
 		goto err_out_free_res;
@@ -331,13 +331,6 @@
 	dev->base_addr = ioaddr;
 	pci_set_drvdata(pdev, dev);
 
-	/* Allocate dev->priv and fill in 8390 specific dev fields. */
-	if (ethdev_init(dev)) {
-		printk (KERN_ERR "ne2kpci(%s): unable to get memory for dev->priv.\n",
-			pdev->slot_name);
-		goto err_out_free_netdev;
-	}
-
 	ei_status.name = pci_clone_list[chip_idx].name;
 	ei_status.tx_start_page = start_page;
 	ei_status.stop_page = stop_page;
@@ -366,7 +359,7 @@
 
 	i = register_netdev(dev);
 	if (i)
-		goto err_out_free_8390;
+		goto err_out_free_netdev;
 
 	printk("%s: %s found at %#lx, IRQ %d, ",
 		   dev->name, pci_clone_list[chip_idx].name, ioaddr, dev->irq);
@@ -377,8 +370,6 @@
 
 	return 0;
 
-err_out_free_8390:
-	kfree(dev->priv);
 err_out_free_netdev:
 	kfree (dev);
 err_out_free_res:

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux