diff options
author | Kangjie Lu <kjlu@umn.edu> | 2018-12-20 15:12:11 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-27 10:08:52 +0100 |
commit | 7fc59021c1f5e3ae88d3edd44cfbbe407d6e8909 (patch) | |
tree | 9274ab4f710adeb688e8ef3bf48fa0cc87c35925 /drivers/mfd | |
parent | e42296ae45a63f6e378a23fe3b4f4d58f9757566 (diff) | |
download | linux-stable-7fc59021c1f5e3ae88d3edd44cfbbe407d6e8909.tar.gz linux-stable-7fc59021c1f5e3ae88d3edd44cfbbe407d6e8909.tar.bz2 linux-stable-7fc59021c1f5e3ae88d3edd44cfbbe407d6e8909.zip |
mfd: mc13xxx: Fix a missing check of a register-read failure
[ Upstream commit 9e28989d41c0eab57ec0bb156617a8757406ff8a ]
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: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/mc13xxx-core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c index c63e331738c1..234febfe6398 100644 --- a/drivers/mfd/mc13xxx-core.c +++ b/drivers/mfd/mc13xxx-core.c @@ -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; adc0 = MC13XXX_ADC0_ADINC1 | MC13XXX_ADC0_ADINC2; adc1 = MC13XXX_ADC1_ADEN | MC13XXX_ADC1_ADTRIGIGN | MC13XXX_ADC1_ASC; |