[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PH0PR18MB44740CF5F8A3DB7C992A3190DE162@PH0PR18MB4474.namprd18.prod.outlook.com>
Date: Fri, 26 Apr 2024 11:21:49 +0000
From: Hariprasad Kelam <hkelam@...vell.com>
To: Jijie Shao <shaojijie@...wei.com>,
"yisen.zhuang@...wei.com"
<yisen.zhuang@...wei.com>,
"salil.mehta@...wei.com" <salil.mehta@...wei.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com"
<edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"jiri@...nulli.us"
<jiri@...nulli.us>
CC: "shenjian15@...wei.com" <shenjian15@...wei.com>,
"wangjie125@...wei.com"
<wangjie125@...wei.com>,
"liuyonglong@...wei.com" <liuyonglong@...wei.com>,
"chenhao418@...wei.com" <chenhao418@...wei.com>,
"netdev@...r.kernel.org"
<netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: [PATCH V2 net 3/7] net: hns3: release PTP resources if pf
initialization failed
> From: Peiyang Wang <wangpeiyang1@...wei.com>
>
> 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: eaf83ae59e18 ("net: hns3: add querying fec ability from firmware")
> Signed-off-by: Peiyang Wang <wangpeiyang1@...wei.com>
> Signed-off-by: Jijie Shao <shaojijie@...wei.com>
> ---
> drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> index 62ddce05fa2b..a068cd745eb4 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> @@ -11761,7 +11761,7 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev
> *ae_dev)
>
> ret = hclge_update_port_info(hdev);
> if (ret)
> - goto err_mdiobus_unreg;
> + goto err_ptp_uninit;
>
> INIT_KFIFO(hdev->mac_tnl_log);
>
> @@ -11812,6 +11812,8 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev
> *ae_dev)
> devl_unlock(hdev->devlink);
> return 0;
>
> +err_ptp_uninit:
> + hclge_ptp_uninit(hdev);
> err_mdiobus_unreg:
> if (hdev->hw.mac.phydev)
> mdiobus_unregister(hdev->hw.mac.mdio_bus);
> --
> 2.30.0
>
Reviewed-by: Hariprasad Kelam <hkelam@...vell.com>
Powered by blists - more mailing lists