diff mbox

[U-Boot] drivers/crypto/fsl: remove redundant logical contraint

Message ID 20170415143754.27657-1-xypron.glpk@gmx.de
State Accepted
Commit d1710561b0c4b68041d0f51e8fc5cfe3c2c15bb9
Delegated to: Tom Rini
Headers show

Commit Message

Heinrich Schuchardt April 15, 2017, 2:37 p.m. UTC
'A || (!A && B)' is equivalent to 'A || B'.
Let's reduce the complexity of the statement in start_jr0().

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/crypto/fsl/jr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

York Sun April 15, 2017, 4:46 p.m. UTC | #1
On 04/15/2017 07:38 AM, Heinrich Schuchardt wrote:
> 'A || (!A && B)' is equivalent to 'A || B'.
> Let's reduce the complexity of the statement in start_jr0().
>
> The problem was indicated by cppcheck.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/crypto/fsl/jr.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c
> index 1b882291e4..c33777fc7d 100644
> --- a/drivers/crypto/fsl/jr.c
> +++ b/drivers/crypto/fsl/jr.c
> @@ -47,8 +47,7 @@ static inline void start_jr0(uint8_t sec_idx)
>  		 * VIRT_EN_INCL = 1 & VIRT_EN_POR = 0 & SEC_SCFGR_VIRT_EN = 1
>  		 */
>  		if ((ctpr_ms & SEC_CTPR_MS_VIRT_EN_POR) ||
> -		    (!(ctpr_ms & SEC_CTPR_MS_VIRT_EN_POR) &&
> -					(scfgr & SEC_SCFGR_VIRT_EN)))
> +		    (scfgr & SEC_SCFGR_VIRT_EN))
>  			sec_out32(&sec->jrstartr, CONFIG_JRSTARTR_JR0);
>  	} else {
>  		/* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */
>

Reviewed-by: York Sun <york.sun@nxp.com>
Simon Glass April 16, 2017, 7:34 p.m. UTC | #2
On 15 April 2017 at 08:37, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> 'A || (!A && B)' is equivalent to 'A || B'.
> Let's reduce the complexity of the statement in start_jr0().
>
> The problem was indicated by cppcheck.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/crypto/fsl/jr.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini April 19, 2017, 1:04 p.m. UTC | #3
On Sat, Apr 15, 2017 at 04:37:54PM +0200, xypron.glpk@gmx.de wrote:

> 'A || (!A && B)' is equivalent to 'A || B'.
> Let's reduce the complexity of the statement in start_jr0().
> 
> The problem was indicated by cppcheck.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reviewed-by: York Sun <york.sun@nxp.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c
index 1b882291e4..c33777fc7d 100644
--- a/drivers/crypto/fsl/jr.c
+++ b/drivers/crypto/fsl/jr.c
@@ -47,8 +47,7 @@  static inline void start_jr0(uint8_t sec_idx)
 		 * VIRT_EN_INCL = 1 & VIRT_EN_POR = 0 & SEC_SCFGR_VIRT_EN = 1
 		 */
 		if ((ctpr_ms & SEC_CTPR_MS_VIRT_EN_POR) ||
-		    (!(ctpr_ms & SEC_CTPR_MS_VIRT_EN_POR) &&
-					(scfgr & SEC_SCFGR_VIRT_EN)))
+		    (scfgr & SEC_SCFGR_VIRT_EN))
 			sec_out32(&sec->jrstartr, CONFIG_JRSTARTR_JR0);
 	} else {
 		/* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */