Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: rockchip: don't return NULL when registering inverter fails

Avoid return NULL if rockchip_clk_register_inverter 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>

authored by

Shawn Lin and committed by
Heiko Stuebner
ddd02e14 eb4e10c6

+2 -6
+2 -6
drivers/clk/rockchip/clk-inverter.c
··· 90 90 91 91 inv_clock = kmalloc(sizeof(*inv_clock), GFP_KERNEL); 92 92 if (!inv_clock) 93 - return NULL; 93 + return ERR_PTR(-ENOMEM); 94 94 95 95 init.name = name; 96 96 init.num_parents = num_parents; ··· 106 106 107 107 clk = clk_register(NULL, &inv_clock->hw); 108 108 if (IS_ERR(clk)) 109 - goto err_free; 109 + kfree(inv_clock); 110 110 111 111 return clk; 112 - 113 - err_free: 114 - kfree(inv_clock); 115 - return NULL; 116 112 }