1
0
Fork 0

zero-sugar: add a NULL pointer check for max77818_enable_safeout1()

Add a NULL pointer check for max77818_enable_safeout1() to make sure we
do not call dm_i2c_read[write] with a NULL idDev.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
zero-sugar
Shawn Guo 2019-08-15 14:40:24 +02:00 committed by Lars Ivar Miljeteig
parent d5056cd85e
commit bbd1774489
1 changed files with 3 additions and 0 deletions

View File

@ -381,6 +381,9 @@ int max77818_enable_safeout1(void)
int ret;
u8 val;
if (!idDev)
return -ENODEV;
ret = dm_i2c_read(idDev, MAX77818_REG_SAFEOUTCTRL, &val, 1);
if (ret)
return ret;