[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dcd64dfb-944a-2a81-b4a2-8d7ce71d811b@suse.com>
Date: Mon, 21 Aug 2017 09:08:04 -0400
From: Jeff Mahoney <jeffm@...e.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>,
linux-btrfs@...r.kernel.org, Chris Mason <clm@...com>,
David Sterba <dsterba@...e.com>, Josef Bacik <jbacik@...com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 4/5] btrfs: Use common error handling code in
update_ref_path()
On 8/21/17 8:41 AM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Mon, 21 Aug 2017 13:34:29 +0200
>
> Add a jump target so that a bit of exception handling can be better reused
> in this function.
>
> This issue was detected by using the Coccinelle software.
Adding a jump label in the middle of a conditional for "common" error
handling makes the code more difficult to understand.
-Jeff
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
> fs/btrfs/send.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index 59fb1ed6ca20..a96edc91a101 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -3697,12 +3697,12 @@ static int update_ref_path(struct send_ctx *sctx, struct recorded_ref *ref)
> return -ENOMEM;
>
> ret = get_cur_path(sctx, ref->dir, ref->dir_gen, new_path);
> - if (ret < 0) {
> - fs_path_free(new_path);
> - return ret;
> - }
> + if (ret < 0)
> + goto free_path;
> +
> ret = fs_path_add(new_path, ref->name, ref->name_len);
> if (ret < 0) {
> +free_path:
> fs_path_free(new_path);
> return ret;
> }
>
--
Jeff Mahoney
SUSE Labs
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists