mtd: mtdswap: fix compilation warning
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 25 Mar 2011 15:10:16 +0000 (17:10 +0200)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 25 Mar 2011 15:10:16 +0000 (17:10 +0200)
Fix the following compilation warning:

drivers/mtd/mtdswap.c: In function ‘mtdswap_pick_gc_eblk’:
drivers/mtd/mtdswap.c:859: warning: ‘idx’ may be used uninitialized in this function
drivers/mtd/mtdswap.c:859: note: ‘idx’ was declared here

Initialize idx to -1 because this value means "no tree choosen".

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/mtdswap.c

index dc4b136800b8cf0d8f15cc995cd7edd33a8e7753..237913c5c92c348f70d9d4f160188402fbb48acf 100644 (file)
@@ -850,7 +850,7 @@ static int mtdswap_wlfreq(unsigned int maxdiff)
 static int mtdswap_choose_wl_tree(struct mtdswap_dev *d)
 {
        static unsigned int pick_cnt;
-       unsigned int i, idx, wear, max;
+       unsigned int i, idx = -1, wear, max;
        struct rb_root *root;
 
        max = 0;