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 2022/02/03 05:14:44 UTC

[incubator-nuttx] branch master updated: serial/pty: fix the lock handling

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 5457a9a  serial/pty: fix the lock handling
5457a9a is described below

commit 5457a9a450b0dbb3ab36cd98a4b76dddccfd149d
Author: chao.an <an...@xiaomi.com>
AuthorDate: Thu Feb 3 11:48:44 2022 +0800

    serial/pty: fix the lock handling
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 drivers/serial/pty.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/pty.c b/drivers/serial/pty.c
index ca238d9..d6be352 100644
--- a/drivers/serial/pty.c
+++ b/drivers/serial/pty.c
@@ -298,6 +298,7 @@ static int pty_open(FAR struct file *filep)
           ret = nxsem_wait(&devpair->pp_slavesem);
           if (ret < 0)
             {
+              sched_unlock();
               return ret;
             }
 
@@ -308,6 +309,7 @@ static int pty_open(FAR struct file *filep)
           ret = pty_semtake(devpair);
           if (ret < 0)
             {
+              sched_unlock();
               return ret;
             }
 
@@ -335,7 +337,7 @@ static int pty_open(FAR struct file *filep)
       ret = pty_semtake(devpair);
       if (ret < 0)
         {
-          goto errout_with_sem;
+          return ret;
         }
     }
 
@@ -362,7 +364,6 @@ static int pty_open(FAR struct file *filep)
       ret = OK;
     }
 
-errout_with_sem:
   pty_semgive(devpair);
   return ret;
 }