public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd_ubi: Fix uninitialized variable warning
@ 2010-04-05  3:40 Peter Tyser
  2010-04-09 14:35 ` Stefan Roese
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Tyser @ 2010-04-05  3:40 UTC (permalink / raw)
  To: u-boot

gcc 3.4.6 previously reported the following error on many MIPS boards
which utilize UBI:
  cmd_ubi.c:193: warning: 'vol' might be used uninitialized in this function

The current code is structured such that 'vol' will never be used when
it is NULL anyway, but gcc isn't smart enough to figure this out.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
---
 common/cmd_ubi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 54faac1..2484b40 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -190,7 +190,7 @@ static int ubi_remove_vol(char *volume)
 {
 	int i, err, reserved_pebs;
 	int found = 0, vol_id = 0;
-	struct ubi_volume *vol;
+	struct ubi_volume *vol = NULL;
 
 	for (i = 0; i < ubi->vtbl_slots; i++) {
 		vol = ubi->volumes[i];
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] cmd_ubi: Fix uninitialized variable warning
  2010-04-05  3:40 [U-Boot] [PATCH] cmd_ubi: Fix uninitialized variable warning Peter Tyser
@ 2010-04-09 14:35 ` Stefan Roese
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Roese @ 2010-04-09 14:35 UTC (permalink / raw)
  To: u-boot

On Monday 05 April 2010 05:40:50 Peter Tyser wrote:
> gcc 3.4.6 previously reported the following error on many MIPS boards
> which utilize UBI:
>   cmd_ubi.c:193: warning: 'vol' might be used uninitialized in this
> function
> 
> The current code is structured such that 'vol' will never be used when
> it is NULL anyway, but gcc isn't smart enough to figure this out.

Applied to u-boot-ubi/master. Thanks.
 
Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-09 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-05  3:40 [U-Boot] [PATCH] cmd_ubi: Fix uninitialized variable warning Peter Tyser
2010-04-09 14:35 ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox