diff mbox series

[3/6] get_file_rcu(): no need to check for NULL separately

Message ID 20240406050033.GC1632446@ZenIV (mailing list archive)
State New
Headers show
Series [1/6] close_on_exec(): pass files_struct instead of fdtable | expand

Commit Message

Al Viro April 6, 2024, 5 a.m. UTC
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(-)

Comments

Christian Brauner April 9, 2024, 9:23 a.m. UTC | #1
On Sat, Apr 06, 2024 at 06:00:33AM +0100, Al Viro wrote:
> IS_ERR(NULL) is false and IS_ERR() already comes with unlikely()...
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---

Looks good to me,
Reviewed-by: Christian Brauner <brauner@kernel.org>
diff mbox series

Patch

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);