env: Correct case of no sub-init function
PATCH 1/1 env: Correct case of no sub-init function
With the change to the environment code to remove the common init stage of pointing to the default environment and setting it as valid, combined with the change to switch gd->env_valid from 0/1/2 to an enum we now must set env_valid to one of the enum values rather than an int. And in this case, not only was setting it to an int wrong, it was now the wrong value.
--- env/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
env/env.c +1 -1
@@ -138,7 +138,7 @@ int env_init(void) ret = drv->init ();if (ret == -ENOENT ) { gd->env_addr = (ulong)&default_environment[0 ]; - gd->env_valid =0 ; + gd->env_valid =ENV_VALID ;return 0 ; }else if (ret) {
Signature · 1 line
1.9.1
PATCH 1/1 env: Correct case of no sub-init function
Quoted 8 lines · Tom Rini
With the change to the environment code to remove the common init stage of pointing to the default environment and setting it as valid, combined with the change to switch
gd->env_validfrom 0/1/2 to an enum we now must setenv_validto one of the enum values rather than an int. And in this case, not only was setting it to an int wrong, it was now the wrong value.
Quoted 7 lines
Fixes 7938822a6b75 ("env: Drop common init() functions")Reported-by Marek Vasut <[email protected]>Reported-by Andy Shevchenko <[email protected]>Signed-off-by Tom Rini <[email protected]>--- env/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
(I sent a similar patch just now after my build completed, but please ignore it)
PATCH v2 1/1 env: Correct case of no sub-init function
In reply to Tom RiniWith the change to the environment code to remove the common init stage of pointing to the default environment and setting it as valid, combined with the change to switch gd->env_valid from 0/1/2 to an enum we now must set env_valid to one of the enum values rather than an int. And in this case, not only was setting it to an int wrong, it was now the wrong value. Finally, in the case of ENV_IS_NOWHERE we must still say that our envionrment is invalid after init for things to continue to function.
---
Changes in v2:
- Also correct env/nowhere.c so that sandbox tests function again.
--- env/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
env/env.c +1 -1
@@ -138,7 +138,7 @@ int env_init(void) ret = drv->init ();if (ret == -ENOENT ) { gd->env_addr = (ulong)&default_environment[0 ]; - gd->env_valid =0 ; + gd->env_valid =ENV_VALID ;return 0 ; }else if (ret) {
Signature · 1 line
1.9.1
PATCH v2 1/1 env: Correct case of no sub-init function
Quoted 9 lines · Tom Rini
With the change to the environment code to remove the common init stage of pointing to the default environment and setting it as valid, combined with the change to switch
gd->env_validfrom 0/1/2 to an enum we now must setenv_validto one of the enum values rather than an int. And in this case, not only was setting it to an int wrong, it was now the wrong value. Finally, in the case ofENV_IS_NOWHEREwe must still say that our envionrment is invalid after init for things to continue to function.
Quoted 4 lines
Fixes 7938822a6b75 ("env: Drop common init() functions")Reported-by Marek Vasut <[email protected]>Reported-by Andy Shevchenko <[email protected]>Signed-off-by Tom Rini <[email protected]>
Quoted 21 lines
---
Changes in v2:
- Also correctenv/nowhere.cso that sandbox tests function again.--- env/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)env/env.c +1
-1@@ -138,7 +138,7 @@ int env_init(void) ret = drv->init ();if (ret == -ENOENT ) { gd->env_addr = (ulong)&default_environment[0 ]; - gd->env_valid =0 ; + gd->env_valid =ENV_VALID ;return 0 ; }else if (ret) {
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 1/1 env: Correct case of no sub-init function
In reply to Tom RiniWith the change to the environment code to remove the common init stage of pointing to the default environment and setting it as valid, combined with the change to switch gd->env_valid from 0/1/2 to an enum we now must set env_valid to one of the enum values rather than an int. And in this case, not only was setting it to an int wrong, it was now the wrong value. Finally, in the case of ENV_IS_NOWHERE we must still say that our envionrment is invalid after init for things to continue to function.
---
Changes in v3:
- Actually include changes for env/nowhere.c
--- env/env.c | 2 +- env/nowhere.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
env/env.c +1 -1
@@ -138,7 +138,7 @@ int env_init(void) ret = drv->init ();if (ret == -ENOENT ) { gd->env_addr = (ulong)&default_environment[0 ]; - gd->env_valid =0 ; + gd->env_valid =ENV_VALID ;return 0 ; }else if (ret) {
env/nowhere.c +13 -0
@@ -15,7 +15,20 @@DECLARE_GLOBAL_DATA_PTR ; +/* +* Because we only ever have the default environment available we must mark +* it as invalid. +*/ +static int env_nowhere_init (void ) +{ + gd->env_addr = (ulong)&default_environment[0 ]; + gd->env_valid =ENV_INVALID ; + +return 0 ; +} +U_BOOT_ENV_LOCATION (nowhere) = { .location =ENVL_NOWHERE , + .init = env_nowhere_init,ENV_NAME ("nowhere" ) };
Signature · 1 line
1.9.1
PATCH v3 1/1 env: Correct case of no sub-init function
Quoted 9 lines · Tom Rini
With the change to the environment code to remove the common init stage of pointing to the default environment and setting it as valid, combined with the change to switch
gd->env_validfrom 0/1/2 to an enum we now must setenv_validto one of the enum values rather than an int. And in this case, not only was setting it to an int wrong, it was now the wrong value. Finally, in the case ofENV_IS_NOWHEREwe must still say that our envionrment is invalid after init for things to continue to function.
Quoted 5 lines
Fixes 7938822a6b75 ("env: Drop common init() functions")Tested-by Marek Vasut <[email protected]>Reported-by Marek Vasut <[email protected]>Reported-by Andy Shevchenko <[email protected]>Signed-off-by Tom Rini <[email protected]>
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/20170820/930f7e3e/attachment.sig>
PATCH v3 1/1 env: Correct case of no sub-init function
In reply to Tom RiniQuoted 9 lines · Tom Rini
With the change to the environment code to remove the common init stage of pointing to the default environment and setting it as valid, combined with the change to switch
gd->env_validfrom 0/1/2 to an enum we now must setenv_validto one of the enum values rather than an int. And in this case, not only was setting it to an int wrong, it was now the wrong value. Finally, in the case ofENV_IS_NOWHEREwe must still say that our envionrment is invalid after init for things to continue to function.
Quoted 4 lines
Fixes 7938822a6b75 ("env: Drop common init() functions")Reported-by Marek Vasut <[email protected]>Reported-by Andy Shevchenko <[email protected]>Signed-off-by Tom Rini <[email protected]>
A bit late, but seems it's fixed (Though I'll continue keeping an eye on behaviour)
Quoted 49 lines
---
Changes in v3:
- Actually include changes forenv/nowhere.c--- env/env.c | 2 +- env/nowhere.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)env/env.c +1
-1@@ -138,7 +138,7 @@ int env_init(void) ret = drv->init ();if (ret == -ENOENT ) { gd->env_addr = (ulong)&default_environment[0 ]; - gd->env_valid =0 ; + gd->env_valid =ENV_VALID ;return 0 ; }else if (ret) {env/nowhere.c +13
-1@@ -15,7 +15,20 @@DECLARE_GLOBAL_DATA_PTR ; +/* +* Because we only ever have the default environment available we must mark +* it as invalid. +*/ +static int env_nowhere_init (void ) +{ + gd->env_addr = (ulong)&default_environment[0 ]; + gd->env_valid =ENV_INVALID ; + +return 0 ; +} +U_BOOT_ENV_LOCATION (nowhere) = { .location =ENVL_NOWHERE , + .init = env_nowhere_init,ENV_NAME ("nowhere" ) }; --1.9.1
Signature · 2 lines
With Best Regards, Andy Shevchenko