Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp170861lqf; Fri, 26 Apr 2024 03:16:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIXO7MYCdaqKtVaEwbf5EUa96FF43zvzNJ4ej/Ei/4E0tfV6/Gpt2peOHEWO069+diXJxzXPx9yagLMLRAbtzYpG8v+A+r/JwgIham6g== X-Google-Smtp-Source: AGHT+IFkGcSZQYeonfWWiGY7XObKHEJxoREc6oFLnqjCc3JYXr3FUe6N66Oh2P8Hx7tw7Zq2Rps1 X-Received: by 2002:a50:d5c2:0:b0:56e:2cbc:db77 with SMTP id g2-20020a50d5c2000000b0056e2cbcdb77mr1427020edj.33.1714126563643; Fri, 26 Apr 2024 03:16:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714126563; cv=pass; d=google.com; s=arc-20160816; b=Ls9MTC943015usUtrKBEZjRDJknWiPHDw7sX0RO6M+T1mw+v3PaXrmfzgIyuZDQgEJ z2RlvCf0tZDxwwialdLEFJ76Y4PRCvkNcCkz91WhsEvrPzX3zJ8KgLGyxxy7BJZI8x09 Y99fc3KFgbIPW7vYuLyoKWCSBEe8sIBJgIy9rugcUD1m9H8BjnpMSNGyFXFPcoPg/9nB KZC1jeNUYOoxyXFlZhPAyeZjB2a1yGWbGpJIIYjl7U17qSEfhqASwFiG2FvQkb8SjIFy 6RDGKsweltKJfEin2jva7Eyzxfxhht2MoX4OESMKsWUvhZzbYQ8gY8f1znMZy3PQ4PUP QLew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=aMNKyuKMJ70BHrObc/rBWXWSWRy0OUPV8X/D/lDlGiU=; fh=bH8wtoutavYA7YVow2Ey5eNMVKGylgpvzC5W/6gq12U=; b=NnQWcCvdcq3TXlVwZ6UDGoTstof5FwtydcjFFDCtwESweZsTbenJFVx6/cSDzPvca8 x9wCQCcSvpOGtBny8qnWdsMxviSqvs00dz9l9T0IxEPWUaHTsSPAAJX2tZOFudkHUCKh 0hFPu2J4H3WwOFLlEJ90RKHYCo8yLBrKJtdiFmsZw/G0dhtSDDCJRPZUEDXpFCXfim9J TdXAW/yapqHaf20AM7weuBblhwXP2fzFevfVYsBkuXSIOuZrJUwjStfTk4NdgouugNQ3 x/HHE3/v/ED1SZvo5GWwbz32V+mM13S6ztJbwauMnSWpvGJdYYY0OTsAHGB2bH4Ej82R vfsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-159845-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159845-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h13-20020a056402280d00b00571d5652231si10078923ede.362.2024.04.26.03.16.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 03:16:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159845-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-159845-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159845-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 599E71F22736 for ; Fri, 26 Apr 2024 10:16:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ECDB01448E4; Fri, 26 Apr 2024 10:15:32 +0000 (UTC) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0028142E64; Fri, 26 Apr 2024 10:15:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714126532; cv=none; b=InWARqmyWbemIUq3kFKiwR+cl97wQxbhWzz4ZOH5KaxA/EXbpnrHVSbKq/gPFc8Qns57RbuN3yvkrumLwSU2J9PivxleeBPZMp+bxiLKXmQUBGheDZnaWHeY9nilCPF5Kqz/SGbu7VjB3HIk/mIRVc/Nok/u9FPSZ+hYJLxAV0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714126532; c=relaxed/simple; bh=sSfnQyXkG11zKnSbNhyBke65uXf+l02lhOQt5v81lQM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CzOqcUsIv8Mvx3SsQFzCXB07lT/qE0VWUZPcTr96tYvolRqMLgv1TbSdcvgtNDhur5ZTz8iOZQiP1QlMyN3KdzhwqWNCP9GkP1uwULw14ATDXE4xiQR6YHQIM6jTvWmk88dJDxs7/Qz54KJbOYO1wfX6zACfX6aNlODwXkBjczU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4VQpSh6mrlzNtt3; Fri, 26 Apr 2024 18:12:52 +0800 (CST) Received: from kwepemm600007.china.huawei.com (unknown [7.193.23.208]) by mail.maildlp.com (Postfix) with ESMTPS id 804F91800C4; Fri, 26 Apr 2024 18:15:26 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 26 Apr 2024 18:15:20 +0800 From: Jijie Shao To: , , , , , , CC: , , , , , , Subject: [PATCH V2 net 3/7] net: hns3: release PTP resources if pf initialization failed Date: Fri, 26 Apr 2024 18:00:41 +0800 Message-ID: <20240426100045.1631295-4-shaojijie@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240426100045.1631295-1-shaojijie@huawei.com> References: <20240426100045.1631295-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600007.china.huawei.com (7.193.23.208) From: Peiyang Wang 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 Signed-off-by: Jijie Shao --- 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