Skip to content

Commit 950aa42

Browse files
Peiyang WangPaolo Abeni
authored andcommitted
net: hns3: release PTP resources if pf initialization failed
During the PF initialization process, hclge_update_port_info may return an error code for some reason. At this point, the ptp initialization has been completed. To void memory leaks, the resources that are applied by ptp should be released. Therefore, when hclge_update_port_info returns an error code, hclge_ptp_uninit is called to release the corresponding resources. Fixes: eaf83ae ("net: hns3: add querying fec ability from firmware") Signed-off-by: Peiyang Wang <wangpeiyang1@huawei.com> Signed-off-by: Jijie Shao <shaojijie@huawei.com> Reviewed-by: Hariprasad Kelam <hkelam@marvell.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 6639a7b commit 950aa42

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11764,7 +11764,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
1176411764

1176511765
ret = hclge_update_port_info(hdev);
1176611766
if (ret)
11767-
goto err_mdiobus_unreg;
11767+
goto err_ptp_uninit;
1176811768

1176911769
INIT_KFIFO(hdev->mac_tnl_log);
1177011770

@@ -11815,6 +11815,8 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
1181511815
devl_unlock(hdev->devlink);
1181611816
return 0;
1181711817

11818+
err_ptp_uninit:
11819+
hclge_ptp_uninit(hdev);
1181811820
err_mdiobus_unreg:
1181911821
if (hdev->hw.mac.phydev)
1182011822
mdiobus_unregister(hdev->hw.mac.mdio_bus);

0 commit comments

Comments
 (0)