[PATCH] usb: typec: hd3ss3220: fix VBUS regulator error message

raoxu posted 1 patch 1 month, 3 weeks ago
There is a newer version of this series
drivers/usb/typec/hd3ss3220.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] usb: typec: hd3ss3220: fix VBUS regulator error message
Posted by raoxu 1 month, 3 weeks ago
From: Xu Rao <raoxu@uniontech.com>

hd3ss3220_regulator_control() enables the VBUS regulator when @on is
true and disables it when @on is false.  However, its error message uses
the opposite operation name, so an enable failure is reported as a
disable failure and vice versa.

Print the operation that was actually attempted.  Reporting the opposite
regulator operation on failures can mislead debugging of VBUS problems.

Fixes: 27fbc19e52b9 ("usb: typec: hd3ss3220: Enable VBUS based on role state")
Signed-off-by: Xu Rao <raoxu@uniontech.com>
---
 drivers/usb/typec/hd3ss3220.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c
index 3e39b800e6b5..d0de5a2488f9 100644
--- a/drivers/usb/typec/hd3ss3220.c
+++ b/drivers/usb/typec/hd3ss3220.c
@@ -218,7 +218,7 @@ static void hd3ss3220_regulator_control(struct hd3ss3220 *hd3ss3220, bool on)
 
 	if (ret)
 		dev_err(hd3ss3220->dev,
-			"vbus regulator %s failed: %d\n", on ? "disable" : "enable", ret);
+			"vbus regulator %s failed: %d\n", on ? "enable" : "disable", ret);
 }
 
 static void hd3ss3220_set_role(struct hd3ss3220 *hd3ss3220)
-- 
2.50.1
Re: [PATCH] usb: typec: hd3ss3220: fix VBUS regulator error message
Posted by Heikki Krogerus 1 month, 2 weeks ago
On Fri, Aug 07, 2026 at 04:14:22PM +0800, raoxu wrote:
> From: Xu Rao <raoxu@uniontech.com>
> 
> hd3ss3220_regulator_control() enables the VBUS regulator when @on is
> true and disables it when @on is false.  However, its error message uses
> the opposite operation name, so an enable failure is reported as a
> disable failure and vice versa.
> 
> Print the operation that was actually attempted.  Reporting the opposite
> regulator operation on failures can mislead debugging of VBUS problems.
> 
> Fixes: 27fbc19e52b9 ("usb: typec: hd3ss3220: Enable VBUS based on role state")
> Signed-off-by: Xu Rao <raoxu@uniontech.com>

Please CC stable. With that fixed:

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/hd3ss3220.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c
> index 3e39b800e6b5..d0de5a2488f9 100644
> --- a/drivers/usb/typec/hd3ss3220.c
> +++ b/drivers/usb/typec/hd3ss3220.c
> @@ -218,7 +218,7 @@ static void hd3ss3220_regulator_control(struct hd3ss3220 *hd3ss3220, bool on)
>  
>  	if (ret)
>  		dev_err(hd3ss3220->dev,
> -			"vbus regulator %s failed: %d\n", on ? "disable" : "enable", ret);
> +			"vbus regulator %s failed: %d\n", on ? "enable" : "disable", ret);
>  }
>  
>  static void hd3ss3220_set_role(struct hd3ss3220 *hd3ss3220)
> -- 
> 2.50.1

-- 
heikki