From 68b1a1e786f29c900fa1c516a402e24f0ece622a Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Fri, 25 Mar 2011 17:10:16 +0200 Subject: [PATCH] mtd: mtdswap: fix compilation warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- drivers/mtd/mtdswap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c index dc4b136800b..237913c5c92 100644 --- a/drivers/mtd/mtdswap.c +++ b/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 unsigned int pick_cnt; - unsigned int i, idx, wear, max; + unsigned int i, idx = -1, wear, max; struct rb_root *root; max = 0; -- 2.20.1