]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - cmd/sata.c
Merge git://git.denx.de/u-boot-usb
[people/ms/u-boot.git] / cmd / sata.c
index d18b5233e6aa973457f29893c22d8463d825ecaa..4c53022ff60a365ea030e80c3e9b112d55f9b50f 100644 (file)
@@ -28,13 +28,17 @@ 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)
-               if (sata_initialize())
-                       return 1;
+       if (sata_curr_device == -1) {
+               rc = sata_initialize();
+               if (rc == -1)
+                       return CMD_RET_FAILURE;
+               sata_curr_device = rc;
+       }
 
        switch (argc) {
        case 0: