mtd: silence some uninitialized variable warnings
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 13 Apr 2016 06:42:34 +0000 (09:42 +0300)
committerBrian Norris <computersforpeace@gmail.com>
Sun, 10 Jul 2016 01:14:39 +0000 (18:14 -0700)
The "tmp_retlen" variable can be uninitialized if action() fails.  It's
harmless except for the static checker warning.  I have moved the error
handling earlier to fix it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/onenand/onenand_base.c

index a4b029a..1a6d0e3 100644 (file)
@@ -3188,13 +3188,13 @@ static int onenand_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,
                        size_t tmp_retlen;
 
                        ret = action(mtd, from, len, &tmp_retlen, buf);
                        size_t tmp_retlen;
 
                        ret = action(mtd, from, len, &tmp_retlen, buf);
+                       if (ret)
+                               break;
 
                        buf += tmp_retlen;
                        len -= tmp_retlen;
                        *retlen += tmp_retlen;
 
 
                        buf += tmp_retlen;
                        len -= tmp_retlen;
                        *retlen += tmp_retlen;
 
-                       if (ret)
-                               break;
                }
                otp_pages--;
        }
                }
                otp_pages--;
        }