Skip to content

Commit 80f6abe

Browse files
hcodinaKAGA-KOKO
authored andcommitted
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: Herve Codina <herve.codina@bootlin.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240614173232.1184015-11-herve.codina@bootlin.com
1 parent b986055 commit 80f6abe

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

kernel/irq/irqdomain.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,17 @@ static struct irq_domain *__irq_domain_create(const struct irq_domain_info *info
187187
if (WARN_ON((info->size && info->direct_max) ||
188188
(!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && info->direct_max) ||
189189
(info->direct_max && info->direct_max != info->hwirq_max)))
190-
return NULL;
190+
return ERR_PTR(-EINVAL);
191191

192192
domain = kzalloc_node(struct_size(domain, revmap, info->size),
193193
GFP_KERNEL, of_node_to_nid(to_of_node(info->fwnode)));
194194
if (!domain)
195-
return NULL;
195+
return ERR_PTR(-ENOMEM);
196196

197197
err = irq_domain_set_name(domain, info->fwnode);
198198
if (err) {
199199
kfree(domain);
200-
return NULL;
200+
return ERR_PTR(err);
201201
}
202202

203203
domain->fwnode = fwnode_handle_get(info->fwnode);
@@ -260,8 +260,8 @@ struct irq_domain *irq_domain_instantiate(const struct irq_domain_info *info)
260260
struct irq_domain *domain;
261261

262262
domain = __irq_domain_create(info);
263-
if (!domain)
264-
return ERR_PTR(-ENOMEM);
263+
if (IS_ERR(domain))
264+
return domain;
265265

266266
domain->flags |= info->domain_flags;
267267

0 commit comments

Comments
 (0)