]> git.karo-electronics.de Git - linux-beck.git/commitdiff
clk: rockchip: don't return NULL when registering mmc branch fails
authorShawn Lin <shawn.lin@rock-chips.com>
Mon, 15 Feb 2016 03:33:41 +0000 (11:33 +0800)
committerHeiko Stuebner <heiko@sntech.de>
Mon, 15 Feb 2016 22:37:27 +0000 (23:37 +0100)
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>
drivers/clk/rockchip/clk-mmc-phase.c

index 2685644826a06ed5a6f21240ad8af040bf4b0b9e..e0dc7e83403a90118a47102577962c55e88fa614 100644 (file)
@@ -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;
@@ -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;
 }