From 339d095ab23cf5de223c9633ee4d3ec1794282af Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Wed, 14 Jan 2015 17:37:15 -0800 Subject: [PATCH] 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 --- arch/arm/mach-omap2/clock.c | 3 +++ 1 file changed, 3 insertions(+) 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); } } -- 2.39.5