lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240506130223.317265-4-ruanjinjie@huawei.com>
Date: Mon, 6 May 2024 21:02:21 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: <tglx@...utronix.de>, <linux-kernel@...r.kernel.org>
CC: <ruanjinjie@...wei.com>
Subject: [PATCH 3/5] genirq/irqdomain: Clean code for irq_create_direct_mapping()

Add "out" goto label for irq_domain_update_bus_token(), and
"out_free_desc" goto label for irq_create_direct_mapping(), which can
simplify the code.

Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
---
 kernel/irq/irqdomain.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 42bdbd04bc3c..6d8a368c677b 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -317,10 +317,8 @@ void irq_domain_update_bus_token(struct irq_domain *domain,
 	domain->bus_token = bus_token;
 
 	name = kasprintf(GFP_KERNEL, "%s-%d", domain->name, bus_token);
-	if (!name) {
-		mutex_unlock(&irq_domain_mutex);
-		return;
-	}
+	if (!name)
+		goto out;
 
 	debugfs_remove_domain_dir(domain);
 
@@ -332,6 +330,7 @@ void irq_domain_update_bus_token(struct irq_domain *domain,
 	domain->name = name;
 	debugfs_add_domain_dir(domain);
 
+out:
 	mutex_unlock(&irq_domain_mutex);
 }
 EXPORT_SYMBOL_GPL(irq_domain_update_bus_token);
@@ -672,17 +671,18 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain)
 	if (virq >= domain->hwirq_max) {
 		pr_err("ERROR: no free irqs available below %lu maximum\n",
 			domain->hwirq_max);
-		irq_free_desc(virq);
-		return 0;
+		goto out_free_desc;
 	}
 	pr_debug("create_direct obtained virq %d\n", virq);
 
-	if (irq_domain_associate(domain, virq, virq)) {
-		irq_free_desc(virq);
-		return 0;
-	}
+	if (irq_domain_associate(domain, virq, virq))
+		goto out_free_desc;
 
 	return virq;
+
+out_free_desc:
+	irq_free_desc(virq);
+	return 0;
 }
 EXPORT_SYMBOL_GPL(irq_create_direct_mapping);
 #endif
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ