diff options
author | Marc Zyngier <[email protected]> | 2020-05-05 15:09:53 +0100 |
---|---|---|
committer | Stephen Boyd <[email protected]> | 2020-05-05 12:12:00 -0700 |
commit | 018d4671b9bbd4a5c55cf6eab3e1dbc70a50b66e (patch) | |
tree | a96b8b60c1687d35586a6729a470d9cc3254a0ef | |
parent | ca6df49d62d7cc4c1653a4d9b1ecc61ecd530e02 (diff) |
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: 12ead77432f2 ("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]>
-rw-r--r-- | drivers/clk/clk.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 39c59f063aa0..2dfb30b963c4 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3519,6 +3519,9 @@ static int __clk_core_init(struct clk_core *core) out: clk_pm_runtime_put(core); unlock: + if (ret) + hlist_del_init(&core->child_node); + clk_prepare_unlock(); if (!ret) |