[PATCH 08/10] btrfs: Remove fail1 label in btrfs_submit_compressed_read

Nikolay Borisov
2020-07-02T13:47:02Z

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/compression.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 48ceab7be0fe..2033ce17e5c6 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -703,8 +703,10 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
nr_pages = DIV_ROUND_UP(compressed_len, PAGE_SIZE);
cb->compressed_pages = kcalloc(nr_pages, sizeof(struct page *),
GFP_NOFS);
- if (!cb->compressed_pages)
- goto fail1;
+ if (!cb->compressed_pages) {
+ kfree(cb);
+ return BLK_STS_RESOURCE;
+ }

for (pg_index = 0; pg_index < nr_pages; pg_index++) {
cb->compressed_pages[pg_index] = alloc_page(GFP_NOFS |
@@ -806,7 +808,6 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
}

kfree(cb->compressed_pages);
-fail1:
kfree(cb);
out:
free_extent_map(em);
--
2.17.1