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: 9671243e8d (cmd: mtd: Use the subcmd infrastructure to declare mtd sub-commands)
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
This commit is contained in:
Andrew Goodbody
2025-06-26 11:49:32 +01:00
committed by Tom Rini
parent f12ca3e2b8
commit ce1bdedd2f

View File

@@ -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;