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

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

commit 38c2e267ad8296c81e2acdf7624c270b5e55b502
Author: Bowen Wang <[email protected]>
AuthorDate: Mon Sep 8 21:12:43 2025 +0800

    drivers/rpmsg/rpmsg_virtio: initialize variables set through a pointer
    
    MISRA C-2012 Rule 9.1: the value of an object with automatic storage
    duration shall not be read before it has been set. Coverity cannot
    see that nxsem_get_value() and virtio_read_config_member() always fill
    in semcount and shmbuf_pa0/1, so initialize them. No functional
    change.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/rpmsg/rpmsg_virtio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rpmsg/rpmsg_virtio.c b/drivers/rpmsg/rpmsg_virtio.c
index a058aea1407..4e8e974c9ce 100644
--- a/drivers/rpmsg/rpmsg_virtio.c
+++ b/drivers/rpmsg/rpmsg_virtio.c
@@ -322,7 +322,7 @@ static int rpmsg_virtio_post(FAR struct rpmsg_s *rpmsg)
 {
   FAR struct rpmsg_virtio_priv_s *priv =
     (FAR struct rpmsg_virtio_priv_s *)rpmsg;
-  int semcount;
+  int semcount = 0;
 
   nxsem_get_value(&priv->semtx, &semcount);
   while (semcount++ < 1)
@@ -743,8 +743,8 @@ static void rpmsg_virtio_start_worker(FAR void *arg)
         {
           FAR void *shmbuf_va0;
           FAR void *shmbuf_va1;
-          uint64_t shmbuf_pa0;
-          uint64_t shmbuf_pa1;
+          uint64_t shmbuf_pa0 = 0ull;
+          uint64_t shmbuf_pa1 = 0ull;
 
           /* In OpenAMP, priv->pool[0] is the RX share memory pool,
            * should use r2h_buf_addr and r2h_buf_size

Reply via email to