diff options
Diffstat (limited to 'common/spl/spl_usb.c')
-rw-r--r-- | common/spl/spl_usb.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c index c81672b798..588b85c4a5 100644 --- a/common/spl/spl_usb.c +++ b/common/spl/spl_usb.c @@ -12,6 +12,7 @@ #include <common.h> #include <spl.h> #include <asm/u-boot.h> +#include <errno.h> #include <usb.h> #include <fat.h> @@ -21,7 +22,7 @@ DECLARE_GLOBAL_DATA_PTR; static int usb_stor_curr_dev = -1; /* current device */ #endif -void spl_usb_load_image(void) +int spl_usb_load_image(void) { int err; block_dev_desc_t *stor_dev; @@ -32,13 +33,15 @@ void spl_usb_load_image(void) #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("%s: usb init failed: err - %d\n", __func__, err); #endif - hang(); + return err; } #ifdef CONFIG_USB_STORAGE /* try to recognize storage devices immediately */ usb_stor_curr_dev = usb_stor_scan(1); stor_dev = usb_stor_get_dev(usb_stor_curr_dev); + if (!stor_dev) + return -ENODEV; #endif debug("boot mode - FAT\n"); @@ -51,8 +54,10 @@ void spl_usb_load_image(void) CONFIG_SYS_USB_FAT_BOOT_PARTITION, CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); - if (err) { - puts("Error loading USB device\n"); - hang(); - } + if (err) { + puts("Error loading from USB device\n"); + return err; + } + + return 0; } |