[PATCH v2] fuse: drop redundant check in fuse_sync_bucket_alloc()

Li Wang posted 1 patch 1 month, 3 weeks ago
fs/fuse/inode.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
[PATCH v2] fuse: drop redundant check in fuse_sync_bucket_alloc()
Posted by Li Wang 1 month, 3 weeks ago
kzalloc_obj with __GFP_NOFAIL is documented to never return failure,
and checking for NULL is redundant (__GFP_NOFAIL in gfp_types.h).

Signed-off-by: Li Wang <liwang@kylinos.cn>
Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
---
Changes since v1:
- Per review, removed the last two sentences of the commit message.

 fs/fuse/inode.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 33009227e91d..e5069d2f8e90 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -676,11 +676,9 @@ static struct fuse_sync_bucket *fuse_sync_bucket_alloc(void)
 	struct fuse_sync_bucket *bucket;
 
 	bucket = kzalloc_obj(*bucket, GFP_KERNEL | __GFP_NOFAIL);
-	if (bucket) {
-		init_waitqueue_head(&bucket->waitq);
-		/* Initial active count */
-		atomic_set(&bucket->count, 1);
-	}
+	init_waitqueue_head(&bucket->waitq);
+	/* Initial active count */
+	atomic_set(&bucket->count, 1);
 	return bucket;
 }
 
-- 
2.34.1
Re: [PATCH v2] fuse: drop redundant check in fuse_sync_bucket_alloc()
Posted by Miklos Szeredi 1 month, 3 weeks ago
On Tue, 21 Apr 2026 at 05:38, Li Wang <liwang@kylinos.cn> wrote:
>
> kzalloc_obj with __GFP_NOFAIL is documented to never return failure,
> and checking for NULL is redundant (__GFP_NOFAIL in gfp_types.h).
>
> Signed-off-by: Li Wang <liwang@kylinos.cn>
> Reviewed-by: Joanne Koong <joannelkoong@gmail.com>

Applied, thanks.

Miklos