From: Markus Elfring <Markus.Elfring@web.de>
To: x86@kernel.org, Borislav Petkov <bp@alien8.de>,
Daniel J Blueman <daniel@quora.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
Jiri Wiesner <jwiesner@suse.de>, Kees Cook <kees@kernel.org>,
Thomas Gleixner <tglx@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] x86/hpet: Use common error handling code in hpet_create_irq_domain()
Date: Tue, 9 Jun 2026 13:42:05 +0200 [thread overview]
Message-ID: <5c9b0231-5100-4668-a33e-ccb330d30c65@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 9 Jun 2026 13:28:18 +0200
Use additional labels so that a bit of exception handling can be better
reused at the end of this function implementation.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/x86/kernel/hpet.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 8dc7b710e125..ac7e06b40a16 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -553,30 +553,31 @@ static struct irq_domain *hpet_create_irq_domain(int hpet_id)
fn = irq_domain_alloc_named_id_fwnode(hpet_msi_controller.name,
hpet_id);
- if (!fn) {
- kfree(domain_info);
- return NULL;
- }
+ if (!fn)
+ goto free_info;
fwspec.fwnode = fn;
fwspec.param_count = 1;
fwspec.param[0] = hpet_id;
parent = irq_find_matching_fwspec(&fwspec, DOMAIN_BUS_GENERIC_MSI);
- if (!parent) {
- irq_domain_free_fwnode(fn);
- kfree(domain_info);
- return NULL;
- }
+ if (!parent)
+ goto free_fwnode;
+
if (parent != x86_vector_domain)
hpet_msi_controller.name = "IR-HPET-MSI";
d = msi_create_irq_domain(fn, domain_info, parent);
- if (!d) {
- irq_domain_free_fwnode(fn);
- kfree(domain_info);
- }
+ if (!d)
+ goto free_fwnode;
+
return d;
+
+free_fwnode:
+ irq_domain_free_fwnode(fn);
+free_info:
+ kfree(domain_info);
+ return NULL;
}
static inline int hpet_dev_id(struct irq_domain *domain)
--
2.54.0
next reply other threads:[~2026-06-09 11:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 11:42 Markus Elfring [this message]
2026-09-25 15:09 ` Habil Eren Türker
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=5c9b0231-5100-4668-a33e-ccb330d30c65@web.de \
--to=markus.elfring@web.de \
--cc=bp@alien8.de \
--cc=daniel@quora.org \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jwiesner@suse.de \
--cc=kees@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®