Skip to contentSkip to conversation

spl: Correct call to spl_common_init() with SPL_STACK_R_MALLOC_SIMPLE_LEN

PATCH Superseded Tom Rini 2 participants 4 messages Mar 20, 2017 – Mar 21, 2017

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 spl: Correct call to spl_common_init() with SPL_STACK_R_MALLOC_SIMPLE_LEN

Calls to IS_ENABLED() on a non-y/n option will always be false, even when set. We can correct this by adding a new bool value that is set based on the conditions required for SPL_STACK_R_MALLOC_SIMPLE_LEN to be set instead.

Fixes 340f418acd11 ("spl: Add spl_early_init()")
---
 common/spl/spl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
common/spl/spl.c +3 -2
index d98b9fcb9ade..91180d4b476b 100644
@@ -227,10 +227,11 @@ int spl_early_init(void)
 int spl_init(void)
 {
 	int ret;
+	bool setup_malloc = !(IS_ENABLED(CONFIG_SPL_STACK_R) &&
+			IS_ENABLED(SPL_SYS_MALLOC_SIMPLE));
 
 	if (!(gd->flags & GD_FLG_SPL_EARLY_INIT)) {
-		ret = spl_common_init(
-			!IS_ENABLED(CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN));
+		ret = spl_common_init(setup_malloc);
 		if (ret)
 			return ret;
 	}
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 spl: Correct call to spl_common_init() with SPL_STACK_R_MALLOC_SIMPLE_LEN

Quoted 17 lines · Tom Rini

Calls to IS_ENABLED() on a non-y/n option will always be false, even when set. We can correct this by adding a new bool value that is set based on the conditions required for SPL_STACK_R_MALLOC_SIMPLE_LEN to be set instead.

Fixes 340f418acd11 ("spl: Add spl_early_init()")
---
 common/spl/spl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
common/spl/spl.c +0 -0
index d98b9fcb9ade..91180d4b476b 100644

common/spl/spl.c int spl_early_init(void) · line 231

Quoted 5 lines
common/spl/spl.c +2 -0
@@ -227,10 +227,11 @@ int spl_early_init(void)
 int spl_init(void)
 {
 	int ret;
+	bool setup_malloc = !(IS_ENABLED(CONFIG_SPL_STACK_R) &&
+			IS_ENABLED(SPL_SYS_MALLOC_SIMPLE));

This should be CONFIG_SPL_SYS_MALLOC_SIMPLE. With this change it works fine.

Thanks and regards,
Lokesh

author
#2 lore raw

PATCH v2 1/1 spl: Correct call to spl_common_init() with SPL_STACK_R_MALLOC_SIMPLE_LEN

In reply to Tom Rini

Calls to IS_ENABLED() on a non-y/n option will always be false, even when set. We can correct this by adding a new bool value that is set based on the conditions required for SPL_STACK_R_MALLOC_SIMPLE_LEN to be set instead.

Fixes 340f418acd11 ("spl: Add spl_early_init()")

---
Changes in v2:
- Fix thinko pointed out by Lokesh

---
 common/spl/spl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
common/spl/spl.c +3 -2
index d98b9fcb9ade..0d1e08245f6a 100644
@@ -227,10 +227,11 @@ int spl_early_init(void)
 int spl_init(void)
 {
 	int ret;
+	bool setup_malloc = !(IS_ENABLED(CONFIG_SPL_STACK_R) &&
+			IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIMPLE));
 
 	if (!(gd->flags & GD_FLG_SPL_EARLY_INIT)) {
-		ret = spl_common_init(
-			!IS_ENABLED(CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN));
+		ret = spl_common_init(setup_malloc);
 		if (ret)
 			return ret;
 	}
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH v2 1/1 spl: Correct call to spl_common_init() with SPL_STACK_R_MALLOC_SIMPLE_LEN

Quoted 8 lines · Tom Rini

Calls to IS_ENABLED() on a non-y/n option will always be false, even when set. We can correct this by adding a new bool value that is set based on the conditions required for SPL_STACK_R_MALLOC_SIMPLE_LEN to be set instead.

Fixes 340f418acd11 ("spl: Add spl_early_init()")

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170321/2056e9ff/attachment.sig>