Skip to content

Commit

Permalink
irqchip/mxs: Panic if ioremap or domain creation fails
Browse files Browse the repository at this point in the history
Current code will only warn and then dereference the NULL pointer or
continue, which results in a fatal NULL pointer dereference later.

If the initialization fails, the machine is unusable, so panic right
away.

[ tglx: Massaged changelog and picked the irqdomain panic from the
  	next patch]

Signed-off-by: Oleksij Rempel <[email protected]>
Tested-by: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
  • Loading branch information
olerem authored and KAGA-KOKO committed Oct 14, 2015
1 parent e7a46c8 commit e59a845
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/irqchip/irq-mxs.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ static int __init icoll_of_init(struct device_node *np,
struct device_node *interrupt_parent)
{
icoll_base = of_iomap(np, 0);
WARN_ON(!icoll_base);
if (!icoll_base)
panic("%s: unable to map resource", np->full_name);

/*
* Interrupt Collector reset, which initializes the priority
Expand All @@ -107,6 +108,9 @@ static int __init icoll_of_init(struct device_node *np,

icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS,
&icoll_irq_domain_ops, NULL);
return icoll_domain ? 0 : -ENODEV;
if (!icoll_domain)
panic("%s: unable to create irqdomain", np->full_name);

return 0;
}
IRQCHIP_DECLARE(mxs, "fsl,icoll", icoll_of_init);

0 comments on commit e59a845

Please sign in to comment.