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: v4.0-rc1~72^2~4^2~5 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=339d095ab23cf5de223c9633ee4d3ec1794282af;p=karo-tx-linux.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 6ad5b4dbd33e..4ae4ccebced2 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); } }