diff mbox series

[1/3] arm: mvebu: Espressobin: Fix setting $fdtfile env

Message ID 20210714143729.2396-1-pali@kernel.org
State Accepted
Commit aeff1740b6f4896b13e9c300e60078ebd488f37b
Delegated to: Stefan Roese
Headers show
Series [1/3] arm: mvebu: Espressobin: Fix setting $fdtfile env | expand

Commit Message

Pali Rohár July 14, 2021, 2:37 p.m. UTC
Ensure that 'env default -a' always set correct value to $fdtfile, even
when custom user variable is already stored in non-volatile env storage
(means that env_get("fdtfile") call returns non-NULL value).

As default value is now correctly set like if specified at compile time in
CONFIG_EXTRA_ENV_SETTINGS, there is no need to set $fdtfile explicitly via
env_set("fdtfile", ...) call.

So remove wrong skip based on env_get("fdtfile") and then also unneeded
env_set("fdtfile", ...) call.

Fixes: c4df0f6f315c ("arm: mvebu: Espressobin: Set default value for $fdtfile env variable")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 board/Marvell/mvebu_armada-37xx/board.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Stefan Roese July 15, 2021, 8:02 a.m. UTC | #1
On 14.07.21 16:37, Pali Rohár wrote:
> Ensure that 'env default -a' always set correct value to $fdtfile, even
> when custom user variable is already stored in non-volatile env storage
> (means that env_get("fdtfile") call returns non-NULL value).
> 
> As default value is now correctly set like if specified at compile time in
> CONFIG_EXTRA_ENV_SETTINGS, there is no need to set $fdtfile explicitly via
> env_set("fdtfile", ...) call.
> 
> So remove wrong skip based on env_get("fdtfile") and then also unneeded
> env_set("fdtfile", ...) call.
> 
> Fixes: c4df0f6f315c ("arm: mvebu: Espressobin: Set default value for $fdtfile env variable")
> Signed-off-by: Pali Rohár <pali@kernel.org>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   board/Marvell/mvebu_armada-37xx/board.c | 7 -------
>   1 file changed, 7 deletions(-)
> 
> diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
> index 6a0e2fc3cd8f..53408d37af9b 100644
> --- a/board/Marvell/mvebu_armada-37xx/board.c
> +++ b/board/Marvell/mvebu_armada-37xx/board.c
> @@ -133,9 +133,6 @@ int board_late_init(void)
>   		device_unbind(dev);
>   	}
>   
> -	if (env_get("fdtfile"))
> -		return 0;
> -
>   	/* Ensure that 'env default -a' set correct value to $fdtfile */
>   	if (ddr4 && emmc)
>   		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin-v7-emmc.dtb");
> @@ -146,10 +143,6 @@ int board_late_init(void)
>   	else
>   		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin.dtb");
>   
> -	/* If $fdtfile was not set explicitly by user then set default value */
> -	if (!env_get("fdtfile"))
> -		env_set("fdtfile", ptr + sizeof("fdtfile="));
> -
>   	return 0;
>   }
>   #endif
> 


Viele Grüße,
Stefan
Stefan Roese July 15, 2021, 10:32 a.m. UTC | #2
On 14.07.21 16:37, Pali Rohár wrote:
> Ensure that 'env default -a' always set correct value to $fdtfile, even
> when custom user variable is already stored in non-volatile env storage
> (means that env_get("fdtfile") call returns non-NULL value).
> 
> As default value is now correctly set like if specified at compile time in
> CONFIG_EXTRA_ENV_SETTINGS, there is no need to set $fdtfile explicitly via
> env_set("fdtfile", ...) call.
> 
> So remove wrong skip based on env_get("fdtfile") and then also unneeded
> env_set("fdtfile", ...) call.
> 
> Fixes: c4df0f6f315c ("arm: mvebu: Espressobin: Set default value for $fdtfile env variable")
> Signed-off-by: Pali Rohár <pali@kernel.org>

All patches:

Applied to u-boot-marvell/master

Thanks,
Stefan

> ---
>   board/Marvell/mvebu_armada-37xx/board.c | 7 -------
>   1 file changed, 7 deletions(-)
> 
> diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
> index 6a0e2fc3cd8f..53408d37af9b 100644
> --- a/board/Marvell/mvebu_armada-37xx/board.c
> +++ b/board/Marvell/mvebu_armada-37xx/board.c
> @@ -133,9 +133,6 @@ int board_late_init(void)
>   		device_unbind(dev);
>   	}
>   
> -	if (env_get("fdtfile"))
> -		return 0;
> -
>   	/* Ensure that 'env default -a' set correct value to $fdtfile */
>   	if (ddr4 && emmc)
>   		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin-v7-emmc.dtb");
> @@ -146,10 +143,6 @@ int board_late_init(void)
>   	else
>   		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin.dtb");
>   
> -	/* If $fdtfile was not set explicitly by user then set default value */
> -	if (!env_get("fdtfile"))
> -		env_set("fdtfile", ptr + sizeof("fdtfile="));
> -
>   	return 0;
>   }
>   #endif
> 


Viele Grüße,
Stefan
diff mbox series

Patch

diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
index 6a0e2fc3cd8f..53408d37af9b 100644
--- a/board/Marvell/mvebu_armada-37xx/board.c
+++ b/board/Marvell/mvebu_armada-37xx/board.c
@@ -133,9 +133,6 @@  int board_late_init(void)
 		device_unbind(dev);
 	}
 
-	if (env_get("fdtfile"))
-		return 0;
-
 	/* Ensure that 'env default -a' set correct value to $fdtfile */
 	if (ddr4 && emmc)
 		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin-v7-emmc.dtb");
@@ -146,10 +143,6 @@  int board_late_init(void)
 	else
 		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin.dtb");
 
-	/* If $fdtfile was not set explicitly by user then set default value */
-	if (!env_get("fdtfile"))
-		env_set("fdtfile", ptr + sizeof("fdtfile="));
-
 	return 0;
 }
 #endif