aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Manna <kyle@kylemanna.com>2011-08-11 23:33:14 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-09-06 10:37:59 -0400
commitd0e84caeb4cd535923884735906e5730329505b4 (patch)
tree409b5168a878ea302d1aeff50c26369da177f000
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>
-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 cb44b53dee35..7cbf2aa9e64f 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)
510 u8 ch_msb, ch_lsb; 510 u8 ch_msb, ch_lsb;
511 int ret; 511 int ret;
512 512
513 if (!req) 513 if (!req || !twl4030_madc)
514 return -EINVAL; 514 return -EINVAL;
515
515 mutex_lock(&twl4030_madc->lock); 516 mutex_lock(&twl4030_madc->lock);
516 if (req->method < TWL4030_MADC_RT || req->method > TWL4030_MADC_SW2) { 517 if (req->method < TWL4030_MADC_RT || req->method > TWL4030_MADC_SW2) {
517 ret = -EINVAL; 518 ret = -EINVAL;