aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-06-11 11:20:46 -0400
committerStephen Boyd <sboyd@codeaurora.org>2015-06-12 17:30:19 -0400
commit46965688acd0f9599a3c3ecce82109b3b24153a9 (patch)
treec0addbb02a037605f8ed5e7b392d0adc45cb7e7d
parent22109785163310666cf9913bafbcc11c5aebe68a (diff)
clk: meson: add some error handling in meson_clk_register_cpu()
This error handling hopefully isn't needed but it make the static checkers happy. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--drivers/clk/meson/clk-cpu.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/clk/meson/clk-cpu.c b/drivers/clk/meson/clk-cpu.c
index 148e99fc5970..71ad493b94df 100644
--- a/drivers/clk/meson/clk-cpu.c
+++ b/drivers/clk/meson/clk-cpu.c
@@ -213,22 +213,30 @@ struct clk *meson_clk_register_cpu(const struct clk_conf *clk_conf,
213 if (!pclk) { 213 if (!pclk) {
214 pr_err("%s: could not lookup parent clock %s\n", 214 pr_err("%s: could not lookup parent clock %s\n",
215 __func__, clk_conf->clks_parent[0]); 215 __func__, clk_conf->clks_parent[0]);
216 return ERR_PTR(-EINVAL); 216 ret = -EINVAL;
217 goto free_clk;
217 } 218 }
218 219
219 ret = clk_notifier_register(pclk, &clk_cpu->clk_nb); 220 ret = clk_notifier_register(pclk, &clk_cpu->clk_nb);
220 if (ret) { 221 if (ret) {
221 pr_err("%s: failed to register clock notifier for %s\n", 222 pr_err("%s: failed to register clock notifier for %s\n",
222 __func__, clk_conf->clk_name); 223 __func__, clk_conf->clk_name);
223 return ERR_PTR(-EINVAL); 224 goto free_clk;
224 } 225 }
225 226
226 clk = clk_register(NULL, &clk_cpu->hw); 227 clk = clk_register(NULL, &clk_cpu->hw);
227 if (IS_ERR(clk)) { 228 if (IS_ERR(clk)) {
228 clk_notifier_unregister(pclk, &clk_cpu->clk_nb); 229 ret = PTR_ERR(clk);
229 kfree(clk_cpu); 230 goto unregister_clk_nb;
230 } 231 }
231 232
232 return clk; 233 return clk;
234
235unregister_clk_nb:
236 clk_notifier_unregister(pclk, &clk_cpu->clk_nb);
237free_clk:
238 kfree(clk_cpu);
239
240 return ERR_PTR(ret);
233} 241}
234 242