[rtems commit] fifo.c: Eliminate logically dead code (Coverity 1437635)

Joel Sherrill joel at rtems.org
Thu Mar 14 19:26:12 UTC 2019


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

Author:    Joel Sherrill <joel at rtems.org>
Date:      Wed Mar 13 10:06:45 2019 -0500

fifo.c: Eliminate logically dead code (Coverity 1437635)

---

 cpukit/libfs/src/pipe/fifo.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/cpukit/libfs/src/pipe/fifo.c b/cpukit/libfs/src/pipe/fifo.c
index 71d5f85..3275e5f 100644
--- a/cpukit/libfs/src/pipe/fifo.c
+++ b/cpukit/libfs/src/pipe/fifo.c
@@ -149,18 +149,15 @@ static int pipe_new(
   pipe = *pipep;
   if (pipe == NULL) {
     err = pipe_alloc(&pipe);
-    if (err)
-      goto out;
+    if (err) {
+      pipe_unlock();
+      return err;
+    }
   }
 
   PIPE_LOCK(pipe);
 
-  if (*pipep == NULL) {
-    if (err)
-      pipe_free(pipe);
-    else
-      *pipep = pipe;
-  }
+  *pipep = pipe;
 
 out:
   pipe_unlock();



More information about the vc mailing list