From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D16D606A329 for ; Tue, 1 Dec 2026 08:28:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=1EbzugdW; dkim=pass (1024-bit key) header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=XJS66FoB DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=MmGOI9YDFDHgJ3GGT2Xuzn+w1E7OCiVK9Kqyg+Ay4x0=; b=1EbzugdWskKU/PvQXo1eLtsQV1 1bgG1FwtDqY/NcrrmYKoiwptbW8zPSDKpGf84r40C+LHqkFIzZZ7i2nQA+rgY9DQfMNiw9m4bKAMK k85piSzjGk/AaSA1eell7kREPVQTUsOVcCb0cYbOe5JPRMFN2rowUI2ZJBRQqNx7QpB6k1t29sg9V S89dzODH0i5p71Xxnhi3u3XRv/OWpx4Cor7y8Wpv8Z9BCPzOGpnKTrfVGVRZcewMW1jkySAWasfyU jIWnpqwbnpH7CYsSPD2TkmFtURzVaOXmzdEs3q7hYmtP6OQzS6kx0P4bLWQ2YkSvvk1zCRhMRu46B 3RY3c9+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYJDs-000000070Sz-3C1Y; Tue, 01 Dec 2026 08:28:24 +0000 Received: from cmccmta6.chinamobile.com ([111.22.67.139]) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYJDn-000000070S3-42ay; Tue, 01 Dec 2026 08:28:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmss.chinamobile.com; s=default; l=0; h=from:subject:message-id:to:cc:mime-version; bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=; b=XJS66FoBaLrP3rv4d9FHEe9oAizMKdwOZmYBTh9niRHtSbO8MsnKyvLhVnDTv9rfw6AE9nosZiXqP McsBqsQhd7Ka5VHb5iCbwWc1uWKZhyw6B1Ld7swVKd5DnktqA16/vRa0hiEu4nQHJLN7pFNE6xsLNn XL6z4aWVYZixwYAI= X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from spf.mail.chinamobile.com (unknown[10.188.0.87]) by rmmx-syy-dmz-app01-12001 (RichMail) with SMTP id 2ee16b0e8515b04-60d06; Tue, 01 Dec 2026 16:28:06 +0800 (CST) X-RM-TRANSID: 2ee16b0e8515b04-60d06 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from [198.18.0.27] (unknown[223.104.153.115]) by rmsmtp-syy-appsvr04-12004 (RichMail) with SMTP id 2ee46b0e8515d1c-17648; Tue, 01 Dec 2026 16:28:06 +0800 (CST) X-RM-TRANSID: 2ee46b0e8515d1c-17648 From: Xia Yan To: vkoul@kernel.org, linux-phy@lists.infradead.org Cc: neil.armstrong@linaro.org, mani@kernel.org, heiko@sntech.de, p.zabel@pengutronix.de, ayaka@soulik.info, kishon@kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, yana06070@163.com Subject: [PATCH v2] phy: rockchip-usb: fix reset control leak Date: Tue, 01 Dec 2026 16:28:05 +0800 Message-ID: <20261201082805.50160d227cb63d84.patch@cmss.chinamobile.com> X-Archived-By: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_002821_916319_785DD20E X-CRM114-Status: GOOD ( 11.01 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 rockchip_usb_phy_init() acquires a reset control from each PHY child node but never releases it on probe failure or driver detach. The leaked exclusive control prevents a later probe from acquiring the same reset. Since lookup errors are converted to NULL, subsequent PHY reset calls silently skip the hardware reset. Move the lookup after devm_phy_create() and use devm_reset_control_get() with the PHY device. Its firmware node is the original PHY child node, so this keeps the lookup on the same node and releases the control when the PHY device is released. Keep the existing handling of lookup errors. Found during review of reset-control lifetimes. Build-tested the driver object directly on x86_64 with W=1 and reset support enabled. No ARM or hardware testing. Fixes: 0f74ab59ce87 ("phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup") Signed-off-by: Xia Yan --- Notes (rockchip-v2-20261201): Changes in v2: - Drop the stable Cc as requested by Manivannan Sadhasivam. - Use devm_reset_control_get() on the PHY device after devm_phy_create(), replacing the custom reset_control_put() action from v1. v1: https://lore.kernel.org/linux-phy/20261115042640.426517-1-yanxia@cmss.chinamobile.com/ Review: https://patchwork.kernel.org/comment/27414254/ drivers/phy/rockchip/phy-rockchip-usb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-usb.c b/drivers/phy/rockchip/phy-rockchip-usb.c index c5a2853a63d3..a3adb0a01b85 100644 --- a/drivers/phy/rockchip/phy-rockchip-usb.c +++ b/drivers/phy/rockchip/phy-rockchip-usb.c @@ -218,10 +218,6 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base, return -EINVAL; } - rk_phy->reset = of_reset_control_get(child, "phy-reset"); - if (IS_ERR(rk_phy->reset)) - rk_phy->reset = NULL; - rk_phy->reg_offset = reg_offset; rk_phy->clk = of_clk_get_by_name(child, "phyclk"); @@ -285,6 +281,10 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base, } phy_set_drvdata(rk_phy->phy, rk_phy); + rk_phy->reset = devm_reset_control_get(&rk_phy->phy->dev, "phy-reset"); + if (IS_ERR(rk_phy->reset)) + rk_phy->reset = NULL; + rk_phy->vbus = devm_regulator_get_optional(&rk_phy->phy->dev, "vbus"); if (IS_ERR(rk_phy->vbus)) { if (PTR_ERR(rk_phy->vbus) == -EPROBE_DEFER) base-commit: 9a0dd2a09484e5ba45eb8e6ab58c0effe18703a3 -- 2.43.0 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy