summaryrefslogtreecommitdiff
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorKemeng Shi <shikemeng@huaweicloud.com>2023-03-03 20:21:09 +0300
committerTheodore Ts'o <tytso@mit.edu>2023-04-06 08:13:11 +0300
commit139f46d3b5e69937025faa38cb0a3711b9808158 (patch)
tree0320ed83cea92619e12302c28f2e4fa95ea7ede3 /fs/ext4/mballoc.c
parent85b67ffb7d2bab27cc6c479e949e6fab7fb41aee (diff)
downloadlinux-139f46d3b5e69937025faa38cb0a3711b9808158.tar.xz
ext4: Remove unnecessary release when memory allocation failed in ext4_mb_init_cache
If we alloc array of buffer_head failed, there is no resource need to be freed and we can simpily return error. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> Link: https://lore.kernel.org/r/20230303172120.3800725-10-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r--fs/ext4/mballoc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index d141e5c2e44c..17cfe6c2b582 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1168,10 +1168,8 @@ static int ext4_mb_init_cache(struct page *page, char *incore, gfp_t gfp)
if (groups_per_page > 1) {
i = sizeof(struct buffer_head *) * groups_per_page;
bh = kzalloc(i, gfp);
- if (bh == NULL) {
- err = -ENOMEM;
- goto out;
- }
+ if (bh == NULL)
+ return -ENOMEM;
} else
bh = &bhs;