sfc: Fix missing cleanup in failure path of efx_pci_probe()
authorBen Hutchings <bhutchings@solarflare.com>
Wed, 4 Apr 2012 23:22:19 +0000 (00:22 +0100)
committerBen Hutchings <bhutchings@solarflare.com>
Thu, 10 May 2012 01:22:16 +0000 (02:22 +0100)
We need to clear the private data pointer in the PCI device.
Also reorder cleanup in efx_pci_remove() for symmetry.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
drivers/net/ethernet/sfc/efx.c

index 5cc58a3b75ac7f48866fdf14b79bf2fb1656d26f..8253d2155fe3eb3f1968e53478be751294a1e265 100644 (file)
@@ -2497,8 +2497,8 @@ static void efx_pci_remove(struct pci_dev *pci_dev)
        efx_fini_io(efx);
        netif_dbg(efx, drv, efx->net_dev, "shutdown successful\n");
 
-       pci_set_drvdata(pci_dev, NULL);
        efx_fini_struct(efx);
+       pci_set_drvdata(pci_dev, NULL);
        free_netdev(efx->net_dev);
 };
 
@@ -2700,6 +2700,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
  fail2:
        efx_fini_struct(efx);
  fail1:
+       pci_set_drvdata(pci_dev, NULL);
        WARN_ON(rc > 0);
        netif_dbg(efx, drv, efx->net_dev, "initialisation failed. rc=%d\n", rc);
        free_netdev(net_dev);