From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=111.22.67.135 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796113691; b=0iOjKS3yNWkSCXzZqpw3+fgUxePR+8AVrZcOklK/qUUvZCKAxIFdsO9Fp5UClvWyaBOZ LBCxcNjZnMiUwWJEt+fHw4vOVMolApBS6LCKpUrE9SChI+BrfeFnw5QHcI5HP7+seks7D IpTJoknzr1jlLrpZILAlwT7IxQeoVuLpE35a9sWZ7ZqS1qoXgjCEmiVPCls+iX8TEXusr jMzOt+dCnHnjVAi3X6b+t1AiyNGPZo9+L7Jqw4WJ9jefNFYIniciz0sX58V2d1igL4KaF 45ZiQM6Gb/aPiwJ9bX4mvku3N0ZYmc4BNdAxc3/sY+DKvIG7q0TBW5bAd4YiDuMLkiQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796113691; h=DMARC-Filter:DKIM-Signature:X-RM-TagInfo:X-RM-SPAM-FLAG:Received: X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:X-RM-TRANSID:From: To:Cc:Subject:Date:Message-ID:Content-Type:Content-Transfer-Encoding: MIME-Version; bh=keVFYQZdAGv966LhFXzfShWW0pHS7pLkrr0veUTs+Yw=; b=PeoSgiMLN3oSTmukTYFBqTeI0wRTbP7DisgDVK1m0zt3o3Wr573mHexvxVOAAr1TPJCp 1KTKtXpnOEBqwytvKJkoWfk4T6eG7Y2GtMcXU8vlflinY9Xhogw41SbeNxRf+qB8Rmr4q QB04+0eMXK6qNVN7AewpSJQv5R76rSvRV7pFu+NvkTyUP53XnxwO7dA+NIVcO8F/dsNgz eWVqVwLC0rsHsvYDMt8frvnos5QcMc7XB98seK5AgyRx4zsTcFwNiWcVUMMl7S54bbvCP DrenWXOdDxDMGMFWh8h9KHcGB5yfEt4R3D5qT3Z2K/LWtQo/23pzuUK686yclfSzNxA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cmss.chinamobile.com; spf=pass smtp.mailfrom=cmss.chinamobile.com; dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=XJS66FoB; arc=none smtp.remote-ip=111.22.67.135 Received: from cmccmta2.chinamobile.com (cmccmta2.chinamobile.com [111.22.67.135]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF83D606A320 for ; Tue, 1 Dec 2026 08:28:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CF83D606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmss.chinamobile.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmss.chinamobile.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) 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; 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-app03-12003 (RichMail) with SMTP id 2ee36b0e8516029-5060b; Tue, 01 Dec 2026 16:28:06 +0800 (CST) X-RM-TRANSID:2ee36b0e8516029-5060b 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> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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