netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hariprasad Kelam <hkelam@marvell.com>
To: Jijie Shao <shaojijie@huawei.com>,
	"yisen.zhuang@huawei.com" <yisen.zhuang@huawei.com>,
	"salil.mehta@huawei.com" <salil.mehta@huawei.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"jiri@resnulli.us" <jiri@resnulli.us>
Cc: "shenjian15@huawei.com" <shenjian15@huawei.com>,
	"wangjie125@huawei.com" <wangjie125@huawei.com>,
	"liuyonglong@huawei.com" <liuyonglong@huawei.com>,
	"chenhao418@huawei.com" <chenhao418@huawei.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH V2 net 3/7] net: hns3: release PTP resources if pf initialization failed
Date: Fri, 26 Apr 2024 11:21:49 +0000	[thread overview]
Message-ID: <PH0PR18MB44740CF5F8A3DB7C992A3190DE162@PH0PR18MB4474.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20240426100045.1631295-4-shaojijie@huawei.com>

> From: Peiyang Wang <wangpeiyang1@huawei.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@huawei.com>
> Signed-off-by: Jijie Shao <shaojijie@huawei.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@marvell.com>

  reply	other threads:[~2024-04-26 11:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 10:00 [PATCH V2 net 0/7] There are some bugfix for the HNS3 ethernet driver Jijie Shao
2024-04-26 10:00 ` [PATCH V2 net 1/7] net: hns3: direct return when receive a unknown mailbox message Jijie Shao
2024-04-26 14:26   ` Simon Horman
2024-04-26 10:00 ` [PATCH V2 net 2/7] net: hns3: change type of numa_node_mask as nodemask_t Jijie Shao
2024-04-26 14:26   ` Simon Horman
2024-04-26 10:00 ` [PATCH V2 net 3/7] net: hns3: release PTP resources if pf initialization failed Jijie Shao
2024-04-26 11:21   ` Hariprasad Kelam [this message]
2024-04-26 10:00 ` [PATCH V2 net 4/7] net: hns3: use appropriate barrier function after setting a bit value Jijie Shao
2024-04-26 14:25   ` Simon Horman
2024-04-26 10:00 ` [PATCH V2 net 5/7] net: hns3: using user configure after hardware reset Jijie Shao
2024-04-26 14:25   ` Simon Horman
2024-04-28 14:14     ` Jijie Shao
2024-04-26 10:00 ` [PATCH V2 net 6/7] net: hns3: fix port vlan filter not disabled issue Jijie Shao
2024-04-26 18:15   ` Simon Horman
2024-04-26 10:00 ` [PATCH V2 net 7/7] net: hns3: fix kernel crash when devlink reload during initialization Jijie Shao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR18MB44740CF5F8A3DB7C992A3190DE162@PH0PR18MB4474.namprd18.prod.outlook.com \
    --to=hkelam@marvell.com \
    --cc=chenhao418@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=salil.mehta@huawei.com \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=wangjie125@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).