linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: scpi: error when clock fails to register
@ 2017-06-28 13:53 Jerome Brunet
  2017-06-28 15:04 ` Sudeep Holla
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jerome Brunet @ 2017-06-28 13:53 UTC (permalink / raw)
  To: linux-arm-kernel

Current implementation of scpi_clk_add just print a warning when clock
fails to register but then keep going as if nothing happened. The
provider is then registered with bogus data.

This may latter lead to an Oops in __clk_create_clk when
hlist_add_head(&clk->clks_node, &hw->core->clks) is called.

This patch fixes the issue and errors if a clock fails to register.

Fixes: cd52c2a4b5c4 ("clk: add support for clocks provided by SCP(System Control Processor)")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 drivers/clk/clk-scpi.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk-scpi.c b/drivers/clk/clk-scpi.c
index 96d37175d0ad..e44b5ca91fed 100644
--- a/drivers/clk/clk-scpi.c
+++ b/drivers/clk/clk-scpi.c
@@ -245,10 +245,12 @@ static int scpi_clk_add(struct device *dev, struct device_node *np,
 		sclk->id = val;
 
 		err = scpi_clk_ops_init(dev, match, sclk, name);
-		if (err)
+		if (err) {
 			dev_err(dev, "failed to register clock '%s'\n", name);
-		else
-			dev_dbg(dev, "Registered clock '%s'\n", name);
+			return err;
+		}
+
+		dev_dbg(dev, "Registered clock '%s'\n", name);
 		clk_data->clk[idx] = sclk;
 	}
 
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-06-30  0:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-28 13:53 [PATCH] clk: scpi: error when clock fails to register Jerome Brunet
2017-06-28 15:04 ` Sudeep Holla
2017-06-28 15:38   ` Jerome Brunet
2017-06-28 15:52     ` Sudeep Holla
2017-06-28 16:46       ` Jerome Brunet
2017-06-28 17:07         ` Sudeep Holla
2017-06-28 22:33           ` Stephen Boyd
2017-06-29  8:50           ` Jerome Brunet
2017-06-29  9:12             ` Sudeep Holla
2017-06-29  9:03 ` Sudeep Holla
2017-06-30  0:25 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).