You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/11/19 16:11:12 UTC
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7622: Fix clang compiler warning
pkarashchenko commented on code in PR #7622:
URL: https://github.com/apache/incubator-nuttx/pull/7622#discussion_r1027109940
##########
arch/arm/src/imxrt/imxrt_enc.c:
##########
@@ -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)
Review Comment:
```suggestion
if ((priv->config->init_flags >> XIE_SHIFT) & 1 != 0)
```
##########
arch/arm/src/s32k1xx/s32k1xx_enet.c:
##########
@@ -1217,8 +1217,8 @@ static int s32k1xx_ifup_action(struct net_driver_s *dev, bool resetphy)
int ret;
ninfo("Bringing up: %d.%d.%d.%d\n",
- dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
- (dev->d_ipaddr >> 16) & 0xff, dev->d_ipaddr >> 24);
+ (int)(dev->d_ipaddr & 0xff), (int)((dev->d_ipaddr >> 8) & 0xff),
+ (int)((dev->d_ipaddr >> 16) & 0xff), (int)(dev->d_ipaddr >> 24));
Review Comment:
Let's go with `"Bringing up: %u.%u.%u.%u\n"` instead of adding `(int)`
##########
arch/arm/src/kinetis/kinetis_enet.c:
##########
@@ -872,7 +872,7 @@ static void kinetis_interrupt_work(void *arg)
{
/* An error has occurred, update statistics */
- nerr("pending %0" PRIx32 "d ints %0lxd\n", pending, priv->ints);
+ nerr("pending %0" PRIx32 "d ints %0" PRIx32 "\n", pending, priv->ints);
Review Comment:
Why not
```suggestion
nerr("pending %0" PRIx32 "d ints %0" PRIx32 "d\n", pending, priv->ints);
```
?
And even more: why `d` is needed in `%0" PRIx32 "d`?
##########
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)
Review Comment:
```suggestion
if ((config->init_flags >> XIE_SHIFT) & 1 != 0)
```
##########
arch/arm/src/samd5e5/sam_gmac.c:
##########
@@ -1753,8 +1753,8 @@ static int sam_ifup(struct net_driver_s *dev)
int ret;
ninfo("Bringing up: %d.%d.%d.%d\n",
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org