[rtems commit] termios: Avoid second return path

Sebastian Huber sebh at rtems.org
Wed Jun 12 14:08:10 UTC 2013


Module:    rtems
Branch:    master
Commit:    2a8713aa54a00563328714390601e0433085aca0
Changeset: http://git.rtems.org/rtems/commit/?id=2a8713aa54a00563328714390601e0433085aca0

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jun 10 14:10:49 2013 +0200

termios: Avoid second return path

---

 cpukit/libcsupport/src/termios.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index de85279..20243ca 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -1322,20 +1322,19 @@ rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
     rtems_interrupt_enable(level);
 
     nToSend = 1;
-  } else {
-    if ( tty->rawOutBuf.Head == tty->rawOutBuf.Tail ) {
+  } else if ( tty->rawOutBuf.Head == tty->rawOutBuf.Tail ) {
+    /*
+     * buffer was empty
+     */
+    if (tty->rawOutBufState == rob_wait) {
       /*
-       * buffer was empty
+       * this should never happen...
        */
-      if (tty->rawOutBufState == rob_wait) {
-        /*
-         * this should never happen...
-         */
-        rtems_semaphore_release (tty->rawOutBuf.Semaphore);
-      }
-      return 0;
+      rtems_semaphore_release (tty->rawOutBuf.Semaphore);
     }
 
+    nToSend = 0;
+  } else {
     rtems_interrupt_disable(level);
     len = tty->t_dqlen;
     tty->t_dqlen = 0;




More information about the vc mailing list