You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/02/15 08:03:15 UTC

[incubator-nuttx] branch master updated: graphics: nxmu: Fix hard fault in nxmu_server.c

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

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


The following commit(s) were added to refs/heads/master by this push:
     new e598d81  graphics: nxmu: Fix hard fault in nxmu_server.c
e598d81 is described below

commit e598d81543173debd2b9f974b2d89922cb564d7c
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Mon Feb 15 12:34:04 2021 +0900

    graphics: nxmu: Fix hard fault in nxmu_server.c
    
    Summary:
    - Recently I noticed that the nxhello caused hard fault
    - Finally, I found that mq_open() had been changed to nxmq_open()
      but the calling convention was not correct.
    - This commit fixes this issue.
    
    Impact:
    - nxmu_server.c only
    
    Testing:
    - Tested with nxhello, nxlines & nxdemo with the following configs
    - spresense:wifi, spresense:wifi_smp
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 graphics/nxmu/nxmu_server.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/graphics/nxmu/nxmu_server.c b/graphics/nxmu/nxmu_server.c
index 3e49538..2fc5174 100644
--- a/graphics/nxmu/nxmu_server.c
+++ b/graphics/nxmu/nxmu_server.c
@@ -86,10 +86,10 @@ static inline void nxmu_connect(FAR struct nxmu_conn_s *conn)
    * client
    */
 
-  ret = nxmq_open(mqname, O_WRONLY, 0, NULL, &conn->swrmq);
-  if (ret < 0)
+  conn->swrmq = nxmq_open(mqname, O_WRONLY);
+  if (conn->swrmq < 0)
     {
-      gerr("ERROR: nxmq_open(%s) failed: %d\n", mqname, ret);
+      gerr("ERROR: nxmq_open(%s) failed: %d\n", mqname, conn->swrmq);
       outmsg.msgid = NX_CLIMSG_DISCONNECTED;
     }
 
@@ -190,12 +190,11 @@ static inline int nxmu_setup(FAR const char *mqname, FAR NX_DRIVERTYPE *dev,
   attr.mq_msgsize = NX_MXSVRMSGLEN;
   attr.mq_flags   = 0;
 
-  ret = nxmq_open(mqname, O_RDONLY | O_CREAT,
-                  0666, &attr, &nxmu->conn.crdmq);
-  if (ret < 0)
+  nxmu->conn.crdmq = nxmq_open(mqname, O_RDONLY | O_CREAT, 0666, &attr);
+  if (nxmu->conn.crdmq < 0)
     {
-      gerr("ERROR: nxmq_open(%s) failed: %d\n", mqname, ret);
-      return ret;
+      gerr("ERROR: nxmq_open(%s) failed: %d\n", mqname, nxmu->conn.crdmq);
+      return nxmu->conn.crdmq;
     }
 
   /* NOTE that the outgoing client MQ (cwrmq) is not initialized.  The
@@ -207,12 +206,12 @@ static inline int nxmu_setup(FAR const char *mqname, FAR NX_DRIVERTYPE *dev,
    * the server message loop.
    */
 
-  ret = nxmq_open(mqname, O_WRONLY, 0, NULL, &nxmu->conn.swrmq);
-  if (ret < 0)
+  nxmu->conn.swrmq = nxmq_open(mqname, O_WRONLY);
+  if (nxmu->conn.swrmq < 0)
     {
-      gerr("ERROR: nxmq_open(%s) failed: %d\n", mqname, ret);
-      nxmq_close(nxmu->conn.crdmq);
-      return ret;
+      gerr("ERROR: nxmq_open(%s) failed: %d\n", mqname, nxmu->conn.swrmq);
+      mq_close(nxmu->conn.crdmq);
+      return nxmu->conn.swrmq;
     }
 
   /* The server is now "connected" to itself via the background window */