public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/kernfs/dir.c: Clean code by removing always true condition
@ 2019-12-30 19:16 mateusznosek0
  2020-01-07 15:51 ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: mateusznosek0 @ 2019-12-30 19:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mateusz Nosek, gregkh, tj

From: Mateusz Nosek <mateusznosek0@gmail.com>

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>
---
 fs/kernfs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 9d96e6871e1a..9aec80b9d7c6 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -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));
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs/kernfs/dir.c: Clean code by removing always true condition
  2019-12-30 19:16 [PATCH] fs/kernfs/dir.c: Clean code by removing always true condition mateusznosek0
@ 2020-01-07 15:51 ` Tejun Heo
  2020-01-07 21:03   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2020-01-07 15:51 UTC (permalink / raw)
  To: mateusznosek0; +Cc: linux-kernel, gregkh

On Mon, Dec 30, 2019 at 08:16:28PM +0100, mateusznosek0@gmail.com wrote:
> From: Mateusz Nosek <mateusznosek0@gmail.com>
> 
> 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>

Greg, can you please route this one?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs/kernfs/dir.c: Clean code by removing always true condition
  2020-01-07 15:51 ` Tejun Heo
@ 2020-01-07 21:03   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2020-01-07 21:03 UTC (permalink / raw)
  To: Tejun Heo; +Cc: mateusznosek0, linux-kernel

On Tue, Jan 07, 2020 at 07:51:10AM -0800, Tejun Heo wrote:
> On Mon, Dec 30, 2019 at 08:16:28PM +0100, mateusznosek0@gmail.com wrote:
> > From: Mateusz Nosek <mateusznosek0@gmail.com>
> > 
> > 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>
> 
> Greg, can you please route this one?

Sure, will do, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-07 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-30 19:16 [PATCH] fs/kernfs/dir.c: Clean code by removing always true condition mateusznosek0
2020-01-07 15:51 ` Tejun Heo
2020-01-07 21:03   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox