From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A065F2B9D7; Tue, 14 May 2024 11:35:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715686532; cv=none; b=KOk8U+xi9kQ5NRwN1qztRmrXaraZMJVNH7L/k+U9TIMGIsDVWHOZqmG/hebVi+glfwAewBl0O1r2NrCERciyyviB3oTSKviw3iwLDHAUl1EBq/Wgz6z468wzWb2OwBv8TBAAvL709zw4i6D45y+3ioVm4E0nFN+bRP2Jz6gyADs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715686532; c=relaxed/simple; bh=Z2M8NZwur7KzDKN4k5nXUYqXA8V5GpiWYXLt0dQ8iy0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K6+gYaYbI0a91PxP/bXaA1YNhe8KKldiFZnmZALRbJwJ7SpimDM6WRRdARrr7Nap8WWaujd+LikXxGVrU7eBdFruS8PD0UFqhNuR+5hvM7xE+Ar9i3vndLEA5D8ERXt3X/TocbsbwtnMZDeAH0uOB6wPKZc2CTIHfRm/v0IzYeM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FBs3xrxl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="FBs3xrxl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBEA6C2BD10; Tue, 14 May 2024 11:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1715686532; bh=Z2M8NZwur7KzDKN4k5nXUYqXA8V5GpiWYXLt0dQ8iy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FBs3xrxlov7DhgpbWFrIjhzXQPmX/OvMHUv77yxzq0eDpyAw/f0rS82YVJ5Hzp66c Xkzy8rCzAFOlamHymIEqZKGHhCWwF3AjaFOn5NKMoPI6pKIYx+xdh8mvnwjxGjNXEZ 5qXZ3XY+p4LtZ4m3BDERWAOufWgxUpI6W0hASIGU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Peiyang Wang , Jijie Shao , Hariprasad Kelam , Paolo Abeni , Sasha Levin Subject: [PATCH 6.1 170/236] net: hns3: release PTP resources if pf initialization failed Date: Tue, 14 May 2024 12:18:52 +0200 Message-ID: <20240514101026.813320948@linuxfoundation.org> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240514101020.320785513@linuxfoundation.org> References: <20240514101020.320785513@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peiyang Wang [ Upstream commit 950aa42399893a170d9b57eda0e4a3ff91fd8b70 ] 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 Reviewed-by: Hariprasad Kelam Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- 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 19a0b6c37c909..75472fde78f17 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -11742,7 +11742,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); @@ -11788,6 +11788,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.43.0