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 mmc branch fails

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>

authored by

Shawn Lin and committed by
Heiko Stuebner
022dce0b ddd02e14

+2 -6
+2 -6
drivers/clk/rockchip/clk-mmc-phase.c
··· 150 150 151 151 mmc_clock = kmalloc(sizeof(*mmc_clock), GFP_KERNEL); 152 152 if (!mmc_clock) 153 - return NULL; 153 + return ERR_PTR(-ENOMEM); 154 154 155 155 init.name = name; 156 156 init.num_parents = num_parents; ··· 172 172 173 173 clk = clk_register(NULL, &mmc_clock->hw); 174 174 if (IS_ERR(clk)) 175 - goto err_free; 175 + kfree(mmc_clock); 176 176 177 177 return clk; 178 - 179 - err_free: 180 - kfree(mmc_clock); 181 - return NULL; 182 178 }