From: Tony Lindgren Date: Thu, 15 Jan 2015 01:37:15 +0000 (-0800) Subject: ARM: OMAP2+: Fix error handling for omap2_clk_enable_init_clocks X-Git-Tag: v5.15~16314^2~2^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=339d095ab23cf5de223c9633ee4d3ec1794282af;p=platform%2Fkernel%2Flinux-starfive.git ARM: OMAP2+: Fix error handling for omap2_clk_enable_init_clocks We need to check if we got the clock before trying to do anything with it. Otherwise we will get something like this: Unable to handle kernel paging request at virtual address fffffffe ... [] (clk_prepare) from [] (omap2_clk_enable_init_clocks+0x50/0x8) [] (omap2_clk_enable_init_clocks) from [] (dm816x_dt_clk_init+0) ... Let's add check for the clock and WARN if the init clock was not found. Cc: Brian Hutchinson Cc: Paul Walmsley Cc: Tero Kristo Reviewed-by: Felipe Balbi Signed-off-by: Tony Lindgren --- diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 6ad5b4d..4ae4cce 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -620,6 +620,9 @@ void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks) for (i = 0; i < num_clocks; i++) { init_clk = clk_get(NULL, clk_names[i]); + if (WARN(IS_ERR(init_clk), "could not find init clock %s\n", + clk_names[i])) + continue; clk_prepare_enable(init_clk); } }