From aa6ab905b2833ea74ec92fc9d40d6245ff294a07 Mon Sep 17 00:00:00 2001 From: Tang Yuantian Date: Mon, 21 Nov 2016 10:24:20 +0800 Subject: 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 Reviewed-by: Simon Glass --- cmd/sata.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/sata.c b/cmd/sata.c index d18b523..f56622a 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: -- cgit v1.1