mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
cmd: sata: fix init command return value
Since commitaa6ab905b2
, sata_initialize returns -1 if init_sata or scan_sata fails. But this return value becomes the do_sata return value which is equivalent to CMD_RET_USAGE. In case one issues 'sata init' and that the hardware fails to initialize, there's no need to display the command usage. Instead the command shoud just return the CMD_RET_FAILURE value. Fixes:aa6ab905b2
(sata: fix sata command can not being executed bug) Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com> Reviewed-by: Eric Nelson <eric@nelint.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
7f73ca484f
commit
8547f45bc5
1 changed files with 3 additions and 2 deletions
|
@ -28,14 +28,15 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||
if (sata_curr_device != -1)
|
||||
sata_stop();
|
||||
|
||||
return sata_initialize();
|
||||
return (sata_initialize() < 0) ?
|
||||
CMD_RET_FAILURE : CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
/* If the user has not yet run `sata init`, do it now */
|
||||
if (sata_curr_device == -1) {
|
||||
rc = sata_initialize();
|
||||
if (rc == -1)
|
||||
return rc;
|
||||
return CMD_RET_FAILURE;
|
||||
sata_curr_device = rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue