clk: meson: add some error handling in meson_clk_register_cpu()
Subsystems (4)
PATCH 1/1 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 <[email protected]>
drivers/clk/meson/clk-cpu.c +12 -4
@@ -213,22 +213,30 @@ struct clk *meson_clk_register_cpu(const struct clk_conf *clk_conf,if (!pclk) {pr_err ("%s: could not lookup parent clock %s\n" , __func__, clk_conf->clks_parent[0 ]); -return ERR_PTR (-EINVAL ); + ret = -EINVAL ; + goto free_clk; } ret =clk_notifier_register (pclk, &clk_cpu->clk_nb);if (ret) {pr_err ("%s: failed to register clock notifier for %s\n" , __func__, clk_conf->clk_name); -return ERR_PTR (-EINVAL ); + goto free_clk; } clk =clk_register (NULL , &clk_cpu->hw);if (IS_ERR (clk)) { -clk_notifier_unregister (pclk, &clk_cpu->clk_nb); -kfree (clk_cpu); + ret =PTR_ERR (clk); + goto unregister_clk_nb; }return clk; + +unregister_clk_nb: +clk_notifier_unregister (pclk, &clk_cpu->clk_nb); +free_clk: +kfree (clk_cpu); + +return ERR_PTR (ret); }
Quoted 34 lines · Dan Carpenter
This error handling hopefully isn't needed but it make the static checkers happy.
Signed-off-by Dan Carpenter <[email protected]>drivers/clk/meson/clk-cpu.c +5
-4@@ -213,22 +213,30 @@ struct clk *meson_clk_register_cpu(const struct clk_conf *clk_conf,if (!pclk) {pr_err ("%s: could not lookup parent clock %s\n" , __func__, clk_conf->clks_parent[0 ]); -return ERR_PTR (-EINVAL ); + ret = -EINVAL ; + goto free_clk; } ret =clk_notifier_register (pclk, &clk_cpu->clk_nb);if (ret) {pr_err ("%s: failed to register clock notifier for %s\n" , __func__, clk_conf->clk_name); -return ERR_PTR (-EINVAL ); + goto free_clk; } clk =clk_register (NULL , &clk_cpu->hw);if (IS_ERR (clk)) { -clk_notifier_unregister (pclk, &clk_cpu->clk_nb); -kfree (clk_cpu); + ret =PTR_ERR (clk); + goto unregister_clk_nb; }
drivers/clk/meson/clk-cpu.c struct clk *meson_clk_register_cpu(const struct clk_conf *clk_conf, · line 242
Quoted 10 lines
drivers/clk/meson/clk-cpu.c +7
-0return clk; + +unregister_clk_nb: +clk_notifier_unregister (pclk, &clk_cpu->clk_nb); +free_clk: +kfree (clk_cpu); + +return ERR_PTR (ret); }
Thanks Dan,
Acked-by Carlo Caione <[email protected]>
Signature · 1 line
Carlo Caione | +39.340.80.30.096 | Endless
Stephen Boyd
AppliedQuoted 5 lines · Dan Carpenter
This error handling hopefully isn't needed but it make the static checkers happy.
Signed-off-by Dan Carpenter <[email protected]>
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project