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 591597fa9416d87397417eea2549c1116ad59a00
Author: Bowen Wang <[email protected]>
AuthorDate: Tue Mar 10 20:01:11 2026 +0800

    drivers/mtd/rpmsgmtd: initialize sval before nxsem_get_value()
    
    Coverity reports sval as possibly used uninitialized when
    nxsem_get_value() fails. Initialize it to 0, which means "not bound
    yet".
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/mtd/rpmsgmtd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/rpmsgmtd.c b/drivers/mtd/rpmsgmtd.c
index 1710ccf7c7f..0188b85d547 100644
--- a/drivers/mtd/rpmsgmtd.c
+++ b/drivers/mtd/rpmsgmtd.c
@@ -678,7 +678,7 @@ static int rpmsgmtd_ioctl(FAR struct mtd_dev_s *dev, int 
cmd,
 static FAR void *rpmsgmtd_get_tx_payload_buffer(FAR struct rpmsgmtd_s *priv,
                                                 FAR uint32_t *len)
 {
-  int sval;
+  int sval = 0;
 
   nxsem_get_value(&priv->wait, &sval);
   if (sval <= 0)

Reply via email to