diff options
author | Oleksij Rempel <linux@rempel-privat.de> | 2015-10-12 15:15:30 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-10-14 03:37:47 -0400 |
commit | e59a8451be1162d5a10a33e40092f1796cb8fdca (patch) | |
tree | 4ded8d04e8e213d338680b29bc0eb9f79a6371d1 /drivers | |
parent | e7a46c818564329f977f8fa157b5e9e1d0d83012 (diff) |
irqchip/mxs: Panic if ioremap or domain creation fails
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 <linux@rempel-privat.de>
Tested-by: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: marc.zyngier@arm.com
Cc: jason@lakedaemon.net
Link: http://lkml.kernel.org/r/1444677334-12242-2-git-send-email-linux@rempel-privat.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/irqchip/irq-mxs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c index 604df63e2edf..96148a7beba1 100644 --- a/drivers/irqchip/irq-mxs.c +++ b/drivers/irqchip/irq-mxs.c | |||
@@ -97,7 +97,8 @@ static int __init icoll_of_init(struct device_node *np, | |||
97 | struct device_node *interrupt_parent) | 97 | struct device_node *interrupt_parent) |
98 | { | 98 | { |
99 | icoll_base = of_iomap(np, 0); | 99 | icoll_base = of_iomap(np, 0); |
100 | WARN_ON(!icoll_base); | 100 | if (!icoll_base) |
101 | panic("%s: unable to map resource", np->full_name); | ||
101 | 102 | ||
102 | /* | 103 | /* |
103 | * Interrupt Collector reset, which initializes the priority | 104 | * Interrupt Collector reset, which initializes the priority |
@@ -107,6 +108,9 @@ static int __init icoll_of_init(struct device_node *np, | |||
107 | 108 | ||
108 | icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, | 109 | icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, |
109 | &icoll_irq_domain_ops, NULL); | 110 | &icoll_irq_domain_ops, NULL); |
110 | return icoll_domain ? 0 : -ENODEV; | 111 | if (!icoll_domain) |
112 | panic("%s: unable to create irqdomain", np->full_name); | ||
113 | |||
114 | return 0; | ||
111 | } | 115 | } |
112 | IRQCHIP_DECLARE(mxs, "fsl,icoll", icoll_of_init); | 116 | IRQCHIP_DECLARE(mxs, "fsl,icoll", icoll_of_init); |