]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - common/spl/spl_sata.c
spl: change return values of spl_*_load_image()
[people/ms/u-boot.git] / common / spl / spl_sata.c
index 2a5eb2985721104e035be19a8ca7a696f813ae8c..3ba4c249b7dbea18c4a4f417fb65fa53c8e24c53 100644 (file)
 #include <asm/u-boot.h>
 #include <sata.h>
 #include <scsi.h>
+#include <errno.h>
 #include <fat.h>
 #include <image.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void spl_sata_load_image(void)
+int spl_sata_load_image(void)
 {
        int err;
        block_dev_desc_t *stor_dev;
@@ -29,11 +30,13 @@ void spl_sata_load_image(void)
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                printf("spl: sata init failed: err - %d\n", err);
 #endif
-               hang();
+               return err;
        } else {
                /* try to recognize storage devices immediately */
                scsi_scan(0);
                stor_dev = scsi_get_dev(0);
+               if (!stor_dev)
+                       return -ENODEV;
        }
 
 #ifdef CONFIG_SPL_OS_BOOT
@@ -45,6 +48,8 @@ void spl_sata_load_image(void)
                                CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
        if (err) {
                puts("Error loading sata device\n");
-               hang();
+               return err;
        }
+
+       return 0;
 }