Skip to content

Commit a51ba28

Browse files
Sanjeev PremiPaul Walmsley
authored andcommitted
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 <[email protected]> Signed-off-by: Paul Walmsley <[email protected]>
1 parent 3cc4a2f commit a51ba28

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

arch/arm/mach-omap2/clock34xx.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/delay.h>
2222
#include <linux/clk.h>
2323
#include <linux/io.h>
24+
#include <linux/err.h>
2425

2526
#include <plat/cpu.h>
2627
#include <plat/clock.h>
@@ -286,6 +287,7 @@ static int __init omap3xxx_clk_arch_init(void)
286287
{
287288
struct clk *osc_sys_ck, *dpll1_ck, *arm_fck, *core_ck;
288289
unsigned long osc_sys_rate;
290+
bool err = 0;
289291

290292
if (!cpu_is_omap34xx())
291293
return 0;
@@ -295,9 +297,23 @@ static int __init omap3xxx_clk_arch_init(void)
295297

296298
/* XXX test these for success */
297299
dpll1_ck = clk_get(NULL, "dpll1_ck");
300+
if (WARN(IS_ERR(dpll1_ck), "Failed to get dpll1_ck.\n"))
301+
err = 1;
302+
298303
arm_fck = clk_get(NULL, "arm_fck");
304+
if (WARN(IS_ERR(arm_fck), "Failed to get arm_fck.\n"))
305+
err = 1;
306+
299307
core_ck = clk_get(NULL, "core_ck");
308+
if (WARN(IS_ERR(core_ck), "Failed to get core_ck.\n"))
309+
err = 1;
310+
300311
osc_sys_ck = clk_get(NULL, "osc_sys_ck");
312+
if (WARN(IS_ERR(osc_sys_ck), "Failed to get osc_sys_ck.\n"))
313+
err = 1;
314+
315+
if (err)
316+
return -ENOENT;
301317

302318
/* REVISIT: not yet ready for 343x */
303319
if (clk_set_rate(dpll1_ck, mpurate))

0 commit comments

Comments
 (0)