Merge https://gitlab.denx.de/u-boot/custodians/u-boot-sh
[platform/kernel/u-boot.git] / env / env.c
index d3cbe2f..2e64346 100644 (file)
--- a/env/env.c
+++ b/env/env.c
@@ -5,7 +5,11 @@
  */
 
 #include <common.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
+#include <log.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -99,7 +103,7 @@ static void env_set_inited(enum env_location location)
         * using the above enum value as the bit index. We need to
         * make sure that we're not overflowing it.
         */
-       BUILD_BUG_ON(ARRAY_SIZE(env_locations) > BITS_PER_LONG);
+       BUILD_BUG_ON(ENVL_COUNT > BITS_PER_LONG);
 
        gd->env_has_init |= BIT(location);
 }
@@ -236,13 +240,17 @@ int env_save(void)
        if (drv) {
                int ret;
 
-               if (!drv->save)
+               printf("Saving Environment to %s... ", drv->name);
+               if (!drv->save) {
+                       printf("not possible\n");
                        return -ENODEV;
+               }
 
-               if (!env_has_inited(drv->location))
+               if (!env_has_inited(drv->location)) {
+                       printf("not initialized\n");
                        return -ENODEV;
+               }
 
-               printf("Saving Environment to %s... ", drv->name);
                ret = drv->save();
                if (ret)
                        printf("Failed (%d)\n", ret);