]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/env_sf.c
include/bitfield.h: Assure new bitfield value doesn't touch unwanted bits
[karo-tx-uboot.git] / common / env_sf.c
index 37ab13ae17842309339fa9a70a42e49b8669207e..e928f5752cc7c5dddaf13b329a8f1eb67b8b669e 100644 (file)
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <environment.h>
 #include <malloc.h>
+#include <spi.h>
 #include <spi_flash.h>
 #include <search.h>
 #include <errno.h>
@@ -187,15 +188,17 @@ void env_relocate_spec(void)
                   tmp_env2->flags == ACTIVE_FLAG) {
                gd->env_valid = 2;
        } else if (tmp_env1->flags == tmp_env2->flags) {
-               gd->env_valid = 2;
+               gd->env_valid = 1;
        } else if (tmp_env1->flags == 0xFF) {
+               gd->env_valid = 1;
+       } else if (tmp_env2->flags == 0xFF) {
                gd->env_valid = 2;
        } else {
                /*
                 * this differs from code in env_flash.c, but I think a sane
                 * default path is desirable.
                 */
-               gd->env_valid = 2;
+               gd->env_valid = 1;
        }
 
        if (gd->env_valid == 1)