Skip to content

Commit

Permalink
net: hns3: remove unnecessary devm_kfree
Browse files Browse the repository at this point in the history
since we are using device-managed function, it is unnecessary
to free in probe.

Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Barry Song authored and David S. Miller committed Jun 19, 2020
1 parent 9f66a45 commit 674a135
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 674a135

Please sign in to comment.