aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk-s2mps11.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2014-05-21 07:23:00 -0400
committerMike Turquette <mturquette@linaro.org>2014-05-23 18:44:03 -0400
commit7002483c7b28a808d2bd4366b00c48911688c768 (patch)
tree61a2f8cda2437ab88e0d7ef51f52226432355301 /drivers/clk/clk-s2mps11.c
parentbf416bd457389bfe7371ba9074bcbd032d7a04cc (diff)
clk: s2mps11: Remove useless check for clk_table
There is no need for checking if 'clk_table' is not NULL twice (first after allocation and second at the end of probe()). Also move allocation of this 'clk_table' to probe from s2mps11_clk_parse_dt as this is logical place for it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/clk-s2mps11.c')
-rw-r--r--drivers/clk/clk-s2mps11.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index 843ec3646501..23ffd89c4023 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -141,11 +141,6 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
141 return ERR_PTR(-EINVAL); 141 return ERR_PTR(-EINVAL);
142 } 142 }
143 143
144 clk_table = devm_kzalloc(&pdev->dev, sizeof(struct clk *) *
145 S2MPS11_CLKS_NUM, GFP_KERNEL);
146 if (!clk_table)
147 return ERR_PTR(-ENOMEM);
148
149 for (i = 0; i < S2MPS11_CLKS_NUM; i++) 144 for (i = 0; i < S2MPS11_CLKS_NUM; i++)
150 of_property_read_string_index(clk_np, "clock-output-names", i, 145 of_property_read_string_index(clk_np, "clock-output-names", i,
151 &s2mps11_clks_init[i].name); 146 &s2mps11_clks_init[i].name);
@@ -168,6 +163,11 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
168 163
169 s2mps11_clk = s2mps11_clks; 164 s2mps11_clk = s2mps11_clks;
170 165
166 clk_table = devm_kzalloc(&pdev->dev, sizeof(struct clk *) *
167 S2MPS11_CLKS_NUM, GFP_KERNEL);
168 if (!clk_table)
169 return -ENOMEM;
170
171 /* Store clocks of_node in first element of s2mps11_clks array */ 171 /* Store clocks of_node in first element of s2mps11_clks array */
172 s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev); 172 s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev);
173 if (IS_ERR(s2mps11_clks->clk_np)) 173 if (IS_ERR(s2mps11_clks->clk_np))
@@ -220,15 +220,13 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
220 clkdev_add(s2mps11_clk->lookup); 220 clkdev_add(s2mps11_clk->lookup);
221 } 221 }
222 222
223 if (clk_table) { 223 for (i = 0; i < S2MPS11_CLKS_NUM; i++)
224 for (i = 0; i < S2MPS11_CLKS_NUM; i++) 224 clk_table[i] = s2mps11_clks[i].clk;
225 clk_table[i] = s2mps11_clks[i].clk;
226 225
227 clk_data.clks = clk_table; 226 clk_data.clks = clk_table;
228 clk_data.clk_num = S2MPS11_CLKS_NUM; 227 clk_data.clk_num = S2MPS11_CLKS_NUM;
229 of_clk_add_provider(s2mps11_clks->clk_np, 228 of_clk_add_provider(s2mps11_clks->clk_np, of_clk_src_onecell_get,
230 of_clk_src_onecell_get, &clk_data); 229 &clk_data);
231 }
232 230
233 platform_set_drvdata(pdev, s2mps11_clks); 231 platform_set_drvdata(pdev, s2mps11_clks);
234 232