public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] cmd: ubi: remove unreachable code
@ 2019-01-06 11:26 Heinrich Schuchardt
  2019-01-16  2:43 ` [U-Boot] [U-Boot,1/1] " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2019-01-06 11:26 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 cmd/ubi.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/cmd/ubi.c b/cmd/ubi.c
index a12ac703eb..c511a2fb76 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -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;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [U-Boot,1/1] cmd: ubi: remove unreachable code
  2019-01-06 11:26 [U-Boot] [PATCH 1/1] cmd: ubi: remove unreachable code Heinrich Schuchardt
@ 2019-01-16  2:43 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2019-01-16  2:43 UTC (permalink / raw)
  To: u-boot

On Sun, Jan 06, 2019 at 12:26:28PM +0100, Heinrich Schuchardt wrote:

> It does not make sense to check if argc < 2 a second time, especially after
> accessing argv[1].
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied to u-boot/master, thanks!

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-16  2:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-06 11:26 [U-Boot] [PATCH 1/1] cmd: ubi: remove unreachable code Heinrich Schuchardt
2019-01-16  2:43 ` [U-Boot] [U-Boot,1/1] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox