All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: ohci-spear: check clk_prepare_enable in probe
@ 2026-10-26 13:40 Tang Bin
  2026-10-26 13:44 ` sashiko-bot
  2026-10-26 14:32 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: Tang Bin @ 2026-10-26 13:40 UTC (permalink / raw)
  To: stern, gregkh; +Cc: linux-usb, linux-kernel, tangbin

spear_ohci_hcd_drv_probe() ignored the return of
clk_prepare_enable(sohci_p->clk). On failure usb_add_hcd() runs unclocked
and the error path clk_disable_unprepare() would unbalance the count. Check
the return and bail to err_put_hcd on failure.

Fixes: 1cc6ac59ffaa ("USB: OHCI: make ohci-spear a separate driver")
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/usb/host/ohci-spear.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index 5aeabb051..9d93b3f86 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -80,7 +80,9 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev)
 	sohci_p = to_spear_ohci(hcd);
 	sohci_p->clk = usbh_clk;
 
-	clk_prepare_enable(sohci_p->clk);
+	retval = clk_prepare_enable(sohci_p->clk);
+	if (retval)
+		goto err_put_hcd;
 
 	retval = usb_add_hcd(hcd, irq, 0);
 	if (retval == 0) {
-- 
2.52.0.windows.1




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

* Re: [PATCH] USB: ohci-spear: check clk_prepare_enable in probe
  2026-10-26 13:40 [PATCH] USB: ohci-spear: check clk_prepare_enable in probe Tang Bin
@ 2026-10-26 13:44 ` sashiko-bot
  2026-10-26 14:32 ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-10-26 13:44 UTC (permalink / raw)
  To: Tang Bin; +Cc: linux-usb

> spear_ohci_hcd_drv_probe() ignored the return of
> clk_prepare_enable(sohci_p->clk). On failure usb_add_hcd() runs unclocked
> and the error path clk_disable_unprepare() would unbalance the count. Check
> the return and bail to err_put_hcd on failure.
> 
> Fixes: 1cc6ac59ffaa ("USB: OHCI: make ohci-spear a separate driver")
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261026134019.3020-1-tangbin@cmss.chinamobile.com?part=1


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

* Re: [PATCH] USB: ohci-spear: check clk_prepare_enable in probe
  2026-10-26 13:40 [PATCH] USB: ohci-spear: check clk_prepare_enable in probe Tang Bin
  2026-10-26 13:44 ` sashiko-bot
@ 2026-10-26 14:32 ` Greg KH
  2026-10-27  9:23   ` [PATCH v2] " Tang Bin
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2026-10-26 14:32 UTC (permalink / raw)
  To: Tang Bin; +Cc: stern, linux-usb, linux-kernel

On Mon, Oct 26, 2026 at 09:40:19PM +0800, Tang Bin wrote:
> spear_ohci_hcd_drv_probe() ignored the return of
> clk_prepare_enable(sohci_p->clk). On failure usb_add_hcd() runs unclocked
> and the error path clk_disable_unprepare() would unbalance the count. Check
> the return and bail to err_put_hcd on failure.
> 
> Fixes: 1cc6ac59ffaa ("USB: OHCI: make ohci-spear a separate driver")
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>

How was this found and tested?

And no cc: stable?

thanks,

greg k-h

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

* [PATCH v2] USB: ohci-spear: check clk_prepare_enable in probe
  2026-10-26 14:32 ` Greg KH
@ 2026-10-27  9:23   ` Tang Bin
  2026-10-27  9:25     ` sashiko-bot
  0 siblings, 1 reply; 5+ messages in thread
From: Tang Bin @ 2026-10-27  9:23 UTC (permalink / raw)
  To: gregkh; +Cc: stern, linux-usb, linux-kernel, tangbin, stable

spear_ohci_hcd_drv_probe() ignored the return of
clk_prepare_enable(sohci_p->clk). On failure usb_add_hcd() runs unclocked
and the error path clk_disable_unprepare() would unbalance the count. Check
the return and bail to err_put_hcd on failure.

Fixes: 1cc6ac59ffaa ("USB: OHCI: make ohci-spear a separate driver")
Cc: stable@vger.kernel.org
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
Changes in v2:
- Added Cc: stable@vger.kernel.org as suggested by Greg KH.
- Found by code inspection comparing with ehci-spear.c (which already has this fix).
- Compile-tested only, no physical hardware available.

 drivers/usb/host/ohci-spear.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index 5aeabb051..9d93b3f86 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -80,7 +80,9 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev)
 	sohci_p = to_spear_ohci(hcd);
 	sohci_p->clk = usbh_clk;
 
-	clk_prepare_enable(sohci_p->clk);
+	retval = clk_prepare_enable(sohci_p->clk);
+	if (retval)
+		goto err_put_hcd;
 
 	retval = usb_add_hcd(hcd, irq, 0);
 	if (retval == 0) {
-- 
2.52.0.windows.1




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

* Re: [PATCH v2] USB: ohci-spear: check clk_prepare_enable in probe
  2026-10-27  9:23   ` [PATCH v2] " Tang Bin
@ 2026-10-27  9:25     ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-10-27  9:25 UTC (permalink / raw)
  To: Tang Bin; +Cc: linux-usb

> spear_ohci_hcd_drv_probe() ignored the return of
> clk_prepare_enable(sohci_p->clk). On failure usb_add_hcd() runs unclocked
> and the error path clk_disable_unprepare() would unbalance the count. Check
> the return and bail to err_put_hcd on failure.
> 
> Fixes: 1cc6ac59ffaa ("USB: OHCI: make ohci-spear a separate driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261027092354.1761-1-tangbin@cmss.chinamobile.com?part=1


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

end of thread, other threads:[~2026-10-27  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-26 13:40 [PATCH] USB: ohci-spear: check clk_prepare_enable in probe Tang Bin
2026-10-26 13:44 ` sashiko-bot
2026-10-26 14:32 ` Greg KH
2026-10-27  9:23   ` [PATCH v2] " Tang Bin
2026-10-27  9:25     ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.