瀏覽代碼

mtd: mtdswap: fix compilation warning

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>
Artem Bityutskiy 14 年之前
父節點
當前提交
68b1a1e786
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/mtd/mtdswap.c

+ 1 - 1
drivers/mtd/mtdswap.c

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