summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/mc13xxx-core.c
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2014-04-15 19:56:14 -0300
committerLee Jones <lee.jones@linaro.org>2014-06-03 08:11:13 +0100
commit48ca9a52c58c088c7492185ef33d0675d6382b5a (patch)
tree69af6e3c4f6b083047339788b8d9b97d52f6a461 /drivers/mfd/mc13xxx-core.c
parentd09b711a31ed891dc372039ccd347cdc8402da04 (diff)
downloadlinux-stable-48ca9a52c58c088c7492185ef33d0675d6382b5a.tar.gz
linux-stable-48ca9a52c58c088c7492185ef33d0675d6382b5a.tar.bz2
linux-stable-48ca9a52c58c088c7492185ef33d0675d6382b5a.zip
mfd: mc13xxx-core: Initialize the lock prior to using it
After request_threaded_irq() is called there is a chance that an interrupt may occur before the 'mc13xxx->lock' is initialized, which will trigger a kernel oops. In order to prevent that, move the initialization of 'mc13xxx->lock' prior to requesting the interrupts. Suggested-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/mc13xxx-core.c')
-rw-r--r--drivers/mfd/mc13xxx-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 0c6c21c5b1a8..ddabc8157eb0 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -660,13 +660,13 @@ int mc13xxx_common_init(struct device *dev)
if (ret)
return ret;
+ mutex_init(&mc13xxx->lock);
+
ret = request_threaded_irq(mc13xxx->irq, NULL, mc13xxx_irq_thread,
IRQF_ONESHOT | IRQF_TRIGGER_HIGH, "mc13xxx", mc13xxx);
if (ret)
return ret;
- mutex_init(&mc13xxx->lock);
-
if (mc13xxx_probe_flags_dt(mc13xxx) < 0 && pdata)
mc13xxx->flags = pdata->flags;