Skip to content

Commit 3b49613

Browse files
Yuuoniygregkh
authored andcommitted
usb: dwc3: of-simple: fix clock resource leak in dwc3_of_simple_probe
When clk_bulk_prepare_enable() fails, the error path jumps to err_resetc_assert, skipping clk_bulk_put_all() and leaking the clock references acquired by clk_bulk_get_all(). Add err_clk_put_all label to properly release clock resources in all error paths. Found via static analysis and code review. Fixes: c0c6147 ("usb: dwc3: of-simple: Convert to bulk clk API") Cc: stable <stable@kernel.org> Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://patch.msgid.link/20251211064937.2360510-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 14ad4c1 commit 3b49613

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/usb/dwc3/dwc3-of-simple.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,21 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
7070
simple->num_clocks = ret;
7171
ret = clk_bulk_prepare_enable(simple->num_clocks, simple->clks);
7272
if (ret)
73-
goto err_resetc_assert;
73+
goto err_clk_put_all;
7474

7575
ret = of_platform_populate(np, NULL, NULL, dev);
7676
if (ret)
77-
goto err_clk_put;
77+
goto err_clk_disable;
7878

7979
pm_runtime_set_active(dev);
8080
pm_runtime_enable(dev);
8181
pm_runtime_get_sync(dev);
8282

8383
return 0;
8484

85-
err_clk_put:
85+
err_clk_disable:
8686
clk_bulk_disable_unprepare(simple->num_clocks, simple->clks);
87+
err_clk_put_all:
8788
clk_bulk_put_all(simple->num_clocks, simple->clks);
8889

8990
err_resetc_assert:

0 commit comments

Comments
 (0)