From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 EB47127466A; Fri, 7 Aug 2026 15:18:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786115919; cv=none; b=DOOXQgX+aTDv0IzreCr1II7h2jtUPlWCM/6mWdBkWm59SJkab9L0SlSxG9B5WaEhras0cBmgz4GYvrWsN+SbWYymzNCcsZhXM2UlngW0A4VN/dbN7p1Vm2ZSRNV+1PoE59+0pku1FBdMUPjqSuH7GI4Yar+bmB06ixNClbFymg8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786115919; c=relaxed/simple; bh=FOk/WTXPq0T1YnOkhxxAD9DRd9pdqy8NKXPpRtpbJn4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Dqc3IURAg9sYQY/KxFDP+tcY50zUvu/QwAVZBuZyoQ1iS+3QvM74hzpmliwtlTcLA8uWUPGwUISTcYb/1tc5+QCRwNmwI4mXue6Wa8KtRCA4sO7oWJjloVfqRAW52ryxWMqWXT5Ft9T2lbRl3XfuPShYUlpw4wAM8X7pBLZ51aU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NETtLBRf; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NETtLBRf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F8551F000E9; Fri, 7 Aug 2026 15:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786115917; bh=ihBvq+5ha0fgQO3U+oorj2I3Uc3/WiKaknC3iXDYPpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NETtLBRfOc3vQWt0SUHoHRpWk2jOk+b7NG4anhPpD31UEVsz5d6xi7XawYNJYi7wI irhgvdIt6Pzk5FGhAAxgvraMkWlG6QqrSyhSVuwl9In7d7j9MZPQDnOBUIurzy7SfX X8hhEhosb7OTFZwrDKEKmdzYM22jtQW07hHCI3LE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Radhey Shyam Pandey , Michal Simek , Vinod Koul , Sasha Levin Subject: [PATCH 6.6 021/261] phy: zynqmp: fix clock error handling in xpsgtr_phy_init() Date: Fri, 7 Aug 2026 16:36:18 +0200 Message-ID: <20260807143415.826261706@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807143415.358597922@linuxfoundation.org> References: <20260807143415.358597922@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Radhey Shyam Pandey [ Upstream commit e4779e2a16d600892aaf743438f6ce8cc4eb3c4c ] Propagate clk_prepare_enable() failures to the caller instead of returning success, and disable the reference clock on initialization error paths to avoid leaking clock references when phy_exit() is not called. Fixes: 25d700833513 ("phy: xilinx: phy-zynqmp: dynamic clock support for power-save") Signed-off-by: Radhey Shyam Pandey Reviewed-by: Michal Simek Link: https://patch.msgid.link/20260720153832.1130006-2-radhey.shyam.pandey@amd.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/xilinx/phy-zynqmp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c index 559a9c26a0040..bf2a06a7f606f 100644 --- a/drivers/phy/xilinx/phy-zynqmp.c +++ b/drivers/phy/xilinx/phy-zynqmp.c @@ -643,12 +643,13 @@ static int xpsgtr_phy_init(struct phy *phy) { struct xpsgtr_phy *gtr_phy = phy_get_drvdata(phy); struct xpsgtr_dev *gtr_dev = gtr_phy->dev; - int ret = 0; + int ret; mutex_lock(>r_dev->gtr_mutex); /* Configure and enable the clock when peripheral phy_init call */ - if (clk_prepare_enable(gtr_dev->clk[gtr_phy->refclk])) + ret = clk_prepare_enable(gtr_dev->clk[gtr_phy->refclk]); + if (ret) goto out; /* Skip initialization if not required. */ @@ -658,7 +659,7 @@ static int xpsgtr_phy_init(struct phy *phy) if (gtr_dev->tx_term_fix) { ret = xpsgtr_phy_tx_term_fix(gtr_phy); if (ret < 0) - goto out; + goto out_disable_clk; gtr_dev->tx_term_fix = false; } @@ -672,7 +673,7 @@ static int xpsgtr_phy_init(struct phy *phy) */ ret = xpsgtr_configure_pll(gtr_phy); if (ret) - goto out; + goto out_disable_clk; xpsgtr_lane_set_protocol(gtr_phy); @@ -690,6 +691,10 @@ static int xpsgtr_phy_init(struct phy *phy) break; } + goto out; + +out_disable_clk: + clk_disable_unprepare(gtr_dev->clk[gtr_phy->refclk]); out: mutex_unlock(>r_dev->gtr_mutex); return ret; -- 2.53.0