[U-Boot] [PATCH] davinci: cleanup davinci_sync_env_enetaddr() fucntion
Manjunath Hadli
manjunath.hadli at ti.com
Mon Feb 6 10:59:53 CET 2012
check for the return status for eth_getenv_enetaddr_by_index()
and eth_setenv_enetaddr() functions and print appropriate message
on failure. Also convert debug message to printf().
Signed-off-by: Manjunath Hadli <manjunath.hadli at ti.com>
Cc: Tom Rini <trini at ti.com>
---
arch/arm/cpu/arm926ejs/davinci/misc.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/davinci/misc.c b/arch/arm/cpu/arm926ejs/davinci/misc.c
index 5f510b6..3036e8a 100644
--- a/arch/arm/cpu/arm926ejs/davinci/misc.c
+++ b/arch/arm/cpu/arm926ejs/davinci/misc.c
@@ -101,18 +101,22 @@ void davinci_emac_mii_mode_sel(int mode_sel)
void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
{
uint8_t env_enetaddr[6];
+ int ret;
- eth_getenv_enetaddr_by_index("eth", 0, env_enetaddr);
- if (!memcmp(env_enetaddr, "\0\0\0\0\0\0", 6)) {
+ ret = eth_getenv_enetaddr_by_index("eth", 0, env_enetaddr);
+ if (ret && !memcmp(env_enetaddr, "\0\0\0\0\0\0", 6)) {
/*
* There is no MAC address in the environment, so we
* initialize it from the value in the EEPROM.
*/
- debug("### Setting environment from EEPROM MAC address = "
+ printf("### Setting environment from EEPROM MAC address = "
"\"%pM\"\n",
env_enetaddr);
- eth_setenv_enetaddr("ethaddr", rom_enetaddr);
+ ret = !eth_setenv_enetaddr("ethaddr", rom_enetaddr);
}
+ if (!ret)
+ printf("Failed to set mac address from EEPROM\n");
+
}
#endif /* CONFIG_DRIVER_TI_EMAC */
--
1.6.2.4
More information about the U-Boot
mailing list