[U-Boot] [PATCH 5/9] SATA: check for return value from sata functions

Stefano Babic sbabic at denx.de
Wed Feb 22 11:24:37 CET 2012


sata functions are called even if previous functions failed
because return value is not checked.

Signed-off-by: Stefano Babic <sbabic at denx.de>
CC: Dirk Behme <dirk.behme at de.bosch.com>
CC: Fabio Estevam <fabio.estevam at freescale.com>
---
 common/cmd_sata.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/common/cmd_sata.c b/common/cmd_sata.c
index f62c0cb..dfa5300 100644
--- a/common/cmd_sata.c
+++ b/common/cmd_sata.c
@@ -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;
-- 
1.7.5.4



More information about the U-Boot mailing list