public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yunseong Kim <yskelg@gmail.com>
To: Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
	Joel Granados <j.granados@samsung.com>,
	MichelleJin <shjy180909@gmail.com>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] s390/debug: optimize acquiring spinlock on failure in debug_info_copy()
Date: Thu, 18 Jul 2024 06:18:57 +0900	[thread overview]
Message-ID: <20240717211857.4510-3-yskelg@gmail.com> (raw)

Optimize acquiring the spinlock once more and then exiting without any
additional actions, when handling of debug_info_alloc() failed.

Fixes: 942eaabd5d77 ("[PATCH] s390: debug feature changes")
Signed-off-by: Yunseong Kim <yskelg@gmail.com>
---
 arch/s390/kernel/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 85328a0ef3b6..c64f17cc1ebe 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -333,9 +333,9 @@ static debug_info_t *debug_info_copy(debug_info_t *in, int mode)
 	do {
 		rc = debug_info_alloc(in->name, in->pages_per_area,
 			in->nr_areas, in->buf_size, in->level, mode);
-		spin_lock_irqsave(&in->lock, flags);
 		if (!rc)
-			goto out;
+			return rc;
+		spin_lock_irqsave(&in->lock, flags);
 		/* has something changed in the meantime ? */
 		if ((rc->pages_per_area == in->pages_per_area) &&
 		    (rc->nr_areas == in->nr_areas)) {
-- 
2.45.2


                 reply	other threads:[~2024-07-17 21:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240717211857.4510-3-yskelg@gmail.com \
    --to=yskelg@gmail.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=j.granados@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=shjy180909@gmail.com \
    --cc=svens@linux.ibm.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