From: Andrew Goodbody Date: Thu, 26 Jun 2025 10:49:32 +0000 (+0100) Subject: cmd: mtd: Prevent use of uninitialised variable X-Git-Tag: v2026.01-rc2~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce1bdedd2f4b3c5c8c76fbf2fc1a234fca470573;p=thirdparty%2Fu-boot.git cmd: mtd: Prevent use of uninitialised variable ret maybe used uninitialised in some cases so instead initialise it first to prevent this. This issue was found by Smatch. Fixes: 9671243e8d10 (cmd: mtd: Use the subcmd infrastructure to declare mtd sub-commands) Signed-off-by: Andrew Goodbody Reviewed-by: Quentin Schulz --- diff --git a/cmd/mtd.c b/cmd/mtd.c index acd886da6da..d0072129659 100644 --- a/cmd/mtd.c +++ b/cmd/mtd.c @@ -477,7 +477,7 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc, struct mtd_info *mtd; u32 oob_len; u8 *buf; - int ret; + int ret = CMD_RET_SUCCESS; if (argc < 2) return CMD_RET_USAGE;