public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] fsl: sys_eeprom: Fix 'may be used uninitialized' warning
Date: Tue, 1 Sep 2009 21:38:14 +0400	[thread overview]
Message-ID: <20090901173814.GA4471@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <607BBB57-C4BD-4E89-A70D-7AD1A8109F5C@kernel.crashing.org>

On Tue, Sep 01, 2009 at 12:30:53PM -0500, Kumar Gala wrote:
> 
> On Sep 1, 2009, at 11:59 AM, Anton Vorontsov wrote:
> 
> >The warning is bogus, so silence it with uninitialized_var().
> >
> >Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> >---
> >board/freescale/common/sys_eeprom.c |    4 +++-
> >1 files changed, 3 insertions(+), 1 deletions(-)
> >
> >diff --git a/board/freescale/common/sys_eeprom.c
> >b/board/freescale/common/sys_eeprom.c
> >index c0fff68..a765b39 100644
> >--- a/board/freescale/common/sys_eeprom.c
> >+++ b/board/freescale/common/sys_eeprom.c
> >@@ -24,6 +24,7 @@
> > */
> >
> >#include <common.h>
> >+#include <compiler.h>
> >#include <command.h>
> >#include <i2c.h>
> >#include <linux/ctype.h>
> >@@ -204,7 +205,8 @@ static void update_crc(void)
> > */
> >static int prog_eeprom(void)
> >{
> >-	int ret, i;
> >+	int uninitialized_var(ret);
> >+	int i;
> 
> why don't we init ret = 0;  seems like we should be doing that since
> we might not enter the for loop

No, we always enter the for loop:

for (i = 0, p = &e; i < sizeof(e); i += 8, p += 8) {

sizeof(e) always > 0 because:

#if !defined(CONFIG_SYS_I2C_EEPROM_CCID) && !defined(CONFIG_SYS_I2C_EEPROM_NXID)
#error "Please define either CONFIG_SYS_I2C_EEPROM_CCID or CONFIG_SYS_I2C_EEPROM_NXID"
#endif

static struct __attribute__ ((__packed__)) eeprom {
#ifdef CONFIG_SYS_I2C_EEPROM_CCID
        u8 id[4];         /* 0x00 - 0x03 EEPROM Tag 'CCID' */
...
#endif
#ifdef CONFIG_SYS_I2C_EEPROM_NXID
        u8 id[4];         /* 0x00 - 0x03 EEPROM Tag 'NXID' */
...
#endif
} e;

-- 
Anton Vorontsov
email: cbouatmailru at gmail.com
irc://irc.freenode.net/bd2

  reply	other threads:[~2009-09-01 17:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-01 16:59 [U-Boot] [PATCH 2/2] fsl: sys_eeprom: Fix 'may be used uninitialized' warning Anton Vorontsov
2009-09-01 17:30 ` Kumar Gala
2009-09-01 17:38   ` Anton Vorontsov [this message]
2009-09-01 17:59     ` [U-Boot] invalid core multipliers? Kári Davíðsson
2009-09-04 20:57       ` Wolfgang Denk
2009-09-01 18:06     ` [U-Boot] [PATCH 2/2] fsl: sys_eeprom: Fix 'may be used uninitialized' warning Anton Vorontsov
2009-09-01 18:09       ` Timur Tabi
2009-09-01 18:27         ` [U-Boot] [PATCH 2/2] fsl: sys_eeprom: Fix 'may be used uninitialized' warningп Anton Vorontsov
2009-09-01 19:22       ` [U-Boot] [PATCH 2/2] fsl: sys_eeprom: Fix 'may be used uninitialized' warning Wolfgang Denk
2009-09-01 18:16 ` Wolfgang Denk
2009-09-01 18:29   ` Anton Vorontsov
2009-09-01 19:42     ` Wolfgang Denk
2009-09-01 18:38 ` Timur Tabi

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=20090901173814.GA4471@oksana.dev.rtsoft.ru \
    --to=avorontsov@ru.mvista.com \
    --cc=u-boot@lists.denx.de \
    /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