public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: u-boot@lists.denx.de
Subject: [PATCH] cmd: ubifs: Do not show usage when command fails
Date: Sun,  7 Aug 2022 21:58:56 +0200	[thread overview]
Message-ID: <20220807195856.19782-1-pali@kernel.org> (raw)

Return value -1 cause U-Boot to print usage message. Return value
1 (CMD_RET_FAILURE) indicates failure. So fix return value when ubifs
command starts it execution and fails.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 cmd/ubifs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmd/ubifs.c b/cmd/ubifs.c
index 7a620c5e21da..6a01d0988a2d 100644
--- a/cmd/ubifs.c
+++ b/cmd/ubifs.c
@@ -33,7 +33,7 @@ int cmd_ubifs_mount(char *vol_name)
 
 	ret = uboot_ubifs_mount(vol_name);
 	if (ret)
-		return -1;
+		return CMD_RET_FAILURE;
 
 	ubifs_mounted = 1;
 
@@ -62,7 +62,7 @@ int cmd_ubifs_umount(void)
 {
 	if (ubifs_initialized == 0) {
 		printf("No UBIFS volume mounted!\n");
-		return -1;
+		return CMD_RET_FAILURE;
 	}
 
 	uboot_ubifs_umount();
@@ -89,7 +89,7 @@ static int do_ubifs_ls(struct cmd_tbl *cmdtp, int flag, int argc,
 
 	if (!ubifs_mounted) {
 		printf("UBIFS not mounted, use ubifsmount to mount volume first!\n");
-		return -1;
+		return CMD_RET_FAILURE;
 	}
 
 	if (argc == 2)
@@ -116,7 +116,7 @@ static int do_ubifs_load(struct cmd_tbl *cmdtp, int flag, int argc,
 
 	if (!ubifs_mounted) {
 		printf("UBIFS not mounted, use ubifs mount to mount volume first!\n");
-		return -1;
+		return CMD_RET_FAILURE;
 	}
 
 	if (argc < 3)
-- 
2.20.1


             reply	other threads:[~2022-08-07 19:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-07 19:58 Pali Rohár [this message]
2022-10-09 11:18 ` [PATCH] cmd: ubifs: Do not show usage when command fails Pali Rohár
2022-11-01 22:20   ` Pali Rohár
2022-11-21 17:37     ` Pali Rohár
2022-11-01 23:25 ` Simon Glass
2022-11-03 12:20 ` Dhruva Gole
2022-11-24 21:32 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220807195856.19782-1-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox