From 5bb12dbd7ae03189b6c13d8737b5a1b37c3df698 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 7 Jul 2008 15:40:39 +0800 Subject: Remove code duplication for setting the default environment common/env_common.c (default_env): new function that resets the environment to the default value common/env_common.c (env_relocate): use default_env instead of own copy common/env_nand.c (env_relocate_spec): use default_env instead of own copy include/environment.h: added default_env prototype Signed-off-by: Werner Almesberger Signed-off-by: Harald Welte --- common/env_nand.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'common/env_nand.c') diff --git a/common/env_nand.c b/common/env_nand.c index 8954017..3890b84 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -363,19 +363,7 @@ void env_relocate_spec (void) static void use_default() { puts ("*** Warning - bad CRC or NAND, using default environment\n\n"); - - if (default_environment_size > CFG_ENV_SIZE){ - puts ("*** Error - default environment is too large\n\n"); - return; - } - - memset (env_ptr, 0, sizeof(env_t)); - memcpy (env_ptr->data, - default_environment, - default_environment_size); - env_ptr->crc = crc32(0, env_ptr->data, ENV_SIZE); - gd->env_valid = 1; - + set_default_env(); } #endif -- cgit v1.1