net: hns3: remove unnecessary pci_set_drvdata() and devm_kfree()
authorWei Yongjun <weiyongjun1@huawei.com>
Fri, 30 Mar 2018 02:24:28 +0000 (02:24 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Apr 2018 02:22:25 +0000 (22:22 -0400)
There is no need for explicit calls of devm_kfree(), as the allocated
memory will be freed during driver's detach.

The driver core clears the driver data to NULL after device_release.
Thus, it is not needed to manually clear the device driver data to NULL.

So remove the unnecessary pci_set_drvdata() and devm_kfree().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

index a31b4adf6e6ac86eaa96cde09d0549e67e4a6b15..8c55965a66ac310d91f2b9f2d4f9a1d6da1a1237 100644 (file)
@@ -1614,10 +1614,6 @@ static void hns3_remove(struct pci_dev *pdev)
        struct hnae3_ae_dev *ae_dev = pci_get_drvdata(pdev);
 
        hnae3_unregister_ae_dev(ae_dev);
-
-       devm_kfree(&pdev->dev, ae_dev);
-
-       pci_set_drvdata(pdev, NULL);
 }
 
 static struct pci_driver hns3_driver = {