You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/11/20 13:34:57 UTC

[incubator-nuttx] 05/26: Fix chip/imxrt_enc.c:950:27: error: use of logical '&&' with constant operand

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 9a50c30168cfbf275670e111ab72f902bebb2041
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Nov 19 12:23:29 2022 +0800

    Fix chip/imxrt_enc.c:950:27: error: use of logical '&&' with constant operand
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/arm/src/imxrt/imxrt_enc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm/src/imxrt/imxrt_enc.c b/arch/arm/src/imxrt/imxrt_enc.c
index d1cc4f3ba5..5640efaa49 100644
--- a/arch/arm/src/imxrt/imxrt_enc.c
+++ b/arch/arm/src/imxrt/imxrt_enc.c
@@ -951,7 +951,7 @@ static int imxrt_setup(struct qe_lowerhalf_s *lower)
   imxrt_enc_putreg16(priv, IMXRT_ENC_TST_OFFSET, regval);
 #endif
 
-  if ((config->init_flags && XIE_SHIFT) == 1)
+  if (((config->init_flags >> XIE_SHIFT) & 1) != 0)
     {
       ret = irq_attach(config->irq, imxrt_enc_index, priv);
       if (ret < 0)
@@ -1011,10 +1011,9 @@ static int imxrt_shutdown(struct qe_lowerhalf_s *lower)
 
   /* Disable interrupts if used */
 
-  if ((priv->config->init_flags && XIE_SHIFT) == 1)
+  if (((priv->config->init_flags >> XIE_SHIFT) & 1) != 0)
     {
       up_disable_irq(priv->config->irq);
-
       irq_detach(priv->config->irq);
     }