]> err.no Git - linux-2.6/commitdiff
[PATCH] chelsio: free_netdev
authorStephen Hemminger <shemminger@osdl.org>
Fri, 17 Nov 2006 19:25:23 +0000 (11:25 -0800)
committerJeff Garzik <jeff@garzik.org>
Sat, 2 Dec 2006 05:16:37 +0000 (00:16 -0500)
Network devices need to be free'd with free_netdev() not kfree()
otherwise the kernel will panic if an application has /sys/class/net/ethX/value
open and reads it.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/chelsio/cxgb2.c

index 37de99b65c1428bbd2a2bd3f793e5dae461b19f0..37037e5890e19c56cc9fe5d8579982e024a5447c 100644 (file)
@@ -1141,11 +1141,11 @@ static int __devinit init_one(struct pci_dev *pdev,
        t1_free_sw_modules(adapter);
  out_free_dev:
        if (adapter) {
-               if (adapter->regs) iounmap(adapter->regs);
+               if (adapter->regs)
+                       iounmap(adapter->regs);
                for (i = bi->port_number - 1; i >= 0; --i)
-                       if (adapter->port[i].dev) {
-                               kfree(adapter->port[i].dev);
-                       }
+                       if (adapter->port[i].dev)
+                               free_netdev(adapter->port[i].dev);
        }
        pci_release_regions(pdev);
  out_disable_pdev:
@@ -1175,9 +1175,9 @@ static void __devexit remove_one(struct pci_dev *pdev)
                t1_free_sw_modules(adapter);
                iounmap(adapter->regs);
                while (--i >= 0)
-                       if (adapter->port[i].dev) {
-                               kfree(adapter->port[i].dev);
-                       }
+                       if (adapter->port[i].dev)
+                               free_netdev(adapter->port[i].dev);
+
                pci_release_regions(pdev);
                pci_disable_device(pdev);
                pci_set_drvdata(pdev, NULL);