Skip to content

Commit 7e5955d

Browse files
hzhuang1olofj
authored andcommitted
ARM: prima2: fix incorrect panic usage
In prima2, some functions of checking DT is registered in initcall level. If it doesn't match the compatible name of sirf, kernel will panic. It blocks the usage of multiplatform on other verndor. The error message is in below. Knic - not syncing: unable to find compatible pwrc node in dtb CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0-rc3-00006-gd7f26ea-dirty #86 [<c0013adc>] (unwind_backtrace+0x0/0xf8) from [<c0011430>] (show_stack+0x10/0x1) [<c0011430>] (show_stack+0x10/0x14) from [<c026f724>] (panic+0x90/0x1e8) [<c026f724>] (panic+0x90/0x1e8) from [<c03267fc>] (sirfsoc_of_pwrc_init+0x24/0x) [<c03267fc>] (sirfsoc_of_pwrc_init+0x24/0x58) from [<c0320864>] (do_one_initcal) [<c0320864>] (do_one_initcall+0x90/0x150) from [<c0320a20>] (kernel_init_freeab) [<c0320a20>] (kernel_init_freeable+0xfc/0x1c4) from [<c026b9e8>] (kernel_init+0) [<c026b9e8>] (kernel_init+0x8/0xe4) from [<c000e158>] (ret_from_fork+0x14/0x3c) Signen-off-by: Haojian Zhuang <[email protected]> Signed-off-by: Olof Johansson <[email protected]>
1 parent f1d6e31 commit 7e5955d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

arch/arm/mach-prima2/pm.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ static int __init sirfsoc_of_pwrc_init(void)
101101
struct device_node *np;
102102

103103
np = of_find_matching_node(NULL, pwrc_ids);
104-
if (!np)
105-
panic("unable to find compatible pwrc node in dtb\n");
104+
if (!np) {
105+
pr_err("unable to find compatible sirf pwrc node in dtb\n");
106+
return -ENOENT;
107+
}
106108

107109
/*
108110
* pwrc behind rtciobrg is not located in memory space

arch/arm/mach-prima2/rstc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ static int __init sirfsoc_of_rstc_init(void)
2828
struct device_node *np;
2929

3030
np = of_find_matching_node(NULL, rstc_ids);
31-
if (!np)
32-
panic("unable to find compatible rstc node in dtb\n");
31+
if (!np) {
32+
pr_err("unable to find compatible sirf rstc node in dtb\n");
33+
return -ENOENT;
34+
}
3335

3436
sirfsoc_rstc_base = of_iomap(np, 0);
3537
if (!sirfsoc_rstc_base)

0 commit comments

Comments
 (0)