diff mbox series

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

Message ID 20240408151700.1761009-1-festevam@gmail.com (mailing list archive)
State Superseded
Headers show
Series usb: misc: onboard_usb_hub: Disable the USB hub clock on failure | expand

Commit Message

Fabio Estevam April 8, 2024, 3:17 p.m. UTC
From: Fabio Estevam <festevam@denx.de>

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 <festevam@denx.de>
---
 drivers/usb/misc/onboard_usb_dev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Frieder Schrempf April 8, 2024, 3:36 p.m. UTC | #1
On 08.04.24 17:17, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> 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 <festevam@denx.de>

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 <frieder.schrempf@kontron.de>

> ---
>  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)
Matthias Kaehlcke April 8, 2024, 5:12 p.m. UTC | #2
On Mon, Apr 8, 2024 at 8:17 AM Fabio Estevam <festevam@gmail.com> wrote:
>
> From: Fabio Estevam <festevam@denx.de>
>
> 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 <festevam@denx.de>

Acked-by: Matthias Kaehlcke <mka@chromium.org>
Greg Kroah-Hartman April 9, 2024, 3:29 p.m. UTC | #3
On Mon, Apr 08, 2024 at 12:17:00PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> 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 <festevam@denx.de>
> ---
>  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
Matthias Kaehlcke April 9, 2024, 4:42 p.m. UTC | #4
On Tue, Apr 9, 2024 at 8:29 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Mon, Apr 08, 2024 at 12:17:00PM -0300, Fabio Estevam wrote:
> > From: Fabio Estevam <festevam@denx.de>
> >
> > 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 <festevam@denx.de>
> > ---
> >  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.
Greg Kroah-Hartman April 11, 2024, 12:18 p.m. UTC | #5
On Tue, Apr 09, 2024 at 09:42:43AM -0700, Matthias Kaehlcke wrote:
> On Tue, Apr 9, 2024 at 8:29 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Mon, Apr 08, 2024 at 12:17:00PM -0300, Fabio Estevam wrote:
> > > From: Fabio Estevam <festevam@denx.de>
> > >
> > > 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 <festevam@denx.de>
> > > ---
> > >  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
diff mbox series

Patch

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)