Netdev Archive mirror
 help / color / mirror / Atom feed
From: Jijie Shao <shaojijie@huawei.com>
To: <yisen.zhuang@huawei.com>, <salil.mehta@huawei.com>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <jiri@resnulli.us>, <horms@kernel.org>
Cc: <shenjian15@huawei.com>, <wangjie125@huawei.com>,
	<liuyonglong@huawei.com>, <shaojijie@huawei.com>,
	<chenhao418@huawei.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH V3 net 4/7] net: hns3: release PTP resources if pf initialization failed
Date: Tue, 7 May 2024 21:42:21 +0800	[thread overview]
Message-ID: <20240507134224.2646246-5-shaojijie@huawei.com> (raw)
In-Reply-To: <20240507134224.2646246-1-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>
Reviewed-by: Hariprasad Kelam <hkelam@marvell.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 ecff9b426527..1d255b3ae988 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -11764,7 +11764,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);
 
@@ -11815,6 +11815,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


  parent reply	other threads:[~2024-05-07 13:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07 13:42 [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver Jijie Shao
2024-05-07 13:42 ` [PATCH V3 net 1/7] net: hns3: using user configure after hardware reset Jijie Shao
2024-05-07 15:20   ` Przemek Kitszel
2024-05-07 16:51   ` Markus Elfring
2024-05-08 16:21   ` Simon Horman
2024-05-07 13:42 ` [PATCH V3 net 2/7] net: hns3: direct return when receive a unknown mailbox message Jijie Shao
2024-05-07 17:08   ` Markus Elfring
2024-05-07 13:42 ` [PATCH V3 net 3/7] net: hns3: change type of numa_node_mask as nodemask_t Jijie Shao
2024-05-07 13:42 ` Jijie Shao [this message]
2024-05-07 17:26   ` [PATCH V3 net 4/7] net: hns3: release PTP resources if pf initialization failed Markus Elfring
2024-05-07 13:42 ` [PATCH V3 net 5/7] net: hns3: use appropriate barrier function after setting a bit value Jijie Shao
2024-05-07 13:42 ` [PATCH V3 net 6/7] net: hns3: fix port vlan filter not disabled issue Jijie Shao
2024-05-07 17:51   ` Markus Elfring
2024-05-07 13:42 ` [PATCH V3 net 7/7] net: hns3: fix kernel crash when devlink reload during initialization Jijie Shao
2024-05-07 18:05   ` Markus Elfring
2024-05-09  9:00 ` [PATCH V3 net 0/7] There are some bugfix for the HNS3 ethernet driver patchwork-bot+netdevbpf

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=20240507134224.2646246-5-shaojijie@huawei.com \
    --to=shaojijie@huawei.com \
    --cc=chenhao418@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --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=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 read-only IMAP folder(s) and NNTP newsgroup(s).