If filename is passed instead of address to ext2load or fatload,
u-boot silently accepts that, and uses 0 for load address and default
filename from environment. That is confusing, display help instead.
Signed-off-by: Pavel Machek <pavel@denx.de>
unsigned long pos;
int len_read;
unsigned long time;
+ char *ep;
if (argc < 2)
return CMD_RET_USAGE;
return 1;
if (argc >= 4) {
- addr = simple_strtoul(argv[3], NULL, 16);
+ addr = simple_strtoul(argv[3], &ep, 16);
+ if (ep == argv[3] || *ep != '\0')
+ return CMD_RET_USAGE;
} else {
addr_str = getenv("loadaddr");
if (addr_str != NULL)