fix 'nand info' command
Move device argument parsing after check for number of arguments; otherwise, calling this command without any arguments would access argv[0] before checking whether it even existed.
This commit is contained in:
parent
46ed068bac
commit
f31dfffdef
|
@ -1121,11 +1121,6 @@ COMMAND_HANDLER(handle_nand_info_command)
|
||||||
int first = -1;
|
int first = -1;
|
||||||
int last = -1;
|
int last = -1;
|
||||||
|
|
||||||
struct nand_device *p;
|
|
||||||
int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p);
|
|
||||||
if (ERROR_OK != retval)
|
|
||||||
return retval;
|
|
||||||
|
|
||||||
switch (CMD_ARGC) {
|
switch (CMD_ARGC) {
|
||||||
default:
|
default:
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
@ -1144,6 +1139,11 @@ COMMAND_HANDLER(handle_nand_info_command)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct nand_device *p;
|
||||||
|
int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p);
|
||||||
|
if (ERROR_OK != retval)
|
||||||
|
return retval;
|
||||||
|
|
||||||
if (NULL == p->device)
|
if (NULL == p->device)
|
||||||
{
|
{
|
||||||
command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
|
command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
|
||||||
|
|
Loading…
Reference in New Issue