aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@foss.st.com>2023-03-22 19:12:25 +0100
committerTom Rini <trini@konsulko.com>2023-04-06 15:08:46 -0400
commit94c8da21216ac077842c413a4339e71285bcf94d (patch)
tree9667b7d73b5af6fc6f975d05a1f519a2744fe8c0 /lib
parentb0b77fdf3d7d2c1a5e48c3971a677f14e372c164 (diff)
downloadu-boot-94c8da21216ac077842c413a4339e71285bcf94d.zip
u-boot-94c8da21216ac077842c413a4339e71285bcf94d.tar.gz
u-boot-94c8da21216ac077842c413a4339e71285bcf94d.tar.bz2
lmb: Fix LMB_MEMORY_REGIONS flag usage
Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit 7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb"). This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty and the required initialization is not done: lmb->memory.max = ? lmb->reserved.max = ? But this setting is not possible: - CONFIG_LMB_USE_MAX_REGIONS not defined - CONFIG_LMB_MEMORY_REGIONS not defined because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined. This patch removes this impossible case #elif and I add some explanation in lmb.h to explain why in the struct lmb {} the lmb property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined. This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these defines are used in API file lmb.h and not only in library file. Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage") Reported-by: Mark Millard <marklmi@yahoo.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Acked-by: Michal Simek <michal.simek@amd.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig7
-rw-r--r--lib/lmb.c2
2 files changed, 4 insertions, 5 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index 202a34a..d8dac09 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -1057,7 +1057,6 @@ config LMB
config LMB_USE_MAX_REGIONS
bool "Use a common number of memory and reserved regions in lmb lib"
- depends on LMB
default y
help
Define the number of supported memory regions in the library logical
@@ -1067,7 +1066,7 @@ config LMB_USE_MAX_REGIONS
config LMB_MAX_REGIONS
int "Number of memory and reserved regions in lmb lib"
- depends on LMB && LMB_USE_MAX_REGIONS
+ depends on LMB_USE_MAX_REGIONS
default 16
help
Define the number of supported regions, memory and reserved, in the
@@ -1075,7 +1074,7 @@ config LMB_MAX_REGIONS
config LMB_MEMORY_REGIONS
int "Number of memory regions in lmb lib"
- depends on LMB && !LMB_USE_MAX_REGIONS
+ depends on !LMB_USE_MAX_REGIONS
default 8
help
Define the number of supported memory regions in the library logical
@@ -1084,7 +1083,7 @@ config LMB_MEMORY_REGIONS
config LMB_RESERVED_REGIONS
int "Number of reserved regions in lmb lib"
- depends on LMB && !LMB_USE_MAX_REGIONS
+ depends on !LMB_USE_MAX_REGIONS
default 8
help
Define the number of supported reserved regions in the library logical
diff --git a/lib/lmb.c b/lib/lmb.c
index 2444b2a..8fbe453 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -110,7 +110,7 @@ void lmb_init(struct lmb *lmb)
#if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
lmb->memory.max = CONFIG_LMB_MAX_REGIONS;
lmb->reserved.max = CONFIG_LMB_MAX_REGIONS;
-#elif defined(CONFIG_LMB_MEMORY_REGIONS)
+#else
lmb->memory.max = CONFIG_LMB_MEMORY_REGIONS;
lmb->reserved.max = CONFIG_LMB_RESERVED_REGIONS;
lmb->memory.region = lmb->memory_regions;