Re: [PATCH 10/10] btrfs: Remove out label in btrfs_submit_compressed_read

Johannes Thumshirn
2020-07-02T14:23:24Z

On 02/07/2020 15:47, Nikolay Borisov wrote:
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/compression.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> index c28ee9fcd15d..f9a9ec51a1ec 100644
> --- a/fs/btrfs/compression.c
> +++ b/fs/btrfs/compression.c
> @@ -678,8 +678,10 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
>
> compressed_len = em->block_len;
> cb = kmalloc(compressed_bio_size(fs_info, compressed_len), GFP_NOFS);
> - if (!cb)
> - goto out;
> + if (!cb) {
> + free_extent_map(em);
> + return BLK_STS_RESOURCE;
> + }

Agree with David here, please don't do cleanups here, keep it at the out label