SATA: check for return value from sata functions
authorStefano Babic <sbabic@denx.de>
Wed, 22 Feb 2012 00:24:37 +0000 (00:24 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Tue, 15 May 2012 06:31:30 +0000 (08:31 +0200)
sata functions are called even if previous functions failed
because return value is not checked.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Dirk Behme <dirk.behme@de.bosch.com>
CC: Fabio Estevam <fabio.estevam@freescale.com>
common/cmd_sata.c

index 7b1703f..3f98235 100644 (file)
@@ -48,9 +48,12 @@ int __sata_initialize(void)
                sata_dev_desc[i].block_write = sata_write;
 
                rc = init_sata(i);
-               rc = scan_sata(i);
-               if ((sata_dev_desc[i].lba > 0) && (sata_dev_desc[i].blksz > 0))
-                       init_part(&sata_dev_desc[i]);
+               if (!rc) {
+                       rc = scan_sata(i);
+                       if (!rc && (sata_dev_desc[i].lba > 0) &&
+                               (sata_dev_desc[i].blksz > 0))
+                               init_part(&sata_dev_desc[i]);
+               }
        }
        sata_curr_device = 0;
        return rc;