From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Oleksij Rempel <linux@rempel-privat.de>,
marc.zyngier@arm.com, jason@lakedaemon.net,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <kernel@pengutronix.de>
Subject: [patch 1/3] irqchip/mxs: Panic if ioremap or domain creation fails
Date: Tue, 13 Oct 2015 17:58:54 -0000 [thread overview]
Message-ID: <20151013175706.068324259@linutronix.de> (raw)
In-Reply-To: 20151013175149.518395824@linutronix.de
[-- Attachment #1: arm-irqchip-mxs-do-panic-if-icoll_base-3d-3d-null.patch --]
[-- Type: text/plain, Size: 1519 bytes --]
From: Oleksij Rempel <linux@rempel-privat.de>
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>
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>
---
drivers/irqchip/irq-mxs.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: tip/drivers/irqchip/irq-mxs.c
===================================================================
--- tip.orig/drivers/irqchip/irq-mxs.c
+++ tip/drivers/irqchip/irq-mxs.c
@@ -97,7 +97,8 @@ static int __init icoll_of_init(struct d
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
@@ -107,6 +108,9 @@ static int __init icoll_of_init(struct d
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);
next prev parent reply other threads:[~2015-10-13 17:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 17:58 [patch 0/3] irqchip/mxs: Add support for ASM9260 interrupt controller Thomas Gleixner
2015-10-13 17:58 ` [patch 2/3] irqchip/mxs: Prepare driver for hardware with different offsets Thomas Gleixner
2015-10-13 17:58 ` Thomas Gleixner [this message]
2015-10-13 17:58 ` [patch 3/3] irqchip/mxs: Add Alphascale ASM9260 support Thomas Gleixner
2015-10-14 1:23 ` [patch 0/3] irqchip/mxs: Add support for ASM9260 interrupt controller Shawn Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151013175706.068324259@linutronix.de \
--to=tglx@linutronix.de \
--cc=jason@lakedaemon.net \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rempel-privat.de \
--cc=marc.zyngier@arm.com \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.