[PATCH] s390/debug: optimize acquiring spinlock on failure in debug_info_copy()

From: Yunseong Kim
Date: Wed Jul 17 2024 - 17:27:19 EST


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@xxxxxxxxx>
---
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