Skip to contentSkip to conversation

cmd: change the return value when argc error

PATCH In review Shenlin Liang 3 participants 4 messages Dec 9, 2022 – Jan 12, 2023

lore
Share & tools
lore
#0 lore raw

cover cmd: change the return value when argc error

When the number of parameters is wrong, the return value should be processed in the same way as other cmds, return CMD_RET_USAGE so that it can print the information.

Shenlin Liang (1):
cmd: change the return value when arguments missing

 cmd/mvebu/comphy_rx_training.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.31.1.windows.1
#1 lore raw

PATCH 1/1 cmd: change the return value when argc error

When the number of parameters is wrong, the return value should be processed in the same way as other cmds, return CMD_RET_USAGE so that it can print the information.

---
 cmd/mvebu/comphy_rx_training.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/mvebu/comphy_rx_training.c +1 -1
index 25a9e153de..4ee8f54ea9 100644
@@ -22,7 +22,7 @@ int mvebu_comphy_rx_training_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
 
 	if (argc != 3) {
 		printf("missing arguments\n");
-		return -1;
+		return CMD_RET_USAGE;
 	}
 
 	cp_index = hextoul(argv[1], NULL);
Signature · 1 line
2.31.1.windows.1
Reviewed-by on v1 1/1
#2 lore raw
Quoted 9 lines · Shenlin Liang

When the number of parameters is wrong, the return value should be processed in the same way as other cmds, return CMD_RET_USAGE so that it can print the information.

---
 cmd/mvebu/comphy_rx_training.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)