mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>,
	Dai Ngo <Dai.Ngo@oracle.com>, Jeff Layton <jlayton@kernel.org>,
	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: [PATCH] nfsd: Use common error handling code in svc_export_alloc()
Date: Thu, 11 Jun 2026 14:11:17 +0200	[thread overview]
Message-ID: <099ee379-df64-41d1-8f4d-6d47d0e2fad2@web.de> (raw)

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;
 	}
-- 
2.54.0


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

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

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=099ee379-df64-41d1-8f4d-6d47d0e2fad2@web.de \
    --to=markus.elfring@web.de \
    --cc=Dai.Ngo@oracle.com \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --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®