LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure
@ 2024-04-08 15:17 Fabio Estevam
  2024-04-08 15:36 ` Frieder Schrempf
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fabio Estevam @ 2024-04-08 15:17 UTC (permalink / raw
  To: gregkh; +Cc: mka, frieder.schrempf, linux-usb, linux-kernel, Fabio Estevam

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(-)

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure
  2024-04-08 15:17 [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure Fabio Estevam
@ 2024-04-08 15:36 ` Frieder Schrempf
  2024-04-08 17:12 ` Matthias Kaehlcke
  2024-04-09 15:29 ` Greg KH
  2 siblings, 0 replies; 6+ messages in thread
From: Frieder Schrempf @ 2024-04-08 15:36 UTC (permalink / raw
  To: Fabio Estevam, gregkh; +Cc: mka, linux-usb, linux-kernel, Fabio Estevam

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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure
  2024-04-08 15:17 [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure Fabio Estevam
  2024-04-08 15:36 ` Frieder Schrempf
@ 2024-04-08 17:12 ` Matthias Kaehlcke
  2024-04-09 15:29 ` Greg KH
  2 siblings, 0 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2024-04-08 17:12 UTC (permalink / raw
  To: Fabio Estevam
  Cc: gregkh, frieder.schrempf, linux-usb, linux-kernel, Fabio Estevam

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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure
  2024-04-08 15:17 [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure Fabio Estevam
  2024-04-08 15:36 ` Frieder Schrempf
  2024-04-08 17:12 ` Matthias Kaehlcke
@ 2024-04-09 15:29 ` Greg KH
  2024-04-09 16:42   ` Matthias Kaehlcke
  2 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2024-04-09 15:29 UTC (permalink / raw
  To: Fabio Estevam
  Cc: mka, frieder.schrempf, linux-usb, linux-kernel, Fabio Estevam

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure
  2024-04-09 15:29 ` Greg KH
@ 2024-04-09 16:42   ` Matthias Kaehlcke
  2024-04-11 12:18     ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Matthias Kaehlcke @ 2024-04-09 16:42 UTC (permalink / raw
  To: Greg KH
  Cc: Fabio Estevam, frieder.schrempf, linux-usb, linux-kernel,
	Fabio Estevam

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure
  2024-04-09 16:42   ` Matthias Kaehlcke
@ 2024-04-11 12:18     ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2024-04-11 12:18 UTC (permalink / raw
  To: Matthias Kaehlcke
  Cc: Fabio Estevam, frieder.schrempf, linux-usb, linux-kernel,
	Fabio Estevam

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-11 12:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-08 15:17 [PATCH] usb: misc: onboard_usb_hub: Disable the USB hub clock on failure Fabio Estevam
2024-04-08 15:36 ` Frieder Schrempf
2024-04-08 17:12 ` Matthias Kaehlcke
2024-04-09 15:29 ` Greg KH
2024-04-09 16:42   ` Matthias Kaehlcke
2024-04-11 12:18     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).