mfd: mc13xxx: Fix a missing check of a register-read failure
authorKangjie Lu <kjlu@umn.edu>
Thu, 20 Dec 2018 21:12:11 +0000 (15:12 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Feb 2019 09:06:59 +0000 (10:06 +0100)
commitf98bcfadc81aaa38711b119f920dce3448b5782c
tree48267c2fc0694315447754cddcaa63abcf012c5f
parent33e081e80d7947212ca9e6bf3ddd29da6e6ac573
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>
drivers/mfd/mc13xxx-core.c