Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 May 2019 09:29:39 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 238168] kern/kern_conf.c: two 'if' statements with identical conditional expressions
Message-ID:  <bug-238168-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D238168

            Bug ID: 238168
           Summary: kern/kern_conf.c: two 'if' statements with identical
                    conditional expressions
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: danfe@FreeBSD.org

PVS Studio reports: /usr/src/sys/kern/kern_conf.c:627:1: warning: V649 There
are two 'if' statements with identical conditional expressions. The first '=
if'
statement contains function return. This means that the second 'if' stateme=
nt
is senseless. Check lines: 616, 627.

>        if (devsw->d_flags & D_INIT)
>                return (0);
         if (devsw->d_flags & D_NEEDGIANT) {
                 dev_unlock();
                 dsw2 =3D malloc(sizeof *dsw2, M_DEVT,
                      (flags & MAKEDEV_NOWAIT) ? M_NOWAIT : M_WAITOK);
                 dev_lock();
                 if (dsw2 =3D=3D NULL && !(devsw->d_flags & D_INIT))
                         return (ENOMEM);
         } else
                 dsw2 =3D NULL;
>        if (devsw->d_flags & D_INIT) {
>                if (dsw2 !=3D NULL)
>                        cdevsw_free_devlocked(dsw2);
>                return (0);
         }

This code appeared in base r177301.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-238168-227>