iio: adc: at91-sama5d2_adc: fix warning for uninitialized 'val' variable
PATCH 1/1 iio: adc: at91-sama5d2_adc: fix warning for uninitialized 'val' variable
Quoted 1 line
Quoted 1 line
drivers/iio/adc/at91-sama5d2_adc.c:722:11: warning: variable 'val' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
else if (reg == st->soc_info.platform->layout->YPOSR)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/adc/at91-sama5d2_adc.c:725:7: note: uninitialized use occurs here
if (!val)
^~~
drivers/iio/adc/at91-sama5d2_adc.c:722:7: note: remove the 'if' if its condition is always true
else if (reg == st->soc_info.platform->layout->YPOSR)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/adc/at91-sama5d2_adc.c:711:9: note: initialize the variable 'val' to silence this warning
u32 val;
^
= 01 warning generated.
Fixed by initializing 'val' variable.
Fixes 29edec2b98ff ("iio: adc: at91-sama5d2_adc: convert to platform specific data structures")
Reported-by kernel test robot <[email protected]>
Signed-off-by Eugen Hristev <[email protected]>
---
Hi Jonathan,
If you can still rebase your testing branch, maybe you can squash this into the original patch, no need to make a separate commit I guess.
I fixed this as soon as the report came out from the 0day robot.
Thanks !
Eugen
drivers/iio/adc/at91-sama5d2_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/at91-sama5d2_adc.c +1 -1
@@ -846,7 +846,7 @@ static int at91_adc_configure_touch(struct at91_adc_state *st, bool state)static u16 at91_adc_touch_pos (struct at91_adc_state *st,int reg) { -u32 val; +u32 val =0 ;u32 scale, result, pos;/*
Signature · 1 line
2.25.1