]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.129/clk-clk-fixed-factor-clear-of_populated-flag-in-case-of-failure.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.129 / clk-clk-fixed-factor-clear-of_populated-flag-in-case-of-failure.patch
CommitLineData
47f38bc9
GKH
1From foo@baz Fri Sep 21 09:36:02 CEST 2018
2From: Rajan Vaja <rajan.vaja@xilinx.com>
3Date: Tue, 17 Jul 2018 06:17:00 -0700
4Subject: clk: clk-fixed-factor: Clear OF_POPULATED flag in case of failure
5
6From: Rajan Vaja <rajan.vaja@xilinx.com>
7
8[ Upstream commit f6dab4233d6b64d719109040503b567f71fbfa01 ]
9
10Fixed factor clock has two initializations at of_clk_init() time
11and during platform driver probe. Before of_clk_init() call,
12node is marked as populated and so its probe never gets called.
13
14During of_clk_init() fixed factor clock registration may fail if
15any of its parent clock is not registered. In this case, it doesn't
16get chance to retry registration from probe. Clear OF_POPULATED
17flag if fixed factor clock registration fails so that clock
18registration is attempted again from probe.
19
20Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
21Signed-off-by: Stephen Boyd <sboyd@kernel.org>
22Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
23Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24---
25 drivers/clk/clk-fixed-factor.c | 9 ++++++++-
26 1 file changed, 8 insertions(+), 1 deletion(-)
27
28--- a/drivers/clk/clk-fixed-factor.c
29+++ b/drivers/clk/clk-fixed-factor.c
30@@ -177,8 +177,15 @@ static struct clk *_of_fixed_factor_clk_
31
32 clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags,
33 mult, div);
34- if (IS_ERR(clk))
35+ if (IS_ERR(clk)) {
36+ /*
37+ * If parent clock is not registered, registration would fail.
38+ * Clear OF_POPULATED flag so that clock registration can be
39+ * attempted again from probe function.
40+ */
41+ of_node_clear_flag(node, OF_POPULATED);
42 return clk;
43+ }
44
45 ret = of_clk_add_provider(node, of_clk_src_simple_get, clk);
46 if (ret) {