Linux-Clk Archive on
 help / color / Atom feed
From: Marc Zyngier <>
Cc: Guenter Roeck <>,
	Stephen Boyd <>,
	Michael Turquette <>
Subject: [PATCH] clk: Unlink clock if failed to prepare or enable
Date: Tue,  5 May 2020 15:09:53 +0100
Message-ID: <> (raw)

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 <>
Cc: Guenter Roeck <>
Cc: Stephen Boyd <>
Cc: Michael Turquette <>
 drivers/clk/clk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index b34fc1d3a594..752e8eef3f55 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3522,6 +3522,9 @@ static int __clk_core_init(struct clk_core *core)
+	if (ret)
+		hlist_del_init(&core->child_node);
 	if (!ret)

             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 14:09 Marc Zyngier [this message]
2020-05-05 19:12 ` Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Clk Archive on

Archives are clonable:
	git clone --mirror linux-clk/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-clk linux-clk/ \
	public-inbox-index linux-clk

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone