]> git.baikalelectronics.ru Git - uboot.git/commitdiff
cmd: fpga: Move error handling to do_fpga()
authorMichal Simek <michal.simek@xilinx.com>
Wed, 30 May 2018 07:57:42 +0000 (09:57 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 11 Sep 2018 08:58:41 +0000 (10:58 +0200)
Clean fpga_get_op() error handling by moving checking/print to do_fpga.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
cmd/fpga.c

index 791fe5cb77182e5a56a33b3d748242ec2e37da14..abe6837202854536f6c426508f3ffe1df1c65fce 100644 (file)
@@ -74,6 +74,9 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
        op = (int)fpga_get_op(argv[1]);
 
        switch (op) {
+       case FPGA_NONE:
+               printf("Unknown fpga operation \"%s\"\n", argv[1]);
+               return CMD_RET_USAGE;
 #if defined(CONFIG_CMD_FPGA_LOADFS)
        case FPGA_LOADFS:
                if (argc < 9)
@@ -360,9 +363,6 @@ static int fpga_get_op(char *opstr)
                op = FPGA_LOADS;
 #endif
 
-       if (op == FPGA_NONE)
-               printf("Unknown fpga operation \"%s\"\n", opstr);
-
        return op;
 }