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

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

commit db13e67e432efffbcf23488c39cae9972e6fb5b8
Author: wangshaoxin <[email protected]>
AuthorDate: Fri Aug 22 16:45:09 2025 +0800

    drivers/rptun: use unsigned constants in unsigned comparisons
    
    Compare and define unsigned values with unsigned constants (MISRA C
    2012 rule 10.4) in rptun.c and rptun.h, and define RPTUN_NOTIFY_ALL as
    UINT32_MAX directly.  No functional change.
    
    Signed-off-by: wangshaoxin <[email protected]>
---
 drivers/rptun/rptun.c       | 12 ++++++------
 include/nuttx/rptun/rptun.h | 20 ++++++++++----------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c
index e3f3fdf8a3a..484ee3797e2 100644
--- a/drivers/rptun/rptun.c
+++ b/drivers/rptun/rptun.c
@@ -414,7 +414,7 @@ static void rptun_update_vring_da(FAR struct remoteproc 
*rproc,
       rptuninfo("vr[%u] shm=%p len=%zu da=0x%lx pa=0x%lx sz=%" PRIu32 "\n",
                 i, *shmbase, *shmlen, vring_da, vring_pa, vring_sz);
 
-      if (vring->da == 0 || vring->da == FW_RSC_U32_ADDR_ANY)
+      if (vring->da == 0u || vring->da == FW_RSC_U32_ADDR_ANY)
         {
           vring->da = vring_da;
           *shmbase += vring_sz;
@@ -444,7 +444,7 @@ static int rptun_create_device(FAR struct rptun_priv_s 
*priv,
   int ret;
 
   off = find_rsc(rsc, RSC_VDEV, index);
-  if (off == 0)
+  if (off == 0u)
     {
       return index ? -ENODEV : -EINVAL;
     }
@@ -484,7 +484,7 @@ static int rptun_create_device(FAR struct rptun_priv_s 
*priv,
    */
 
   off = find_rsc(rsc, RSC_CARVEOUT, index);
-  if (off != 0)
+  if (off != 0u)
     {
       carveout_rsc = (FAR struct fw_rsc_carveout *)(rsc + off);
 
@@ -710,7 +710,7 @@ static void rptun_send_command(FAR struct rptun_priv_s 
*priv,
     {
       uint32_t timeout = CONFIG_RPTUN_CMD_TIMEOUT_MS;
 
-      while (timeout-- > 0)
+      while (timeout-- > 0u)
         {
           uint32_t ack = rptun_recv_command(priv, false);
 
@@ -752,7 +752,7 @@ static uint32_t rptun_recv_command(FAR struct rptun_priv_s 
*priv, bool ack)
 
   if (ack)
     {
-      rptun_send_command(priv, RPTUN_CMD(RPTUN_CMD_ACK, 0), false);
+      rptun_send_command(priv, RPTUN_CMD(RPTUN_CMD_ACK, 0u), false);
     }
 
   return cmd;
@@ -894,7 +894,7 @@ static int rptun_dev_start(FAR struct rptun_priv_s *priv)
   argv[1] = arg1;
   argv[2] = NULL;
 
-  if (dev->stack != NULL && dev->stack_size != 0)
+  if (dev->stack != NULL && dev->stack_size != 0u)
     {
       priv->pid = kthread_create_with_stack("rptun",
                                             CONFIG_RPTUN_PRIORITY,
diff --git a/include/nuttx/rptun/rptun.h b/include/nuttx/rptun/rptun.h
index 0730cd110c4..a8b958f3918 100644
--- a/include/nuttx/rptun/rptun.h
+++ b/include/nuttx/rptun/rptun.h
@@ -48,16 +48,16 @@
 #define RPTUNIOC_RESET        _RPTUNIOC(102)
 #define RPTUNIOC_PANIC        _RPTUNIOC(103)
 
-#define RPTUN_NOTIFY_ALL      (UINT32_MAX - 0)
-
-#define RPTUN_CMD_DONE        0x0
-#define RPTUN_CMD_READY       0x1
-#define RPTUN_CMD_PANIC       0x2
-#define RPTUN_CMD_RESET       0x3
-#define RPTUN_CMD_STOP        0x4
-#define RPTUN_CMD_ACK         0xffff
-#define RPTUN_CMD_MASK        0xffff
-#define RPTUN_CMD_SHIFT       16
+#define RPTUN_NOTIFY_ALL      UINT32_MAX
+
+#define RPTUN_CMD_DONE        0x0u
+#define RPTUN_CMD_READY       0x1u
+#define RPTUN_CMD_PANIC       0x2u
+#define RPTUN_CMD_RESET       0x3u
+#define RPTUN_CMD_STOP        0x4u
+#define RPTUN_CMD_ACK         0xffffu
+#define RPTUN_CMD_MASK        0xffffu
+#define RPTUN_CMD_SHIFT       16u
 
 #define RPTUN_CMD(c,v)        (((c) << RPTUN_CMD_SHIFT) | ((v) & 
RPTUN_CMD_MASK))
 #define RPTUN_GET_CMD(c)      ((c) >> RPTUN_CMD_SHIFT)

Reply via email to