2024-04-08 15:17:23

by Fabio Estevam

[permalink] [raw]
Subject: [PATCH] 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")
Signed-off-by: Fabio Estevam <[email protected]>
---
drivers/usb/misc/onboard_usb_dev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c
index 648ea933bdad..f2bcc1a8b95f 100644
--- a/drivers/usb/misc/onboard_usb_dev.c
+++ b/drivers/usb/misc/onboard_usb_dev.c
@@ -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)
--
2.34.1



2024-04-08 15:36:54

by Frieder Schrempf

[permalink] [raw]
Subject: Re: [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure

On 08.04.24 17:17, Fabio Estevam wrote:
> 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")
> Signed-off-by: Fabio Estevam <[email protected]>

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!

Reviewed-by: Frieder Schrempf <[email protected]>

> ---
> drivers/usb/misc/onboard_usb_dev.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c
> index 648ea933bdad..f2bcc1a8b95f 100644
> --- a/drivers/usb/misc/onboard_usb_dev.c
> +++ b/drivers/usb/misc/onboard_usb_dev.c
> @@ -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)

2024-04-08 17:14:57

by Matthias Kaehlcke

[permalink] [raw]
Subject: Re: [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure

On Mon, Apr 8, 2024 at 8:17 AM Fabio Estevam <[email protected]> wrote:
>
> 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")
> Signed-off-by: Fabio Estevam <[email protected]>

Acked-by: Matthias Kaehlcke <[email protected]>

2024-04-09 15:42:15

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure

On Mon, Apr 08, 2024 at 12:17:00PM -0300, Fabio Estevam wrote:
> 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")
> Signed-off-by: Fabio Estevam <[email protected]>
> ---
> 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

2024-04-09 16:43:12

by Matthias Kaehlcke

[permalink] [raw]
Subject: Re: [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure

On Tue, Apr 9, 2024 at 8:29 AM Greg KH <[email protected]> wrote:
>
> On Mon, Apr 08, 2024 at 12:17:00PM -0300, Fabio Estevam wrote:
> > 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")
> > Signed-off-by: Fabio Estevam <[email protected]>
> > ---
> > 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.

2024-04-11 12:33:24

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure

On Tue, Apr 09, 2024 at 09:42:43AM -0700, Matthias Kaehlcke wrote:
> On Tue, Apr 9, 2024 at 8:29 AM Greg KH <[email protected]> wrote:
> >
> > On Mon, Apr 08, 2024 at 12:17:00PM -0300, Fabio Estevam wrote:
> > > 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")
> > > Signed-off-by: Fabio Estevam <[email protected]>
> > > ---
> > > 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?

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

thanks,

greg k-h