From: Jeff Mahoney <jeffm@suse.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>,
linux-btrfs@vger.kernel.org, Chris Mason <clm@fb.com>,
David Sterba <dsterba@suse.com>, Josef Bacik <jbacik@fb.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 4/5] btrfs: Use common error handling code in update_ref_path()
Date: Mon, 21 Aug 2017 09:08:04 -0400 [thread overview]
Message-ID: <dcd64dfb-944a-2a81-b4a2-8d7ce71d811b@suse.com> (raw)
In-Reply-To: <7083c299-4803-68c8-ae57-c0e74f5d9229@users.sourceforge.net>
[-- Attachment #1.1: Type: text/plain, Size: 1259 bytes --]
On 8/21/17 8:41 AM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.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@users.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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2017-08-21 13:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 12:35 [PATCH 0/5] BTRFS: Fine-tuning for five function implementations SF Markus Elfring
2017-08-21 12:37 ` [PATCH 1/5] btrfs: Use common error handling code in tree_mod_log_eb_copy() SF Markus Elfring
2017-08-21 12:38 ` [PATCH 2/5] btrfs: Use common error handling code in __btrfs_free_extent() SF Markus Elfring
2017-08-21 13:07 ` Jeff Mahoney
2017-08-21 13:14 ` Dan Carpenter
2017-08-21 12:40 ` [PATCH 3/5] btrfs: Use common error handling code in btrfs_update_root() SF Markus Elfring
2017-08-21 13:09 ` Jeff Mahoney
2017-08-21 12:41 ` [PATCH 4/5] btrfs: Use common error handling code in update_ref_path() SF Markus Elfring
2017-08-21 13:08 ` Jeff Mahoney [this message]
2017-08-21 13:42 ` Dan Carpenter
2017-08-21 13:52 ` [PATCH v2] " SF Markus Elfring
2017-08-21 12:42 ` [PATCH 5/5] btrfs: Use common error handling code in btrfs_mark_extent_written() SF Markus Elfring
2017-08-21 13:07 ` Jeff Mahoney
2017-08-21 13:24 ` [PATCH 0/5] BTRFS: Fine-tuning for five function implementations David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dcd64dfb-944a-2a81-b4a2-8d7ce71d811b@suse.com \
--to=jeffm@suse.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=elfring@users.sourceforge.net \
--cc=jbacik@fb.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).