diff options
author | Marc Zyngier <maz@kernel.org> | 2020-05-05 17:09:53 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-05-20 09:18:52 +0300 |
commit | 11b6715f971f9731a33d9396fa31df4ce1a36df3 (patch) | |
tree | 1cb6807b9a7c5a0c08de900fa07235108de8cc2b /drivers/clk | |
parent | eea2b01912c140a3003bb84082c686e5065a33bb (diff) | |
download | linux-11b6715f971f9731a33d9396fa31df4ce1a36df3.tar.xz |
clk: Unlink clock if failed to prepare or enable
commit 018d4671b9bbd4a5c55cf6eab3e1dbc70a50b66e upstream.
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 <maz@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Link: https://lkml.kernel.org/r/20200505140953.409430-1-maz@kernel.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/clk')
-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 71621a171f8a..a102eb1abe4b 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3105,6 +3105,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) |