[U-Boot] [PATCH 2/2] env_mmc: default to 0 if CONFIG_SYS_MMC_ENV_DEV not defined

Hector Palacios hector.palacios at digi.com
Wed Jan 15 11:53:56 CET 2014


Since function mmc_get_env_devno is __weak and can be overridden by
board code, boards do not necessarily need to define
CONFIG_SYS_MMC_ENV_DEV. If the constant is not defined, return 0 by
default.

Signed-off-by: Hector Palacios <hector.palacios at digi.com>
---
 common/env_mmc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/env_mmc.c b/common/env_mmc.c
index d569b070e005..bd3bc1d50b15 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -63,7 +63,11 @@ __weak int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr)
 
 __weak int mmc_get_env_devno(void)
 {
+#ifdef CONFIG_SYS_MMC_ENV_DEV
 	return CONFIG_SYS_MMC_ENV_DEV;
+#endif
+	return 0;
+}
 
 __weak int mmc_get_env_partno(void)
 {


More information about the U-Boot mailing list