mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Markus Elfring <Markus.Elfring@web.de>,
	linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>,
	Dai Ngo <Dai.Ngo@oracle.com>, Neil Brown <neil@brown.name>,
	 Olga Kornievskaia <okorniev@redhat.com>,
	Tom Talpey <tom@talpey.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] nfsd: Use common error handling code in svc_export_alloc()
Date: Thu, 11 Jun 2026 08:28:43 -0400	[thread overview]
Message-ID: <4b9b168d564665b79ca6948d739f409df360c2b0.camel@kernel.org> (raw)
In-Reply-To: <099ee379-df64-41d1-8f4d-6d47d0e2fad2@web.de>

On Thu, 2026-06-11 at 14:11 +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 11 Jun 2026 14:03:48 +0200
> 
> Use an additional label so that a bit of exception handling can be better
> reused at the end of an if branch.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  fs/nfsd/export.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
> index eb020054f9a3..bb106733f3ec 100644
> --- a/fs/nfsd/export.c
> +++ b/fs/nfsd/export.c
> @@ -1589,13 +1589,12 @@ static struct cache_head *svc_export_alloc(void)
>  		return NULL;
>  
>  	i->ex_stats = kmalloc_obj(*(i->ex_stats));
> -	if (!i->ex_stats) {
> -		kfree(i);
> -		return NULL;
> -	}
> +	if (!i->ex_stats)
> +		goto free_export;
>  
>  	if (export_stats_init(i->ex_stats)) {
>  		kfree(i->ex_stats);
> +free_export:
>  		kfree(i);
>  		return NULL;
>  	}

I'm not a fan of this patch. I mean, it's legal and all, but sticking a
goto label in the middle of a if block makes for messy-looking and hard
to reason about code.

-- 
Jeff Layton <jlayton@kernel.org>

      reply	other threads:[~2026-06-11 12:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 12:11 Markus Elfring
2026-06-11 12:28 ` Jeff Layton [this message]

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=4b9b168d564665b79ca6948d739f409df360c2b0.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=Markus.Elfring@web.de \
    --cc=chuck.lever@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.com \
    /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

all inboxes | Powered by JetHome®