Commit d0e84cae authored by Kyle Manna's avatar Kyle Manna Committed by Samuel Ortiz

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: default avatarKyle Manna <kyle@kylemanna.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 66cc5b8e
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment