]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd_ubi: Fix uninitialized variable warning
authorPeter Tyser <ptyser@xes-inc.com>
Mon, 5 Apr 2010 03:40:50 +0000 (22:40 -0500)
committerStefan Roese <sr@denx.de>
Fri, 9 Apr 2010 14:30:29 +0000 (16:30 +0200)
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>
common/cmd_ubi.c

index 54faac1c931009e131f223dd372456b0d5544202..2484b404914fba8d22534ad1e5b6e9ee0c281cc5 100644 (file)
@@ -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];