From ce1bdedd2f4b3c5c8c76fbf2fc1a234fca470573 Mon Sep 17 00:00:00 2001 From: Andrew Goodbody Date: Thu, 26 Jun 2025 11:49:32 +0100 Subject: [PATCH] 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 --- cmd/mtd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.47.3