Skip to content

Commit 018d467

Browse files
Marc Zyngierbebarino
authored andcommitted
clk: Unlink clock if failed to prepare or enable
On failing to prepare or enable a clock, remove the core structure from the list it has been inserted as it is about to be freed. This otherwise leads to random crashes when subsequent clocks get registered, during which parsing of the clock tree becomes adventurous. Observed with QEMU's RPi-3 emulation. Fixes: 12ead77 ("clk: Don't try to enable critical clocks if prepare failed") Signed-off-by: Marc Zyngier <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Stephen Boyd <[email protected]> Cc: Michael Turquette <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent ca6df49 commit 018d467

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/clk/clk.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3519,6 +3519,9 @@ static int __clk_core_init(struct clk_core *core)
35193519
out:
35203520
clk_pm_runtime_put(core);
35213521
unlock:
3522+
if (ret)
3523+
hlist_del_init(&core->child_node);
3524+
35223525
clk_prepare_unlock();
35233526

35243527
if (!ret)

0 commit comments

Comments
 (0)