Commit 34b990e9 authored by Fabio Estevam's avatar Fabio Estevam Committed by Greg Kroah-Hartman

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

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

Fix it accordingly.

Fixes: 65e62b8a ("usb: misc: onboard_usb_hub: Add support for clock input")
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarFabio Estevam <festevam@denx.de>
Reviewed-by: default avatarFrieder Schrempf <frieder.schrempf@kontron.de>
Acked-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20240409162910.2061640-1-festevam@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eed04fa9
...@@ -78,7 +78,7 @@ static int onboard_hub_power_on(struct onboard_hub *hub) ...@@ -78,7 +78,7 @@ static int onboard_hub_power_on(struct onboard_hub *hub)
err = regulator_bulk_enable(hub->pdata->num_supplies, hub->supplies); err = regulator_bulk_enable(hub->pdata->num_supplies, hub->supplies);
if (err) { if (err) {
dev_err(hub->dev, "failed to enable supplies: %pe\n", ERR_PTR(err)); dev_err(hub->dev, "failed to enable supplies: %pe\n", ERR_PTR(err));
return err; goto disable_clk;
} }
fsleep(hub->pdata->reset_us); fsleep(hub->pdata->reset_us);
...@@ -87,6 +87,10 @@ static int onboard_hub_power_on(struct onboard_hub *hub) ...@@ -87,6 +87,10 @@ static int onboard_hub_power_on(struct onboard_hub *hub)
hub->is_powered_on = true; hub->is_powered_on = true;
return 0; return 0;
disable_clk:
clk_disable_unprepare(hub->clk);
return err;
} }
static int onboard_hub_power_off(struct onboard_hub *hub) static int onboard_hub_power_off(struct onboard_hub *hub)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment