Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1246011

[patch 1/3] irqchip/mxs: Panic if ioremap or domain creation fails

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject [patch 1/3] irqchip/mxs: Panic if ioremap or domain creation fails
Date 2015-10-13 20:10 +0200
Message-ID <qjcbq-5SM-27@gated-at.bofh.it> (permalink)
References <qjc1I-5sd-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[patch 0/3] irqchip/mxs: Add support for ASM9260 interrupt controller Thomas Gleixner <tglx@linutronix.de> - 2015-10-13 20:00 +0200
  [patch 2/3] irqchip/mxs: Prepare driver for hardware with different  offsets Thomas Gleixner <tglx@linutronix.de> - 2015-10-13 20:10 +0200
  [patch 1/3] irqchip/mxs: Panic if ioremap or domain creation fails Thomas Gleixner <tglx@linutronix.de> - 2015-10-13 20:10 +0200
  [patch 3/3] irqchip/mxs: Add Alphascale ASM9260 support Thomas Gleixner <tglx@linutronix.de> - 2015-10-13 20:10 +0200
  Re: [patch 0/3] irqchip/mxs: Add support for ASM9260 interrupt  controller Shawn Guo <shawnguo@kernel.org> - 2015-10-14 03:30 +0200

csiph-web