From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=111.22.67.139 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796196743; b=4Z1zljqruZ/X5bokYfU48io6eHauO8cc8bmFkowahFF04okryUoJQMnuq46ZB5rKP0bg TpinOMvVWsQ4aoQaYdqXnBHWLEhax25HVeEuwfFti+TnZu+lJueJiodwfA4ag7g3sQkE4 /mFUyc/MFd/MgTBHa12h+TGzXmd6l0fd2xbS6BfSJLJs1vJTeEn/k+i+Jp4C+s+FyXXSN XAp6adQq8TcovMVNT8GKbu/tABEzM6Chb3FLkXLsXsUFj3rfwgpBp/MBsJCInEX6sjGDS XOKzBnfFtQwh5j83BcwL2KY6FZseCstClSCCwvmgn5YhhrO9ipiI6auPZeBEF74duFg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796196743; 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=uIG1qjdX9WGvLiitFg5U72UTJwgN5GQPXQWB43oHcw4=; b=D/BFCIo+D0r3RVvSUI1qdd4QlZCz4cPmPW2z8aAA/mZc1/UPMevGwtLe7DcP2rX8NSBj 8GPfAO1CapwBqRJYD70l39pNX03fic4A6NPpMliHU5NXSnXk/4/dbisj2R7sXuL7Sl/RL t9XUtms65UEKYleSxpi87fltaf0rAwv6p2o7rxYtDDojF9x2TLFCercuul4St23vC9HeE faGyDAAEoTcgGfB0xtBYWqT6Bf0nE7h8DOI1CVaYDtDCwNY6dfnbh+aZ8ACDNY1lMVH5+ gHiMEZiCeu37gTKYicpcB/JYzWOxeTxPKNU3I61W8ErvyU+VR6IHrz8uZfwI9ut96Bw== 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=UtY5TxU7; arc=none smtp.remote-ip=111.22.67.139 Received: from cmccmta6.chinamobile.com (cmccmta6.chinamobile.com [111.22.67.139]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BDF01606A323 for ; Wed, 2 Dec 2026 07:32:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BDF01606A323 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=UtY5TxU7 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=UtY5TxU7H8LaUx8c5xKWh3uNmILS4aIFzaCTjN0qUxrEhD1Q5pEaRErxbuQxovVZWpfoNHDiLx8Vi aRv88tE2HpenYdymuK8WEEo5Nrp0ef1e3UZn6HNIt2a8pqTNsclgNK1+YCGDCqbmfdoOl4JYFeQMIA R0MsiCdN/3tZXicA= 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-app09-12009 (RichMail) with SMTP id 2ee96b0fc97a778-9386e; Wed, 02 Dec 2026 15:32:12 +0800 (CST) X-RM-TRANSID:2ee96b0fc97a778-9386e X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG:00000000 Received:from [198.18.0.98] (unknown[223.108.79.102]) by rmsmtp-syy-appsvr09-12009 (RichMail) with SMTP id 2ee96b0fc97badd-3c77c; Wed, 02 Dec 2026 15:32:12 +0800 (CST) X-RM-TRANSID:2ee96b0fc97badd-3c77c 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, sebastian.reichel@collabora.com Subject: [PATCH v3] phy: rockchip-usb: fix reset control leak Date: Wed, 02 Dec 2026 15:32:10 +0800 Message-ID: <20261202073210.a9da63275a6d9eff.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_exclusive() 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 --- Changes in v3: - Use devm_reset_control_get_exclusive() as suggested by Sebastian Reichel. This replaces the deprecated wrapper used in v2 and keeps the same exclusive reset semantics and device-managed lifetime. Changes in v2: - Drop the stable Cc as requested by Manivannan Sadhasivam. - Get the reset through the PHY device after devm_phy_create(), replacing the custom reset_control_put() action from v1. v2: https://lore.kernel.org/linux-phy/20261201082805.50160d227cb63d84.patch@cmss.chinamobile.com/ Review: https://lore.kernel.org/linux-phy/aw9loPglDzKaZI6u@venus/ v1: https://lore.kernel.org/linux-phy/20261115042640.426517-1-yanxia@cmss.chinamobile.com/ drivers/phy/rockchip/phy-rockchip-usb.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-usb.c b/drivers/phy/rockchip/phy-rockchip-usb.c index c5a2853a63d3..b61dffd1b7a6 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,11 @@ 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_exclusive(&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