[PATCH] x86/hpet: Use common error handling code in hpet_create_irq_domain()
Markus Elfring <[email protected]> Tue, 9 Jun 2026 13:42:05 +0200
| Newsgroups | org.kernel.vger.kernel-janitors,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Markus Elfring <[email protected]> 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 <[email protected]> --- 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