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 a442eea898e12a0dc768fe2353082c01b018c55d
Author: Bowen Wang <[email protected]>
AuthorDate: Mon Sep 8 17:12:33 2025 +0800

    drivers/rpmsg: fix the check in rpmsg_alloc_buf()
    
    The single exit rework inverted the condition: rpmsg_alloc_buf() called
    ops->alloc_buf() exactly when rpmsg or the op was NULL. Call it only
    when both are set.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/rpmsg/rpmsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rpmsg/rpmsg.c b/drivers/rpmsg/rpmsg.c
index 273b91d5b08..535832de563 100644
--- a/drivers/rpmsg/rpmsg.c
+++ b/drivers/rpmsg/rpmsg.c
@@ -515,7 +515,7 @@ FAR void *rpmsg_alloc_buf(FAR struct rpmsg_device *rdev, 
size_t size,
   FAR struct rpmsg_s *rpmsg = rpmsg_get_by_rdev(rdev);
   FAR void *buf = NULL;
 
-  if (!rpmsg || !rpmsg->ops->alloc_buf)
+  if (rpmsg && rpmsg->ops->alloc_buf)
     {
       buf = rpmsg->ops->alloc_buf(rpmsg, size, align);
     }

Reply via email to