From a51ba284076437ce36efc8dd9b15983546c043f7 Mon Sep 17 00:00:00 2001 From: Sanjeev Premi Date: Wed, 24 Feb 2010 12:05:56 -0700 Subject: [PATCH] OMAP3 clock: Check return values for clk_get() This patch checks if clk_get() returned success for the clocks used in function omap2_clk_arch_init(). This version incorporates review comments from Kevin Hilman and Paul Walmsley. Signed-off-by: Sanjeev Premi Signed-off-by: Paul Walmsley --- arch/arm/mach-omap2/clock34xx.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index 0e4fdba7f20b..de7391b6bcfd 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -286,6 +287,7 @@ static int __init omap3xxx_clk_arch_init(void) { struct clk *osc_sys_ck, *dpll1_ck, *arm_fck, *core_ck; unsigned long osc_sys_rate; + bool err = 0; if (!cpu_is_omap34xx()) return 0; @@ -295,9 +297,23 @@ static int __init omap3xxx_clk_arch_init(void) /* XXX test these for success */ dpll1_ck = clk_get(NULL, "dpll1_ck"); + if (WARN(IS_ERR(dpll1_ck), "Failed to get dpll1_ck.\n")) + err = 1; + arm_fck = clk_get(NULL, "arm_fck"); + if (WARN(IS_ERR(arm_fck), "Failed to get arm_fck.\n")) + err = 1; + core_ck = clk_get(NULL, "core_ck"); + if (WARN(IS_ERR(core_ck), "Failed to get core_ck.\n")) + err = 1; + osc_sys_ck = clk_get(NULL, "osc_sys_ck"); + if (WARN(IS_ERR(osc_sys_ck), "Failed to get osc_sys_ck.\n")) + err = 1; + + if (err) + return -ENOENT; /* REVISIT: not yet ready for 343x */ if (clk_set_rate(dpll1_ck, mpurate)) -- GitLab