Skip to content

Commit

Permalink
clk: rockchip: don't return NULL when registering mmc branch fails
Browse files Browse the repository at this point in the history
Avoid return NULL if rockchip_clk_register_mmc fails, otherwise
rockchip_clk_register_branches print "unknown clock type". The acutal
case is that it's a known clock type but we fail to regiser it, which
may makes user confuse the reason of failure.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
  • Loading branch information
Shawn Lin authored and Heiko Stuebner committed Feb 15, 2016
1 parent ddd02e1 commit 022dce0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/clk/rockchip/clk-mmc-phase.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ struct clk *rockchip_clk_register_mmc(const char *name,

mmc_clock = kmalloc(sizeof(*mmc_clock), GFP_KERNEL);
if (!mmc_clock)
return NULL;
return ERR_PTR(-ENOMEM);

init.name = name;
init.num_parents = num_parents;
Expand All @@ -172,11 +172,7 @@ struct clk *rockchip_clk_register_mmc(const char *name,

clk = clk_register(NULL, &mmc_clock->hw);
if (IS_ERR(clk))
goto err_free;
kfree(mmc_clock);

return clk;

err_free:
kfree(mmc_clock);
return NULL;
}

0 comments on commit 022dce0

Please sign in to comment.