Skip to contentSkip to conversation

cmd: ubifs: Do not show usage when command fails

PATCH In review Pali Rohár 4 participants 7 messages Aug 7, 2022 – Nov 24, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: ubifs: Do not show usage when command fails

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.

---
 cmd/ubifs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
cmd/ubifs.c +4 -4
index 7a620c5e21da..6a01d0988a2d 100644
@@ -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)
Signature · 1 line
2.20.1
#1 lore raw

PING?

Quoted 52 lines · On Sunday 07 August 2022 21:58:56 Pali Rohár wrote:

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.

---
 cmd/ubifs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
cmd/ubifs.c +4 -4
index 7a620c5e21da..6a01d0988a2d 100644
@@ -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)
Signature · 1 line
2.20.1
#2 lore raw

ping?

Quoted 55 lines · On Sunday 09 October 2022 13:18:47 Pali Rohár wrote:

PING?

Quoted 52 lines · On Sunday 07 August 2022 21:58:56 Pali Rohár wrote:

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.

---
 cmd/ubifs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
cmd/ubifs.c +4 -4
index 7a620c5e21da..6a01d0988a2d 100644
@@ -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)
Signature · 1 line
2.20.1
#3 lore raw
In reply to Pali Rohár

+ Tom

Quoted 58 lines · On Tuesday 01 November 2022 23:20:15 Pali Rohár wrote:

ping?

Quoted 55 lines · On Sunday 09 October 2022 13:18:47 Pali Rohár wrote:

PING?

Quoted 52 lines · On Sunday 07 August 2022 21:58:56 Pali Rohár wrote:

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.

---
 cmd/ubifs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
cmd/ubifs.c +4 -4
index 7a620c5e21da..6a01d0988a2d 100644
@@ -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)
Signature · 1 line
2.20.1