summary refs log tree commit diff
path: root/drivers/clk
diff options
context:
space:
mode:
authorRajan Vaja <rajan.vaja@xilinx.com>2018-07-17 06:17:00 -0700
committerStephen Boyd <sboyd@kernel.org>2018-07-25 09:36:46 -0700
commitf6dab4233d6b64d719109040503b567f71fbfa01 (patch)
treefe98a4194d5d02d2ece5aa3750d5dda4c61e9887 /drivers/clk
parentce397d215ccd07b8ae3f71db689aedb85d56ab40 (diff)
downloadlinux-f6dab4233d6b64d719109040503b567f71fbfa01.tar.gz
clk: clk-fixed-factor: Clear OF_POPULATED flag in case of failure
Fixed factor clock has two initializations at of_clk_init() time
and during platform driver probe. Before of_clk_init() call,
node is marked as populated and so its probe never gets called.

During of_clk_init() fixed factor clock registration may fail if
any of its parent clock is not registered. In this case, it doesn't
get chance to retry registration from probe. Clear OF_POPULATED
flag if fixed factor clock registration fails so that clock
registration is attempted again from probe.

Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/clk-fixed-factor.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
index a5d402de5584..20724abd38bd 100644
--- a/drivers/clk/clk-fixed-factor.c
+++ b/drivers/clk/clk-fixed-factor.c
@@ -177,8 +177,15 @@ static struct clk *_of_fixed_factor_clk_setup(struct device_node *node)
 
 	clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags,
 					mult, div);
-	if (IS_ERR(clk))
+	if (IS_ERR(clk)) {
+		/*
+		 * If parent clock is not registered, registration would fail.
+		 * Clear OF_POPULATED flag so that clock registration can be
+		 * attempted again from probe function.
+		 */
+		of_node_clear_flag(node, OF_POPULATED);
 		return clk;
+	}
 
 	ret = of_clk_add_provider(node, of_clk_src_simple_get, clk);
 	if (ret) {