From: Eugen Hristev <eugen.hristev@microchip.com>
To: <jic23@kernel.org>
Cc: <linux-iio@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
Eugen Hristev <eugen.hristev@microchip.com>,
kernel test robot <lkp@intel.com>
Subject: [PATCH] iio: adc: at91-sama5d2_adc: fix warning for uninitialized 'val' variable
Date: Tue, 31 Aug 2021 09:48:00 +0300 [thread overview]
Message-ID: <20210831064800.78979-1-eugen.hristev@microchip.com> (raw)
>> 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;
^
= 0
1 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 <lkp@intel.com>
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
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(-)
diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index 29c7441f9f27..f8a9ad50a00b 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -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;
/*
--
2.25.1
reply other threads:[~2021-08-31 6:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210831064800.78979-1-eugen.hristev@microchip.com \
--to=eugen.hristev@microchip.com \
--cc=jic23@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).