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


The following commit(s) were added to refs/heads/master by this push:
     new 8a411926ba3 mtd/rpmsgmtd: propagate the remote result for ioctl and 
geometry
8a411926ba3 is described below

commit 8a411926ba387a8d04fb7fe1348233b8acc43983
Author: wangshaoxin <[email protected]>
AuthorDate: Fri Oct 30 09:50:38 2026 +0800

    mtd/rpmsgmtd: propagate the remote result for ioctl and geometry
    
    The ioctl and geometry response handlers never copied header->result
    into the cookie, so it kept its zero-initialised value and both
    rpmsgmtd_ioctl() and rpmsgmtd_get_geometry() always reported success.
    A failed geometry request then cached the fields the server leaves
    unset, and every later bread/bwrite used that blocksize.
    
    Signed-off-by: wangshaoxin <[email protected]>
    Signed-off-by: jingfei <[email protected]>
---
 drivers/mtd/rpmsgmtd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/rpmsgmtd.c b/drivers/mtd/rpmsgmtd.c
index f0b20877893..1f5e1f153ee 100644
--- a/drivers/mtd/rpmsgmtd.c
+++ b/drivers/mtd/rpmsgmtd.c
@@ -919,6 +919,7 @@ static int rpmsgmtd_geometry_handler(FAR struct 
rpmsg_endpoint *ept,
   FAR struct rpmsgmtd_cookie_s *cookie =
       (FAR struct rpmsgmtd_cookie_s *)(uintptr_t)header->cookie;
 
+  cookie->result = header->result;
   if (cookie->result >= 0)
     {
       memcpy(cookie->data, data, len);
@@ -956,6 +957,7 @@ static int rpmsgmtd_ioctl_handler(FAR struct rpmsg_endpoint 
*ept,
       (FAR struct rpmsgmtd_cookie_s *)(uintptr_t)header->cookie;
   FAR struct rpmsgmtd_ioctl_s *rsp = data;
 
+  cookie->result = header->result;
   if (cookie->result >= 0 && rsp->arglen > 0)
     {
       memcpy(cookie->data, (FAR void *)(uintptr_t)rsp->buf, rsp->arglen);

Reply via email to