From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388881; b=DhwOqFlVBukB2lcACskklpJl7l1Ihsd52DdDKm5JK5Ch9q3d+SVisVowIqL0Q+UJLW5X 9IayMcJ1QISRYzMNTqLC5RnlLhOAoSy8xOPD1073Dfj8JiP5N6gQ50kw5JyOQX0KUvSNG 7YXZBkmt4Nzrt0mtn0GrwxZoJ1fHlEt51Luv+wSv0Ye7bIWhGCJOwiP0XD/mZr0/18TZs M1FhwT6STBvWgjgSrj/s3GGJYeJYzOlgjQWvoNSYYITqplBHtnoNt9fDRjKMUx1Sip+4N Jn738rUJzuvXBMk8TmRAlNWnSov5RXVBaQEmFxCLuDFmxAFnZCYh3gJq64YpEpXonpg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388881; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=45+xb+iOyuHGgksDEP+TEBMPPKzwuoKKjyOf+ZWYDnk=; b=PxUY5tyPUPRwwMDfcyI8otK5naPSye9D6htgpqm9og38f/tkAV+2rPcZi9VoTy2ObFS1 XtDEVFky8QMoQ0uCPt4vOO3mJuOQixQF57eA0+ZgMPqDqORYG+tsiNygei2ABKKtWGkGO iSWWhS9Hx7A518ptTTPdD59CqshxeGX5gjs/1KHytMxjetxlHlUgzAtbwQ9jjNWsGItYZ FHTKzzKRP+ei4R68Yr9q/Gs4zTeh3UhyBEJg1Z43qQUMQvsUVsS01zc2SDEAYi/1rEpR3 oTS3+avc0j8Dg1oFpXobZG45Rjr0Dc5AB9mdDzUtsPcaOb/J3KdtYo+5OhSwisbJwyw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=kW1gI3Ym; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B129606A32C; Fri, 4 Dec 2026 12:54:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=kW1gI3Ym Received: by smtp.kernel.org (Postfix) with ESMTPSA id 215281F00897; Fri, 4 Dec 2026 12:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388880; bh=45+xb+iOyuHGgksDEP+TEBMPPKzwuoKKjyOf+ZWYDnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kW1gI3YmtR1CuDY6Rd5Ya7VIZOCDZws+lgSHy79mDaixzRM9RPBshSsrKAtKoJbIg W0f3geh8vwwX3aU7CNOlfmbL766VLup44E48MG9NTTOo10JsJCLEJ8rwbYsuJQUskV 1jCykAmQdCtfMb23C05Fof5t9VFbYheCNyj1G/jY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Manivannan Sadhasivam , Hongling Zeng , Vinod Koul , Sasha Levin Subject: [PATCH 6.1 0785/1059] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Date: Fri, 4 Dec 2026 19:05:16 +0900 Message-ID: <20261204100704.360624779@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hongling Zeng [ Upstream commit aeb637c73631851de0965514151f7ff7bc13f940 ] ti_pipe3_get_clk() has two issues with -EPROBE_DEFER error handling: 1. When devm_clk_get() for sysclk fails, the function returns -EINVAL instead of propagating the actual error code. This masks -EPROBE_DEFER to -EINVAL, breaking the probe deferral mechanism and causing permanent driver initialization failure on systems with non-deterministic probe ordering. 2. For SATA PHY refclk, the function ignores all errors to support older DTBs missing the refclk property. However, this incorrectly ignores -EPROBE_DEFER as well, causing the driver to proceed without waiting for the clock provider to become available. Fix both issues: - Return PTR_ERR(phy->sys_clk) instead of -EINVAL to propagate all error codes including -EPROBE_DEFER - Use devm_clk_get_optional() for SATA refclk to handle optional clocks while propagating -EPROBE_DEFER and other errors Fixes: a70143bbef6b ("drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework") Fixes: 7f33912d2978 ("phy: ti-pipe3: Fix SATA across suspend/resume") Suggested-by: Manivannan Sadhasivam Signed-off-by: Hongling Zeng Reviewed-by: Manivannan Sadhasivam Link: https://patch.msgid.link/20260909122630.1313205-4-zenghongling@kylinos.cn Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/ti/phy-ti-pipe3.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c index 8f47981fb2109..690615ff5c804 100644 --- a/drivers/phy/ti/phy-ti-pipe3.c +++ b/drivers/phy/ti/phy-ti-pipe3.c @@ -608,14 +608,20 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy) struct clk *clk; struct device *dev = phy->dev; - phy->refclk = devm_clk_get(dev, "refclk"); + /* + * refclk is optional for SATA PHY to support older DTBs, but + * required for other modes. Use devm_clk_get_optional() for SATA + * which returns NULL for -ENOENT, allowing us to propagate all + * other errors including -EPROBE_DEFER. + */ + if (phy->mode == PIPE3_MODE_SATA) + phy->refclk = devm_clk_get_optional(dev, "refclk"); + else + phy->refclk = devm_clk_get(dev, "refclk"); + if (IS_ERR(phy->refclk)) { - dev_err(dev, "unable to get refclk\n"); - /* older DTBs have missing refclk in SATA PHY - * so don't bail out in case of SATA PHY. - */ - if (phy->mode != PIPE3_MODE_SATA) - return PTR_ERR(phy->refclk); + return dev_err_probe(dev, PTR_ERR(phy->refclk), + "unable to get refclk\n"); } if (phy->mode != PIPE3_MODE_SATA) { @@ -631,8 +637,8 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy) if (phy->mode != PIPE3_MODE_PCIE || phy->phy_power_syscon) { phy->sys_clk = devm_clk_get(dev, "sysclk"); if (IS_ERR(phy->sys_clk)) { - dev_err(dev, "unable to get sysclk\n"); - return -EINVAL; + return dev_err_probe(dev, PTR_ERR(phy->sys_clk), + "unable to get sysclk\n"); } } -- 2.53.0