summaryrefslogtreecommitdiff
path: root/cmd/sata.c
diff options
context:
space:
mode:
authorTang Yuantian <Yuantian.Tang@nxp.com>2016-11-21 10:24:20 +0800
committerTom Rini <trini@konsulko.com>2016-11-28 19:49:47 -0500
commitaa6ab905b2833ea74ec92fc9d40d6245ff294a07 (patch)
tree71ab726c714b0f6fc0614dc3df29b7ae6c6d283b /cmd/sata.c
parent333ee16d042076669b36328dc06765a78c0676eb (diff)
downloadu-boot-aa6ab905b2833ea74ec92fc9d40d6245ff294a07.tar.gz
u-boot-aa6ab905b2833ea74ec92fc9d40d6245ff294a07.tar.bz2
u-boot-aa6ab905b2833ea74ec92fc9d40d6245ff294a07.zip
sata: fix sata command can not being executed bug
Commit d97dc8a0 separated the non-command code into its own file which caused variable sata_curr_device can not be set to a correct value. Before commit d97dc8a0, variable sata_curr_device can be set correctly in sata_initialize(). After commit d97dc8a0, sata_initialize() is moved out to its own file. Accordingly, variable sata_curr_device is removed from sata_initialize() too. This caused sata_curr_device never gets a chance to be set properly which prevent other commands from being executed. This patch sets variable sata_curr_device properly. Fixes: d97dc8a0 (dm: sata: Separate the non-command code into its own file) Signed-off-by: Tang Yuantian <yuantian.tang@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd/sata.c')
-rw-r--r--cmd/sata.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd/sata.c b/cmd/sata.c
index d18b5233e6..f56622acc2 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -32,9 +32,12 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
/* If the user has not yet run `sata init`, do it now */
- if (sata_curr_device == -1)
- if (sata_initialize())
- return 1;
+ if (sata_curr_device == -1) {
+ rc = sata_initialize();
+ if (rc == -1)
+ return rc;
+ sata_curr_device = rc;
+ }
switch (argc) {
case 0: