]> git.sur5r.net Git - u-boot/blobdiff - cmd/fat.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot] / cmd / fat.c
index 4e207462d93e9a1301d32b2a379e29149251a351..03de5d11afb453e271fee21e7f00ce03c453fa18 100644 (file)
--- a/cmd/fat.c
+++ b/cmd/fat.c
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2002
  * Richard Jones, rjones@nexus-tech.net
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
@@ -126,7 +125,7 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
                return 1;
        }
        addr = simple_strtoul(argv[3], NULL, 16);
-       count = simple_strtoul(argv[5], NULL, 16);
+       count = (argc <= 5) ? 0 : simple_strtoul(argv[5], NULL, 16);
 
        buf = map_sysmem(addr, count);
        ret = file_fat_write(argv[4], buf, 0, count, &size);
@@ -145,7 +144,7 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
 U_BOOT_CMD(
        fatwrite,       6,      0,      do_fat_fswrite,
        "write file into a dos filesystem",
-       "<interface> <dev[:part]> <addr> <filename> <bytes>\n"
+       "<interface> <dev[:part]> <addr> <filename> [<bytes>]\n"
        "    - write file 'filename' from the address 'addr' in RAM\n"
        "      to 'dev' on 'interface'"
 );