[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1357651917-22002-1-git-send-email-panto@antoniou-consulting.com>
Date: Tue, 8 Jan 2013 15:31:57 +0200
From: Pantelis Antoniou <panto@...oniou-consulting.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Tony Lindgren <tony@...mide.com>,
Stephen Warren <swarren@...dotorg.org>,
Benoit Cousson <b-cousson@...com>, linux-omap@...r.kernel.org,
linux-kernel@...r.kernel.org, Matt Porter <mporter@...com>,
Russ Dill <Russ.Dill@...com>,
Koen Kooi <koen@...inion.thruhere.net>,
Joel A Fernandes <agnel.joel@...il.com>,
Rob Clark <robdclark@...il.com>,
Jason Kridner <jkridner@...gleboard.org>,
Matt Ranostay <mranostay@...il.com>,
Pantelis Antoniou <panto@...oniou-consulting.com>
Subject: [PATCH] omap: Avoid crashes in the case of hwmod misconfiguration
omap hwmod is really sensitive to hwmod misconfiguration.
Getting a minor clock wrong always ended up in a crash.
Attempt to be more resilient by not assigning variables with
error codes and then attempting to use them.
Without this patch, missing a clock ends up with something like this:
omap_hwmod: ehrpwm0: cannot clk_get opt_clk ehrpwm0_tbclk!
Unable to handle kernel NULL pointer dereference at virtual address 0000002a!
pgd = c0004000!
[0000002a] *pgd=00000000!
Internal error: Oops: 5 [#1] SMP ARM!
Modules linked in:!
CPU: 0 Not tainted (3.8.0-rc2-12157-g76c7825-dirty #291)!
PC is at __clk_prepare+0x10/0x70!
LR is at clk_prepare+0x1c/0x34!
pc : [<c03e37f0>] lr : [<c03e386c>] psr: a0000113!
sp : cf04fef8 ip : 22222222 fp : 00000000!
r10: ffffffea r9 : 00000000 r8 : 00000000!
r7 : fffffffe r6 : 00000001 r5 : fffffffe r4 : fffffffe!
r3 : cf041ac0 r2 : cf04ff00 r1 : 22222222 r0 : fffffffe!
Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel!
Control: 10c5387d Table: 80004019 DAC: 00000015!
Process swapper/0 (pid: 1, stack limit = 0xcf04e240)!
Stack: (0xcf04fef8 to 0xcf050000)!
fee0: cf041ac0 c07749f4!
ff00: fffffffe c03e386c c07499cc c073c070 c073d2fc c06d4e4c c073c070 c071cc18!
ff20: c06d4c4c 00000000 00000000 c0708284 c06c91bc c0025e28 c073a030 00000001!
ff40: c06f5f60 c06f5f40 c06d5324 c06d533c cf04e000 c0008870 c06d5324 c060abe8!
ff60: c07082e8 00000002 00000001 c06f5f60 c06f5f40 c077d700 00000099 c04a43d4!
ff80: 00000001 00000001 c06c91bc 00000000 00000000 c04a42dc 00000000 00000000!
ffa0: 00000000 00000000 00000000 c000d678 00000000 00000000 00000000 00000000!
ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000!
ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 9e7befee f7bbaaab!
[<c03e37f0>] (__clk_prepare+0x10/0x70) from [<c03e386c>] (clk_prepare+0x1c/0x34)!
[<c03e386c>] (clk_prepare+0x1c/0x34) from [<c06d4e4c>] (_init+0x200/0x288)!
[<c06d4e4c>] (_init+0x200/0x288) from [<c0025e28>] (omap_hwmod_for_each+0x28/0x58)!
[<c0025e28>] (omap_hwmod_for_each+0x28/0x58) from [<c06d533c>] (omap_hwmod_setup_all+0x18/0x34)!
[<c06d533c>] (omap_hwmod_setup_all+0x18/0x34) from [<c0008870>] (do_one_initcall+0x90/0x160)!
[<c0008870>] (do_one_initcall+0x90/0x160) from [<c04a43d4>] (kernel_init+0xf8/0x290)!
[<c04a43d4>] (kernel_init+0xf8/0x290) from [<c000d678>] (ret_from_fork+0x14/0x3c)!
Code: e92d4038 e2504000 01a05004 0a000015 (e594302c) !
---[ end trace 1b75b31a2719ed1c ]---!
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b!
Signed-off-by: Pantelis Antoniou <panto@...oniou-consulting.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 4653efb..2b58e21 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -783,7 +783,9 @@ static int _init_interface_clks(struct omap_hwmod *oh)
if (IS_ERR(c)) {
pr_warning("omap_hwmod: %s: cannot clk_get interface_clk %s\n",
oh->name, os->clk);
- ret = -EINVAL;
+ if (ret == 0)
+ ret = -EINVAL;
+ continue;
}
os->_clk = c;
/*
@@ -819,7 +821,9 @@ static int _init_opt_clks(struct omap_hwmod *oh)
if (IS_ERR(c)) {
pr_warning("omap_hwmod: %s: cannot clk_get opt_clk %s\n",
oh->name, oc->clk);
- ret = -EINVAL;
+ if (ret == 0)
+ ret = -EINVAL;
+ continue;
}
oc->_clk = c;
/*
--
1.7.12
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists