fs/kernfs/dir.c: Clean code by removing always true condition
authorMateusz Nosek <mateusznosek0@gmail.com>
Mon, 30 Dec 2019 19:16:28 +0000 (20:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jan 2020 15:14:47 +0000 (16:14 +0100)
Previously there was an additional check if variable pos is not null.
However, this check happens after entering while loop and only then,
which can happen only if pos is not null.
Therefore the additional check is redundant and can be removed.

Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20191230191628.21099-1-mateusznosek0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/kernfs/dir.c

index 9d96e68..9aec80b 100644 (file)
@@ -1266,7 +1266,7 @@ void kernfs_activate(struct kernfs_node *kn)
 
        pos = NULL;
        while ((pos = kernfs_next_descendant_post(pos, kn))) {
-               if (!pos || (pos->flags & KERNFS_ACTIVATED))
+               if (pos->flags & KERNFS_ACTIVATED)
                        continue;
 
                WARN_ON_ONCE(pos->parent && RB_EMPTY_NODE(&pos->rb));