[PATCH 1/2] net/iucv: Improve unlocking in iucv_enable()

From: Markus Elfring
Date: Mon Jan 01 2024 - 15:58:48 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 1 Jan 2024 21:15:11 +0100

* Add a label so that a call of the function “cpus_read_unlock”
is stored only once in this function implementation.

* Replace one call at the end by a goto statement.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
net/iucv/iucv.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index 0ed6e34d6edd..71ba309e05ee 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -555,13 +555,16 @@ static int iucv_enable(void)
if (cpumask_empty(&iucv_buffer_cpumask))
/* No cpu could declare an iucv buffer. */
goto out;
+
+ rc = 0;
+unlock:
cpus_read_unlock();
- return 0;
+ return rc;
+
out:
kfree(iucv_path_table);
iucv_path_table = NULL;
- cpus_read_unlock();
- return rc;
+ goto unlock;
}

/*
--
2.43.0