Commit cb4685b4 authored by Kangjie Lu's avatar Kangjie Lu Committed by Greg Kroah-Hartman

mfd: mc13xxx: Fix a missing check of a register-read failure

[ Upstream commit 9e28989d ]

When mc13xxx_reg_read() fails, "old_adc0" is uninitialized and will
contain random value. Further execution uses "old_adc0" even when
mc13xxx_reg_read() fails.
The fix checks the return value of mc13xxx_reg_read(), and exits
the execution when it fails.
Signed-off-by: 's avatarKangjie Lu <>
Signed-off-by: 's avatarLee Jones <>
Signed-off-by: 's avatarSasha Levin <>
parent 2588ebb6
......@@ -274,7 +274,9 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode,
mc13xxx->adcflags |= MC13XXX_ADC_WORKING;
mc13xxx_reg_read(mc13xxx, MC13XXX_ADC0, &old_adc0);
ret = mc13xxx_reg_read(mc13xxx, MC13XXX_ADC0, &old_adc0);
if (ret)
goto out;
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