summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/twl4030-madc.c
diff options
context:
space:
mode:
authorKyle Manna <kyle@kylemanna.com>2011-08-11 22:33:14 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2011-09-06 16:37:59 +0200
commitd0e84caeb4cd535923884735906e5730329505b4 (patch)
tree409b5168a878ea302d1aeff50c26369da177f000 /drivers/mfd/twl4030-madc.c
parent66cc5b8e50af87b0bbd0f179d76d2826f4549c13 (diff)
mfd: Check for twl4030-madc NULL pointer
If the twl4030-madc device wasn't registered, and another device, such as twl4030-madc-hwmon, calls twl4030_madc_conversion() a NULL pointer is dereferenced. Signed-off-by: Kyle Manna <kyle@kylemanna.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/twl4030-madc.c')
-rw-r--r--drivers/mfd/twl4030-madc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index cb44b53dee3..7cbf2aa9e64 100644
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -510,8 +510,9 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
u8 ch_msb, ch_lsb;
int ret;
- if (!req)
+ if (!req || !twl4030_madc)
return -EINVAL;
+
mutex_lock(&twl4030_madc->lock);
if (req->method < TWL4030_MADC_RT || req->method > TWL4030_MADC_SW2) {
ret = -EINVAL;