* [PATCH] USB: ohci-spear: check clk_prepare_enable in probe
@ 2026-10-26 13:40 Tang Bin
2026-10-26 14:32 ` Greg KH
0 siblings, 1 reply; 2+ 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 [flat|nested] 2+ 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 14:32 ` Greg KH
0 siblings, 0 replies; 2+ 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] 2+ messages in thread
end of thread, other threads:[~2026-10-26 14:32 UTC | newest]
Thread overview: 2+ 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 14:32 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®