[U-Boot,1/1] arm64: zynqmp: remove unnecessary logical constraint

Message ID 20171012231427.3627-1-xypron.glpk@gmx.de
State Awaiting Upstream
Delegated to: Michal Simek
Headers show
Series
  • [U-Boot,1/1] arm64: zynqmp: remove unnecessary logical constraint
Related show

Commit Message

Heinrich Schuchardt Oct. 12, 2017, 11:14 p.m.
In

if (a || b)
else if (!a)

the constraint (!a) is always true if else is reached and
can be removed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 arch/arm/cpu/armv8/zynqmp/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michal Simek Oct. 13, 2017, 7:19 a.m. | #1
On 13.10.2017 01:14, Heinrich Schuchardt wrote:
> In
> 
> if (a || b)
> else if (!a)
> 
> the constraint (!a) is always true if else is reached and
> can be removed.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  arch/arm/cpu/armv8/zynqmp/cpu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv8/zynqmp/cpu.c b/arch/arm/cpu/armv8/zynqmp/cpu.c
> index 1b5066a826..9b83e51885 100644
> --- a/arch/arm/cpu/armv8/zynqmp/cpu.c
> +++ b/arch/arm/cpu/armv8/zynqmp/cpu.c
> @@ -198,7 +198,7 @@ int zynqmp_mmio_write(const u32 address,
>  {
>  	if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3)
>  		return zynqmp_mmio_rawwrite(address, mask, value);
> -	else if (!IS_ENABLED(CONFIG_SPL_BUILD))
> +	else
>  		return invoke_smc(ZYNQMP_MMIO_WRITE, address, mask,
>  				  value, 0, NULL);
>  
> @@ -215,7 +215,7 @@ int zynqmp_mmio_read(const u32 address, u32 *value)
>  
>  	if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3) {
>  		ret = zynqmp_mmio_rawread(address, value);
> -	} else if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
> +	} else {
>  		ret = invoke_smc(ZYNQMP_MMIO_READ, address, 0, 0,
>  				 0, ret_payload);
>  		*value = ret_payload[1];
> 

Applied.

Thanks,
Michal

Patch

diff --git a/arch/arm/cpu/armv8/zynqmp/cpu.c b/arch/arm/cpu/armv8/zynqmp/cpu.c
index 1b5066a826..9b83e51885 100644
--- a/arch/arm/cpu/armv8/zynqmp/cpu.c
+++ b/arch/arm/cpu/armv8/zynqmp/cpu.c
@@ -198,7 +198,7 @@  int zynqmp_mmio_write(const u32 address,
 {
 	if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3)
 		return zynqmp_mmio_rawwrite(address, mask, value);
-	else if (!IS_ENABLED(CONFIG_SPL_BUILD))
+	else
 		return invoke_smc(ZYNQMP_MMIO_WRITE, address, mask,
 				  value, 0, NULL);
 
@@ -215,7 +215,7 @@  int zynqmp_mmio_read(const u32 address, u32 *value)
 
 	if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3) {
 		ret = zynqmp_mmio_rawread(address, value);
-	} else if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
+	} else {
 		ret = invoke_smc(ZYNQMP_MMIO_READ, address, 0, 0,
 				 0, ret_payload);
 		*value = ret_payload[1];