[PATCH 3/9] termios: Avoid second return path

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jun 10 13:11:51 UTC 2013


---
 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 108ba92..ab0a38d 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -1394,20 +1394,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;
-- 
1.7.7




More information about the devel mailing list