patch-2.4.3 linux/drivers/net/ne2k-pci.c

Next file: linux/drivers/net/net_init.c
Previous file: linux/drivers/net/ne.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.2/linux/drivers/net/ne2k-pci.c linux/drivers/net/ne2k-pci.c
@@ -239,7 +239,7 @@
 		}
 	}
 
-	dev = init_etherdev(NULL, 0);
+	dev = alloc_etherdev(0);
 	if (!dev) {
 		printk (KERN_ERR "ne2k-pci: cannot allocate ethernet device\n");
 		goto err_out_free_res;
@@ -312,17 +312,11 @@
 
 	/* Allocate dev->priv and fill in 8390 specific dev fields. */
 	if (ethdev_init(dev)) {
-		printk (KERN_ERR "%s: unable to get memory for dev->priv.\n", dev->name);
+		printk (KERN_ERR "ne2kpci(%s): unable to get memory for dev->priv.\n",
+			pdev->slot_name);
 		goto err_out_free_netdev;
 	}
 
-	printk("%s: %s found at %#lx, IRQ %d, ",
-		   dev->name, pci_clone_list[chip_idx].name, ioaddr, dev->irq);
-	for(i = 0; i < 6; i++) {
-		printk("%2.2X%s", SA_prom[i], i == 5 ? ".\n": ":");
-		dev->dev_addr[i] = SA_prom[i];
-	}
-
 	ei_status.name = pci_clone_list[chip_idx].name;
 	ei_status.tx_start_page = start_page;
 	ei_status.stop_page = stop_page;
@@ -346,13 +340,27 @@
 	dev->open = &ne2k_pci_open;
 	dev->stop = &ne2k_pci_close;
 	NS8390_init(dev, 0);
+
+	i = register_netdev(dev);
+	if (i)
+		goto err_out_free_8390;
+
+	printk("%s: %s found at %#lx, IRQ %d, ",
+		   dev->name, pci_clone_list[chip_idx].name, ioaddr, dev->irq);
+	for(i = 0; i < 6; i++) {
+		printk("%2.2X%s", SA_prom[i], i == 5 ? ".\n": ":");
+		dev->dev_addr[i] = SA_prom[i];
+	}
+
 	return 0;
 
+err_out_free_8390:
+	kfree(dev->priv);
 err_out_free_netdev:
-	unregister_netdev (dev);
 	kfree (dev);
 err_out_free_res:
 	release_region (ioaddr, NE_IO_EXTENT);
+	pci_set_drvdata (pdev, NULL);
 	return -ENODEV;
 
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)