Skip to contentSkip to conversation

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

PATCH New Yunseong Kim 1 participant 1 message Jul 17, 2024 s390

lore
Share & tools
lore
#0 lore raw

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

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")
---
 arch/s390/kernel/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/debug.c +2 -2
index 85328a0ef3b6..c64f17cc1ebe 100644
@@ -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)) {
Signature · 1 line
2.45.2