aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Lin <shawn.lin@rock-chips.com>2018-03-20 22:39:20 -0400
committerHeiko Stuebner <heiko@sntech.de>2018-03-23 04:08:43 -0400
commit0d92d1802ced45dab0cbb1d130ace7410bcaec99 (patch)
tree38beed4e362decabef0efa0934fe91a3a34dd23c
parent570fda972b3178f9a981d1b7ac18e05245a52eab (diff)
clk: rockchip: Fix error return in phase clock registration
The newly added clock notifier may return an error code but so far the error output in the function would only return an error pointer from registering the clock. So when the clock notifier fails the clock would be unregistered but the return would still be the clock pointer which could then not be dereferenced correctly. So fix the error handling to prevent that. Fixes: 60cf09e45fbc ("clk: rockchip: Restore the clock phase after the rate was changed") Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
-rw-r--r--drivers/clk/rockchip/clk-mmc-phase.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/clk/rockchip/clk-mmc-phase.c b/drivers/clk/rockchip/clk-mmc-phase.c
index b7b9f2e7d64b..026a26bb702d 100644
--- a/drivers/clk/rockchip/clk-mmc-phase.c
+++ b/drivers/clk/rockchip/clk-mmc-phase.c
@@ -223,8 +223,10 @@ struct clk *rockchip_clk_register_mmc(const char *name,
223 mmc_clock->shift = shift; 223 mmc_clock->shift = shift;
224 224
225 clk = clk_register(NULL, &mmc_clock->hw); 225 clk = clk_register(NULL, &mmc_clock->hw);
226 if (IS_ERR(clk)) 226 if (IS_ERR(clk)) {
227 ret = PTR_ERR(clk);
227 goto err_register; 228 goto err_register;
229 }
228 230
229 mmc_clock->clk_rate_change_nb.notifier_call = 231 mmc_clock->clk_rate_change_nb.notifier_call =
230 &rockchip_mmc_clk_rate_notify; 232 &rockchip_mmc_clk_rate_notify;
@@ -237,5 +239,5 @@ err_notifier:
237 clk_unregister(clk); 239 clk_unregister(clk);
238err_register: 240err_register:
239 kfree(mmc_clock); 241 kfree(mmc_clock);
240 return clk; 242 return ERR_PTR(ret);
241} 243}