Skip to content

Commit

Permalink
usb: misc: onboard_usb_hub: Disable the USB hub clock on failure
Browse files Browse the repository at this point in the history
commit 34b990e upstream.

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

Fix it accordingly.

Fixes: 65e62b8 ("usb: misc: onboard_usb_hub: Add support for clock input")
Cc: stable <stable@kernel.org>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Acked-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20240409162910.2061640-1-festevam@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Fabio Estevam authored and gregkh committed Apr 27, 2024
1 parent 026e1f0 commit fa5590c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/usb/misc/onboard_usb_hub.c
Expand Up @@ -78,7 +78,7 @@ static int onboard_hub_power_on(struct onboard_hub *hub)
err = regulator_bulk_enable(hub->pdata->num_supplies, hub->supplies);
if (err) {
dev_err(hub->dev, "failed to enable supplies: %pe\n", ERR_PTR(err));
return err;
goto disable_clk;
}

fsleep(hub->pdata->reset_us);
Expand All @@ -87,6 +87,10 @@ static int onboard_hub_power_on(struct onboard_hub *hub)
hub->is_powered_on = true;

return 0;

disable_clk:
clk_disable_unprepare(hub->clk);
return err;
}

static int onboard_hub_power_off(struct onboard_hub *hub)
Expand Down

0 comments on commit fa5590c

Please sign in to comment.