Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1556562 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2017-01-11 16:00 +0100 |
| Last post | 2017-01-12 12:30 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] rtc: armada38x: hide maybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2017-01-11 16:00 +0100
Re: [PATCH] rtc: armada38x: hide maybe-uninitialized warning Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-01-12 12:30 +0100
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-01-11 16:00 +0100 |
| Subject | [PATCH] rtc: armada38x: hide maybe-uninitialized warning |
| Message-ID | <sYsxA-89i-29@gated-at.bofh.it> |
The function is too complicated for gcc to realize that this variable
does eventually get initialized, causing a harmless warning:
drivers/rtc/rtc-armada38x.c: In function 'read_rtc_register_wa':
drivers/rtc/rtc-armada38x.c:131:25: warning: 'index_max' may be used uninitialized in this function [-Wmaybe-uninitialized]
This adds an explicit initializion at the start of the function.
I generally try to avoid that, but it seems appropriate here,
as we start out with max=0 as well.
Fixes: 61cffa2438e3 ("rtc: armada38x: Follow the new recommendation for errata implementation")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/rtc/rtc-armada38x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c
index 6c9a2cbdc1a9..65e16965af7e 100644
--- a/drivers/rtc/rtc-armada38x.c
+++ b/drivers/rtc/rtc-armada38x.c
@@ -90,7 +90,7 @@ static void rtc_update_mbus_timing_params(struct armada38x_rtc *rtc)
static u32 read_rtc_register_wa(struct armada38x_rtc *rtc, u8 rtc_reg)
{
- int i, index_max, max = 0;
+ int i, index_max = 0, max = 0;
for (i = 0; i < SAMPLE_NR; i++) {
rtc->val_to_freq[i].value = readl(rtc->regs + rtc_reg);
--
2.9.0
[toc] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2017-01-12 12:30 +0100 |
| Message-ID | <sYLJV-3mz-43@gated-at.bofh.it> |
| In reply to | #1556562 |
Hi Arnd,
On 11/01/2017 at 15:50:31 +0100, Arnd Bergmann wrote :
> The function is too complicated for gcc to realize that this variable
> does eventually get initialized, causing a harmless warning:
>
> drivers/rtc/rtc-armada38x.c: In function 'read_rtc_register_wa':
> drivers/rtc/rtc-armada38x.c:131:25: warning: 'index_max' may be used uninitialized in this function [-Wmaybe-uninitialized]
>
> This adds an explicit initializion at the start of the function.
> I generally try to avoid that, but it seems appropriate here,
> as we start out with max=0 as well.
>
> Fixes: 61cffa2438e3 ("rtc: armada38x: Follow the new recommendation for errata implementation")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Actually, I fixed that one directly in the commit yesterday as it has
been reported to me multiple times already.
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web