Commit 80f6abe0 authored by Herve Codina's avatar Herve Codina Committed by Thomas Gleixner

irqdomain: Make __irq_domain_create() return an error code

__irq_domain_create() can fail for several reasons. When it fails it
returns a NULL pointer and so filters out the exact failure reason.
The only user of __irq_domain_create() is irq_domain_instantiate() which
can return a PTR_ERR value. On __irq_domain_create() failure, it uses an
arbitrary error code.

Rather than using this arbitrary error value, make __irq_domain_create()
return is own error code and use that one.

[ tglx: Remove the pointless ERR_CAST. domain is a valid return pointer ]
Signed-off-by: default avatarHerve Codina <herve.codina@bootlin.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240614173232.1184015-11-herve.codina@bootlin.com
parent b986055d
......@@ -187,17 +187,17 @@ static struct irq_domain *__irq_domain_create(const struct irq_domain_info *info
if (WARN_ON((info->size && info->direct_max) ||
(!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && info->direct_max) ||
(info->direct_max && info->direct_max != info->hwirq_max)))
return NULL;
return ERR_PTR(-EINVAL);
domain = kzalloc_node(struct_size(domain, revmap, info->size),
GFP_KERNEL, of_node_to_nid(to_of_node(info->fwnode)));
if (!domain)
return NULL;
return ERR_PTR(-ENOMEM);
err = irq_domain_set_name(domain, info->fwnode);
if (err) {
kfree(domain);
return NULL;
return ERR_PTR(err);
}
domain->fwnode = fwnode_handle_get(info->fwnode);
......@@ -260,8 +260,8 @@ struct irq_domain *irq_domain_instantiate(const struct irq_domain_info *info)
struct irq_domain *domain;
domain = __irq_domain_create(info);
if (!domain)
return ERR_PTR(-ENOMEM);
if (IS_ERR(domain))
return domain;
domain->flags |= info->domain_flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment