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=1796386286; b=UfK25ooGPjsxjekHWVu3m3B4+EL7Jdb7Xk4o20v3gEwVmjpitOPuM05aKLsddwyX2QKf F+vl/wBIxZyZP2Rz7+xGbvZ/ulnDuCu4XDDvjYeCN4sSqAerAlZWtpuOrbNvYNFDV/09A /qs6oh0EFJaMfkAjUqtWkj/j/5x7L1Xvnptz1mVbeS9YYG1HpsmYWXFnnFqgPMIJ56ae4 ccqafkqsObNJejed0iEiUDCXxwLGX1WbZXS9gwwwkZcyr4xlsvIfucARg4tcOi49Sf4ik Exkj1QL6pEkzD/2+ZznR2Y5kz1F8GP+emcDzCkwEBOLMCbgnuHGdILzaEgxzR4ozqJA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386286; 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=XBPJ3qVCfI2dqRiYo9amkOL7xMeqiNkCxTk9LXV7zQc=; b=yCAERMrNwhGH5MzxokOdFzmFJ69NMmSgSflet4WxBh5RJ75nvBR6/cqDn02/ZoCu2v6v SLry6x8rgUBvvK9jPfWHZ+m/Zvh/ybWc0Ga/cTRhzxnrM/HUfeWmMG4wLR1mXYB5itT6k ykH9RrbJbHP2rQOb+dt2n5Wu7DD+TnONpyw/Cep1tKEj9ngKahPm4CezLwo1NIMqhGSY9 RFQDRSOjGxZ+ZoWhn//EkRS0iGTJfMawZkSUlVJ5RCc/2o6ei3IK6VYYLsaD2bQOIqvvl y0eVWjWB8qr1ioq+D/MprJOeJrIhRVzaYdh9uzsa697r2qV0bfKZTNS+xoFObykukug== 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=We7aUdRA; 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 8BBEE606A32F; Fri, 4 Dec 2026 12:11:26 +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=We7aUdRA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83B431F0093A; Fri, 4 Dec 2026 12:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386286; bh=XBPJ3qVCfI2dqRiYo9amkOL7xMeqiNkCxTk9LXV7zQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=We7aUdRAm14iE+wR+vmNXo6UHWDqyvSo3kHq0dUqLBjbDsCgM+ipeBcuRxaazWmFW 8BH6571SnKvsGS9Vr7jee61EcJsutnPV2uET+08VwGEq4UMnGg/CcZCqcxh9enkS9e iY0iZh8hxDwiMkZ3C9lCRNSPymFqSfHAxg0ACwEk= 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.6 0858/1167] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Date: Fri, 4 Dec 2026 19:04:45 +0900 Message-ID: <20261204100724.464436019@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-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 de0c045f655c0..b2eef24dcd798 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