]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_net.c
Convert cmd_usage() calls in common to use a return value
[karo-tx-uboot.git] / common / cmd_net.c
index f89a24bfd4f6568e07eb8aa0bdb556d1537a2602..3dd6810e0512f480c24a33e3c146ee434cc9a837 100644 (file)
@@ -221,14 +221,17 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 
 #ifdef CONFIG_CMD_TFTPPUT
        case 4:
-               save_addr = strict_strtoul(argv[1], NULL, 16);
-               save_size = strict_strtoul(argv[2], NULL, 16);
+               if (strict_strtoul(argv[1], 16, &save_addr) < 0 ||
+                       strict_strtoul(argv[2], 16, &save_size) < 0) {
+                       printf("Invalid address/size\n");
+                       return cmd_usage(cmdtp);
+               }
                copy_filename(BootFile, argv[3], sizeof(BootFile));
                break;
 #endif
        default:
                show_boot_progress (-80);
-               return cmd_usage(cmdtp);
+               return CMD_RET_USAGE;
        }
 
        show_boot_progress (80);
@@ -268,7 +271,7 @@ int do_ping (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        NetPingIP = string_to_ip(argv[1]);
        if (NetPingIP == 0)
-               return cmd_usage(cmdtp);
+               return CMD_RET_USAGE;
 
        if (NetLoop(PING) < 0) {
                printf("ping failed; host %s is not alive\n", argv[1]);
@@ -374,7 +377,7 @@ U_BOOT_CMD(
 int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        if (argc == 1)
-               return cmd_usage(cmdtp);
+               return CMD_RET_USAGE;
 
        /*
         * We should check for a valid hostname: