All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: linux-fsdevel@vger.kernel.org
Cc: Christian Brauner <christian@brauner.io>
Subject: [PATCH 3/6] get_file_rcu(): no need to check for NULL separately
Date: Sat, 6 Apr 2024 06:00:33 +0100	[thread overview]
Message-ID: <20240406050033.GC1632446@ZenIV> (raw)
In-Reply-To: <20240406045622.GY538574@ZenIV>

IS_ERR(NULL) is false and IS_ERR() already comes with unlikely()...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/file.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/fs/file.c b/fs/file.c
index ab38b005633c..8076aef9c210 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -920,13 +920,8 @@ struct file *get_file_rcu(struct file __rcu **f)
 		struct file __rcu *file;
 
 		file = __get_file_rcu(f);
-		if (unlikely(!file))
-			return NULL;
-
-		if (unlikely(IS_ERR(file)))
-			continue;
-
-		return file;
+		if (!IS_ERR(file))
+			return file;
 	}
 }
 EXPORT_SYMBOL_GPL(get_file_rcu);
-- 
2.39.2


  parent reply	other threads:[~2024-04-06  5:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-06  4:56 [PATCHES] misc stuff that should've been pushed in the last window Al Viro
2024-04-06  4:57 ` [PATCH 1/6] close_on_exec(): pass files_struct instead of fdtable Al Viro
2024-04-09  9:21   ` Christian Brauner
2024-04-06  4:57 ` [PATCH 2/6] fd_is_open(): move to fs/file.c Al Viro
2024-04-09  9:21   ` Christian Brauner
2024-04-06  5:00 ` Al Viro [this message]
2024-04-09  9:23   ` [PATCH 3/6] get_file_rcu(): no need to check for NULL separately Christian Brauner
2024-04-06  5:01 ` [PATCH 4/6] kernel_file_open(): get rid of inode argument Al Viro
2024-04-09  9:24   ` Christian Brauner
2024-04-06  5:01 ` [PATCH 5/6] do_dentry_open(): kill " Al Viro
2024-04-09  9:25   ` Christian Brauner
2024-04-06  5:02 ` [PATCH 6/6] remove call_{read,write}_iter() functions Al Viro
2024-04-09  9:26   ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240406050033.GC1632446@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=christian@brauner.io \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.