[PATCH 2/3] fifo.c: Eliminate logically dead code (Coverity 1437635)
Gedare Bloom
gedare at rtems.org
Thu Mar 14 13:52:34 UTC 2019
On Thu, Mar 14, 2019 at 9:22 AM Joel Sherrill <joel at rtems.org> wrote:
> ---
> 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();
>
you can also remove the 'out:' label, and probably return 0?
> --
> 1.8.3.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20190314/624df54f/attachment-0002.html>
More information about the devel
mailing list