summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2018-03-27 00:56:19 -0700
committerYe Li <ye.li@nxp.com>2018-04-27 02:21:25 -0700
commit9bccfd01c618a5d059f332c000c42e5bf39880d9 (patch)
treec87e8141a7a4a8fd277d7e7a1e6e8368c9add920 /cmd
parent8cca3efba0d508b2c267f8a32b302970dd05244d (diff)
MLK-14930-1 cmd: sata: Fix sata init and stop issue
When sata stop is executed, the sata_curr_device is not reset to -1, so any following sata commands will not initialize the sata again and cause problem. Additional, in sata init implementation, the sata_curr_device should be updated, otherwise sata will be initialized again when doing other sata commands like read/write/info/part/device. Signed-off-by: Ye Li <ye.li@nxp.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/sata.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/cmd/sata.c b/cmd/sata.c
index 7817442532..1df9674b5d 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -91,8 +91,10 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (argc == 3)
devnum = (int)simple_strtoul(argv[2], NULL, 10);
- if (!strcmp(argv[1], "stop"))
+ if (!strcmp(argv[1], "stop")) {
+ sata_curr_device = -1;
return sata_remove(devnum);
+ }
if (!strcmp(argv[1], "init")) {
if (sata_curr_device != -1) {
@@ -101,7 +103,11 @@ static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return rc;
}
- return sata_probe(devnum);
+ rc = sata_probe(devnum);
+ if (rc < 0)
+ return CMD_RET_FAILURE;
+ sata_curr_device = rc;
+ return CMD_RET_SUCCESS;
}
}