Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DC1541687C; Sat, 12 Sep 2026 08:37:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789202257; cv=none; b=XdnEKhas8f3ipC5OR8z3DwOXg/g2ek91UPvUdSfWynDqydZ637veaZZcPxv1scO1vxmM3JSdju+gY76ZG+ZBjlc4sZ8diWCPpYq846zd4egSNcNk5fmabWc5eotciSLYtuWE7z/VqeWDxRwt+a+BcCVNs/CF+7Zzei2EZ/+nqgA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789202257; c=relaxed/simple; bh=2hcI9Tc6uQ73Jh4dOU6YNWJ+kchOKT5W3xcFPQgfhDo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KO4DFCTWgUwJ2EbeJWe/cSZfHUA8vq/nTIgToWjARxwf2fpp3kuE5oHT34nQHFKs6oUFy7dGRa/E8lufg+zyly00YDIlvhyV2hOH0uiZQKAl83d9QGTF8kfLXjW6FLjCIFLtTWsCY2ZQBxxZSfksmE75JI58bVnw+fjt0L8Q+eM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Lqy1oAoL; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Lqy1oAoL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EA571F000FF; Sat, 12 Sep 2026 08:37:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789202255; bh=mFJ9tgjAn/3HSPI8cEEhyil+I7poJKw5+sGyDLlZ6Pg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Lqy1oAoL0WLO0G0y+UdWvwIviiF+1KLRnUvyhx7uoitx5hgQGFCMV8Kylp1nLV9wC s1eRU3HnOkCN6tNCQIY+pRi/4Y7FK7v1YANP8zmsk3ovfWFdPa+HdmaDtlGP/54SBM iU1hL7AQ7R9XQfLKodobLjSkWfOlTBZi3gv3JDBU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Biju Das , Vinod Koul , Sasha Levin Subject: [PATCH 7.2 1165/1815] phy: renesas: phy-rcar-gen3-usb2: Fix devm action registration for disabled VBUS regulator Date: Sat, 12 Sep 2026 08:48:35 +0200 Message-ID: <20260912065716.363832342@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065648.999753832@linuxfoundation.org> References: <20260912065648.999753832@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Biju Das [ Upstream commit 49c9b71b45081e5e5eeb507a2d6edb80d332dc59 ] devm_regulator_get_exclusive() initialises the regulator with enable_count = 1, requiring the consumer to disable it before release. The devm disable action was previously only registered when the caller explicitly requested enable, so when the regulator was left in its initial enabled state without an explicit enable call, the cleanup path skipped decrementing enable_count, triggering a WARN_ON during regulator release on device removal. Fix this by always registering the devm disable action based on the actual enabled state via regulator_is_enabled(), regardless of whether the caller requested an explicit enable. This covers both the explicitly enabled case and the initial state set by devm_regulator_get_exclusive(). Fixes: 24843404efe4 ("phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs") Signed-off-by: Biju Das Link: https://patch.msgid.link/20260806102236.149159-9-biju.das.jz@bp.renesas.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c index 9a45d840efeb2..1a823deb6eb11 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -901,15 +901,17 @@ static int rcar_gen3_phy_usb2_vbus_regulator_get_exclusive_enable(struct rcar_ge if (IS_ERR(channel->vbus)) return PTR_ERR(channel->vbus); - if (!enable) - return 0; + if (enable) { + ret = regulator_enable(channel->vbus); + if (ret) + return ret; + } - ret = regulator_enable(channel->vbus); - if (ret) - return ret; + if (regulator_is_enabled(channel->vbus)) + return devm_add_action_or_reset(dev, rcar_gen3_phy_usb2_vbus_disable_action, + channel->vbus); - return devm_add_action_or_reset(dev, rcar_gen3_phy_usb2_vbus_disable_action, - channel->vbus); + return 0; } static int rcar_gen3_phy_usb2_vbus_regulator_register(struct rcar_gen3_chan *channel) -- 2.53.0