Skip to contentSkip to conversation

cmd: ubi: remove unreachable code

PATCH New Heinrich Schuchardt 2 participants 2 messages Jan 6, 2019 – Jan 16, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: ubi: remove unreachable code

It does not make sense to check if argc < 2 a second time, especially after accessing argv[1].

---
 cmd/ubi.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
cmd/ubi.c +1 -5
index a12ac703eb..c511a2fb76 100644
@@ -472,12 +472,8 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (argc < 2)
 		return CMD_RET_USAGE;
 
-	if (strcmp(argv[1], "detach") == 0) {
-		if (argc < 2)
-			return CMD_RET_USAGE;
-
+	if (strcmp(argv[1], "detach") == 0)
 		return ubi_detach();
-	}
 
 	if (strcmp(argv[1], "part") == 0) {
 		const char *vid_header_offset = NULL;
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 cmd: ubi: remove unreachable code

Quoted 4 lines · Heinrich Schuchardt

It does not make sense to check if argc < 2 a second time, especially after accessing argv[1].

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/c95de6ed/attachment.sig>