Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: silence some uninitialized variable warnings

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>

authored by

Dan Carpenter and committed by
Brian Norris
c3cb77f8 ef158bdf

+2 -2
+2 -2
drivers/mtd/onenand/onenand_base.c
··· 3188 3188 size_t tmp_retlen; 3189 3189 3190 3190 ret = action(mtd, from, len, &tmp_retlen, buf); 3191 + if (ret) 3192 + break; 3191 3193 3192 3194 buf += tmp_retlen; 3193 3195 len -= tmp_retlen; 3194 3196 *retlen += tmp_retlen; 3195 3197 3196 - if (ret) 3197 - break; 3198 3198 } 3199 3199 otp_pages--; 3200 3200 }