Commit 20571d88 authored by Devendra Naga's avatar Devendra Naga Committed by David S. Miller

r6040: Do a Proper deinit at errorpath and also when driver unloads (calling r6040_remove_one)

so if mdiobus_alloc fails, the errorpath doesnt do a netif_napi_del and also
doesn't set the priv data of the driver to NULL.

at the driver unload stage the driver doesn't remove the NAPI context, and
doesnt' set the priv data to NULL, and also doesn't call the pci_iounmap.
Signed-off-by: default avatarDevendra Naga <devendra.aaru@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent acaf8276
...@@ -1233,6 +1233,8 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, ...@@ -1233,6 +1233,8 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
err_out_mdio: err_out_mdio:
mdiobus_free(lp->mii_bus); mdiobus_free(lp->mii_bus);
err_out_unmap: err_out_unmap:
netif_napi_del(&lp->napi);
pci_set_drvdata(pdev, NULL);
pci_iounmap(pdev, ioaddr); pci_iounmap(pdev, ioaddr);
err_out_free_res: err_out_free_res:
pci_release_regions(pdev); pci_release_regions(pdev);
...@@ -1253,6 +1255,9 @@ static void __devexit r6040_remove_one(struct pci_dev *pdev) ...@@ -1253,6 +1255,9 @@ static void __devexit r6040_remove_one(struct pci_dev *pdev)
mdiobus_unregister(lp->mii_bus); mdiobus_unregister(lp->mii_bus);
kfree(lp->mii_bus->irq); kfree(lp->mii_bus->irq);
mdiobus_free(lp->mii_bus); mdiobus_free(lp->mii_bus);
netif_napi_del(&lp->napi);
pci_set_drvdata(pdev, NULL);
pci_iounmap(pdev, lp->base);
pci_release_regions(pdev); pci_release_regions(pdev);
free_netdev(dev); free_netdev(dev);
pci_disable_device(pdev); pci_disable_device(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment