mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
usb: ehci-hcd: fix call balance of clocks handling routines
commit 97264eaaba0122a5b7e8ddd7bf4ff3ac57c2b170 upstream. If the clocks priv->iclk and priv->fclk were not enabled in ehci_hcd_sh_probe, they should not be disabled in any path. Conversely, if they was enabled in ehci_hcd_sh_probe, they must be disabled in all error paths to ensure proper cleanup. Found by Linux Verification Center (linuxtesting.org) with Klever. Fixes:63c8455222("usb: ehci-hcd: Add support for SuperH EHCI.") Cc: stable@vger.kernel.org #ff30bd6a66: sh: clk: Fix clk_enable() to return 0 on NULL clk Signed-off-by: Vitalii Mordan <mordan@ispras.ru> Reviewed-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/r/20241121114700.2100520-1-mordan@ispras.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e92f79d582
commit
02ceda7f64
@@ -120,8 +120,12 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
|
|||||||
if (IS_ERR(priv->iclk))
|
if (IS_ERR(priv->iclk))
|
||||||
priv->iclk = NULL;
|
priv->iclk = NULL;
|
||||||
|
|
||||||
clk_enable(priv->fclk);
|
ret = clk_enable(priv->fclk);
|
||||||
clk_enable(priv->iclk);
|
if (ret)
|
||||||
|
goto fail_request_resource;
|
||||||
|
ret = clk_enable(priv->iclk);
|
||||||
|
if (ret)
|
||||||
|
goto fail_iclk;
|
||||||
|
|
||||||
ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
|
ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -137,6 +141,7 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
fail_add_hcd:
|
fail_add_hcd:
|
||||||
clk_disable(priv->iclk);
|
clk_disable(priv->iclk);
|
||||||
|
fail_iclk:
|
||||||
clk_disable(priv->fclk);
|
clk_disable(priv->fclk);
|
||||||
|
|
||||||
fail_request_resource:
|
fail_request_resource:
|
||||||
|
|||||||
Reference in New Issue
Block a user