spl_mmc: only call printf or puts with CONFIG_SPL_LIBCOMMON_SUPPORT
authorPaul Burton <paul.burton@imgtec.com>
Wed, 4 Sep 2013 15:12:24 +0000 (16:12 +0100)
committerPantelis Antoniou <panto@antoniou-consulting.com>
Tue, 17 Sep 2013 17:03:44 +0000 (20:03 +0300)
If we don't have CONFIG_SPL_LIBCOMMON_SUPPORT defined then stdio
functions are unavailable & calling them will cause a link failure.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
common/spl/spl_mmc.c

index 5e7e0feee34530fffc9f7963e6028a01674d2ba3..fc2f2260f888a308d26d7a63fb5db6e5b95b78df 100644 (file)
@@ -44,8 +44,10 @@ static int mmc_load_image_raw(struct mmc *mmc, unsigned long sector)
                                        (void *)spl_image.load_addr);
 
 end:
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
        if (err == 0)
                printf("spl: mmc blk read err - %lu\n", err);
+#endif
 
        return (err == 0);
 }
@@ -57,7 +59,9 @@ static int mmc_load_image_raw_os(struct mmc *mmc)
                                       CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR,
                                       CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS,
                                       (void *)CONFIG_SYS_SPL_ARGS_ADDR)) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                printf("mmc args blk read error\n");
+#endif
                return -1;
        }
 
@@ -83,9 +87,11 @@ static int mmc_load_image_fat(struct mmc *mmc, const char *filename)
        err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0);
 
 end:
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
        if (err <= 0)
                printf("spl: error reading image %s, err - %d\n",
                       filename, err);
+#endif
 
        return (err <= 0);
 }
@@ -98,8 +104,10 @@ static int mmc_load_image_fat_os(struct mmc *mmc)
        err = file_fat_read(CONFIG_SPL_FAT_LOAD_ARGS_NAME,
                            (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
        if (err <= 0) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                printf("spl: error reading image %s, err - %d\n",
                       CONFIG_SPL_FAT_LOAD_ARGS_NAME, err);
+#endif
                return -1;
        }
 
@@ -119,13 +127,17 @@ void spl_mmc_load_image(void)
        /* We register only one device. So, the dev id is always 0 */
        mmc = find_mmc_device(0);
        if (!mmc) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                puts("spl: mmc device not found!!\n");
+#endif
                hang();
        }
 
        err = mmc_init(mmc);
        if (err) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                printf("spl: mmc init failed: err - %d\n", err);
+#endif
                hang();
        }
 
@@ -144,7 +156,9 @@ void spl_mmc_load_image(void)
                err = fat_register_device(&mmc->block_dev,
                                          CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION);
                if (err) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                        printf("spl: fat register err - %d\n", err);
+#endif
                        hang();
                }
 
@@ -154,7 +168,9 @@ void spl_mmc_load_image(void)
                err = mmc_load_image_fat(mmc, CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
 #endif
        } else {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                puts("spl: wrong MMC boot mode\n");
+#endif
                hang();
        }