From: Barry Song Date: Thu, 18 Jun 2020 01:02:07 +0000 (+1200) Subject: net: hns3: remove unnecessary devm_kfree X-Git-Tag: v5.10.7~1943^2~484^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=674a135746aa7553eff12177d11868367aa102cb;p=platform%2Fkernel%2Flinux-rpi.git net: hns3: remove unnecessary devm_kfree since we are using device-managed function, it is unnecessary to free in probe. Signed-off-by: Barry Song Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index b14f2ab..1817d7f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2097,10 +2097,8 @@ static int hns3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_drvdata(pdev, ae_dev); ret = hnae3_register_ae_dev(ae_dev); - if (ret) { - devm_kfree(&pdev->dev, ae_dev); + if (ret) pci_set_drvdata(pdev, NULL); - } return ret; } @@ -2157,7 +2155,6 @@ static void hns3_shutdown(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); if (system_state == SYSTEM_POWER_OFF)