From: Peter Tyser <ptyser@xes-inc.com>
Date: Mon, 5 Apr 2010 03:40:50 +0000 (-0500)
Subject: cmd_ubi: Fix uninitialized variable warning
X-Git-Tag: v2025.01-rc5-pxa1908~20344^2
X-Git-Url: http://git.dujemihanovic.xyz/html/static/%7B%7B%20%28.OutputFormats.Get?a=commitdiff_plain;h=3b653fdb322028b27c5ae3d60ecb0eea2d58837f;p=u-boot.git

cmd_ubi: Fix uninitialized variable warning

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>
Signed-off-by: Stefan Roese <sr@denx.de>
---

diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 54faac1c93..2484b40491 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];