mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 04:34:08 +08:00
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>
This commit is contained in:
parent
66cc5b8e50
commit
d0e84caeb4
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user