From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] fsl: sys_eeprom: Fix 'may be used uninitialized' warning
Date: Wed, 2 Sep 2009 02:17:24 +0400 [thread overview]
Message-ID: <20090901221724.GA17817@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20090901192737.0A1B5834A950@gemini.denx.de>
The warning is bogus, so silence it by initializing the 'ret' variable.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
On Tue, Sep 01, 2009 at 09:27:37PM +0200, Wolfgang Denk wrote:
> Dear Anton Vorontsov,
>
> In message <20090901182518.GA17903@oksana.dev.rtsoft.ru> you wrote:
> >
> > We can fix the warnings by assigning some value to a variable
> > at declaration, but the advantage of 'x = x' trick is that it
> > doesn't generate any code.
>
> Argh... what a clev^H^H^H^Hdirty trick.
>
> Thanks for the explanation.
>
> However, in this case it seems to make sense to me to explicitly
> initialize the return code with zero.
Well, I don't see any advantages of this, but here it is anyway.
Thanks.
p.s. Timur, since the patch has changed, I couldn't preserve your
previous Ack.
board/freescale/common/sys_eeprom.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index c0fff68..661015e 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -204,7 +204,8 @@ static void update_crc(void)
*/
static int prog_eeprom(void)
{
- int ret, i;
+ int ret = 0; /* shut up gcc */
+ int i;
void *p;
#ifdef CONFIG_SYS_EEPROM_BUS_NUM
unsigned int bus;
--
1.6.3.3
next prev parent reply other threads:[~2009-09-01 22:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-01 16:58 [U-Boot] [PATCH 1/2] Move uninitialized_var() macro from ubi_uboot.h to compiler.h Anton Vorontsov
2009-09-01 18:11 ` Wolfgang Denk
2009-09-01 18:25 ` Anton Vorontsov
2009-09-01 18:52 ` Albin Tonnerre
2009-09-01 19:58 ` Anton Vorontsov
2009-09-02 3:13 ` Mike Frysinger
2009-09-01 19:27 ` Wolfgang Denk
2009-09-01 22:17 ` Anton Vorontsov [this message]
2009-09-01 22:43 ` [U-Boot] [PATCH v2] fsl: sys_eeprom: Fix 'may be used uninitialized' warning Timur Tabi
2009-09-02 1:52 ` Kumar Gala
2009-09-04 20:16 ` [U-Boot] [PATCH 1/2] Move uninitialized_var() macro from ubi_uboot.h to compiler.h Wolfgang Denk
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=20090901221724.GA17817@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.