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=1796379992; b=tNTCf/Xx9v0dAWeYRyvQwDVjqC7VVNFeY6IhTWpePnxKPHlC2raTs9MgZg+qc/EYbniR 8l/fghqA0zrURivX1f1vSvJjo440/+BQtk1r2zJOjLJ/6jJzKvI1gasoZKC98pn582oQv ZGBjXCG79aHAPc11BI1Po3NOd1jTjSHoz8baMqJ97wL90QnKHgtoE1cShaQe3nyHMUepL SqZhbvt3WWzEAr4RhlBZCktFXtkFzuO21jTOErHqBf+Y6YncwbXh4vt8EEBWq5RiFlOJl 19ODVxUJSn5EfcW6ZH49lNgRaWgZDXnih+wHgBLqWlB7O8JFqlJEXKt4o3prrI+34Gg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379992; 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=k7g3Bq590iGZ8FmfLVf5Pt3HcT5S+2J9BRhme6Ch0Xo=; b=JaVvgE5HFkYR8BlEJQyK7W2frApepTiA3bsM9mc3ojVncMgeA4YUP2WfuAsM+icwLpON pNhXwYkJWuBr4N2uN5B4fNakYBPvMt6hyEPMSUcaBh5G/8brpiDGOiqdwVg/caNGayOHD 4yTWTwFNpqih8l8Df4riet8knYmOFtvck9FWQDDnobBqIvRBU2D3lOr9zxue6+325D3xE yrpoHfa8vPJWqOgoiE2xwLN2mGvvL12SIiTLimfnheIIrBZ3AmiyINYOFA/latmf2Ig20 2LZxmkategon8e8pq4H5TywIpaH5orBtJi6bZ23f5uyt20cdKkeToC3u/d40aM1KiqA== 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=RJenoogf; 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 31DA2606A322; Fri, 4 Dec 2026 10:26:32 +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=RJenoogf Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D7D01F000C2; Fri, 4 Dec 2026 10:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379992; bh=k7g3Bq590iGZ8FmfLVf5Pt3HcT5S+2J9BRhme6Ch0Xo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RJenoogfYAO9MRGP7x1WQdF1JtHErkX30+FSr28iwQTfBBhSDhNaWt7uX5ALH/UKW cWFp+cg3SBr/685KwTxBrwrD2nCE5CemJtSCs/ScE3aDpM998DdE6c+aytJQbs4lYW jvpQOs2UpjY5oPIG41xM4IgZR20xMl4PCn2xxElk= 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 7.3 081/742] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Date: Fri, 4 Dec 2026 18:59:05 +0900 Message-ID: <20261204100637.258600961@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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 021657cbce481..fdd81c935e5f3 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