* [PATCH] mfd: mc13xxx: fix a missing check of a register-read failure
@ 2018-12-20 21:12 Kangjie Lu
2018-12-21 14:52 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2018-12-20 21:12 UTC (permalink / raw)
To: kjlu; +Cc: pakki001, Lee Jones, linux-kernel
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>
---
drivers/mfd/mc13xxx-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index f475e848252f..d0bf50e3568d 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 |
MC13XXX_ADC0_CHRGRAWDIV;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: mc13xxx: fix a missing check of a register-read failure
2018-12-20 21:12 [PATCH] mfd: mc13xxx: fix a missing check of a register-read failure Kangjie Lu
@ 2018-12-21 14:52 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2018-12-21 14:52 UTC (permalink / raw)
To: Kangjie Lu; +Cc: pakki001, linux-kernel
On Thu, 20 Dec 2018, Kangjie Lu wrote:
> 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>
> ---
> drivers/mfd/mc13xxx-core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Applied, thanks.
--
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-21 14:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-20 21:12 [PATCH] mfd: mc13xxx: fix a missing check of a register-read failure Kangjie Lu
2018-12-21 14:52 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox