diff options
| author | Yichong Chen <chenyichong@uniontech.com> | 2026-07-20 15:38:41 +0800 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-07-26 22:50:27 -0700 |
| commit | a6de1d8130177f8f50dcf37b2f8f3593da8d71d0 (patch) | |
| tree | 802a6682f45bed25f7fc30cf6b4a7e80dd646d35 /fs | |
| parent | 5287bda44babe857747f56af7b54569cd44753f1 (diff) | |
| download | linux-next-a6de1d8130177f8f50dcf37b2f8f3593da8d71d0.tar.gz linux-next-a6de1d8130177f8f50dcf37b2f8f3593da8d71d0.zip | |
hugetlb: make hugepage_put_subpool() tolerate NULL
Both callers of hugepage_put_subpool() check whether the subpool pointer
is NULL before calling it. Move the NULL check into
hugepage_put_subpool() so callers can use the helper unconditionally.
This is a follow-up cleanup after using hugepage_put_subpool() from the
hugetlbfs_fill_super() failure path.
Link: https://lore.kernel.org/20260720073841.1389354-1-chenyichong@uniontech.com
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Reviewed-by: Muchun Song <muchun.song@linux.dev>
Cc: David Hildenbrand <david@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/hugetlbfs/inode.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index d71ed62cb783..a578fba8e2fc 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1129,8 +1129,7 @@ static void hugetlbfs_put_super(struct super_block *sb) if (sbi) { sb->s_fs_info = NULL; - if (sbi->spool) - hugepage_put_subpool(sbi->spool); + hugepage_put_subpool(sbi->spool); kfree(sbi); } @@ -1419,8 +1418,7 @@ hugetlbfs_fill_super(struct super_block *sb, struct fs_context *fc) goto out_free; return 0; out_free: - if (sbinfo->spool) - hugepage_put_subpool(sbinfo->spool); + hugepage_put_subpool(sbinfo->spool); kfree(sbinfo); return -ENOMEM; } |
