Skip to contentSkip to conversation

usb: misc: onboard_usb_hub: Disable the USB hub clock on failure

PATCH Superseded Fabio Estevam 4 participants 6 messages Apr 8, 2024 – Apr 11, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: misc: onboard_usb_hub: Disable the USB hub clock on failure

From: Fabio Estevam <[email protected]>

In case regulator_bulk_enable() fails, the previously enabled USB hub clock should be disabled.

Fix it accordingly.

Fixes 65e62b8a955a ("usb: misc: onboard_usb_hub: Add support for clock input")
---
 drivers/usb/misc/onboard_usb_dev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/misc/onboard_usb_dev.c +5 -1
index 648ea933bdad..f2bcc1a8b95f 100644
@@ -93,7 +93,7 @@ static int onboard_dev_power_on(struct onboard_dev *onboard_dev)
 	if (err) {
 		dev_err(onboard_dev->dev, "failed to enable supplies: %pe\n",
 			ERR_PTR(err));
-		return err;
+		goto disable_clk;
 	}
 
 	fsleep(onboard_dev->pdata->reset_us);
@@ -102,6 +102,10 @@ static int onboard_dev_power_on(struct onboard_dev *onboard_dev)
 	onboard_dev->is_powered_on = true;
 
 	return 0;
+
+disable_clk:
+	clk_disable_unprepare(onboard_dev->clk);
+	return err;
 }
 
 static int onboard_dev_power_off(struct onboard_dev *onboard_dev)
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

In case regulator_bulk_enable() fails, the previously enabled USB hub clock should be disabled.

Fix it accordingly.

Fixes 65e62b8a955a ("usb: misc: onboard_usb_hub: Add support for clock input")

Oops, sorry. I totally missed that when I was porting the patch from a downstream tree that didn't have the regulator code path.

Thanks for fixing!

Quoted 28 lines
---
 drivers/usb/misc/onboard_usb_dev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/misc/onboard_usb_dev.c +5 -1
index 648ea933bdad..f2bcc1a8b95f 100644
@@ -93,7 +93,7 @@ static int onboard_dev_power_on(struct onboard_dev *onboard_dev)
 	if (err) {
 		dev_err(onboard_dev->dev, "failed to enable supplies: %pe\n",
 			ERR_PTR(err));
-		return err;
+		goto disable_clk;
 	}
 
 	fsleep(onboard_dev->pdata->reset_us);
@@ -102,6 +102,10 @@ static int onboard_dev_power_on(struct onboard_dev *onboard_dev)
 	onboard_dev->is_powered_on = true;
 
 	return 0;
+
+disable_clk:
+	clk_disable_unprepare(onboard_dev->clk);
+	return err;
 }
 
 static int onboard_dev_power_off(struct onboard_dev *onboard_dev)
maintainer
#3 lore raw
In reply to Fabio Estevam
Quoted 11 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

In case regulator_bulk_enable() fails, the previously enabled USB hub clock should be disabled.

Fix it accordingly.

Fixes 65e62b8a955a ("usb: misc: onboard_usb_hub: Add support for clock input")
---
 drivers/usb/misc/onboard_usb_dev.c | 6 +++++-

This file is not in the tree for 6.9-rc2, can you please fix this up and resend?

thanks,

greg k-h

#4 lore raw
Quoted 9 lines · Greg KH
Quoted 7 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

In case regulator_bulk_enable() fails, the previously enabled USB hub clock should be disabled.

Fix it accordingly.

Quoted 7 lines
Quoted 4 lines
Fixes 65e62b8a955a ("usb: misc: onboard_usb_hub: Add support for clock input")
---
 drivers/usb/misc/onboard_usb_dev.c | 6 +++++-

This file is not in the tree for 6.9-rc2, can you please fix this up and resend?

The driver has been renamed in usb-next. Shouldn't this patch be based on usb-next and the backports to stable kernels account for the name change? v6.9 sits a bit in between, since there is no stable branch yet. The fix doesn't seem super-critical, I guess it would be ok to leave v6.9 as is for now and add the fix once there is a stable branch for it.

maintainer
#5 lore raw
Quoted 15 lines · Matthias Kaehlcke
Quoted 14 lines · Greg KH
Quoted 11 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

In case regulator_bulk_enable() fails, the previously enabled USB hub clock should be disabled.

Fix it accordingly.

Fixes 65e62b8a955a ("usb: misc: onboard_usb_hub: Add support for clock input")
---
 drivers/usb/misc/onboard_usb_dev.c | 6 +++++-
Quoted 6 lines
Quoted 2 lines

This file is not in the tree for 6.9-rc2, can you please fix this up and resend?

The driver has been renamed in usb-next. Shouldn't this patch be based on usb-next and the backports to stable kernels account for the name change?

If you want to wait a few weeks for this fix to get in, sure. Otherwise no.

thanks,

greg k-h