[PATCH 2/2] of: irq: Check for reg property presence only when parsinginterrupt-map
From: Tomasz Figa
Date: Tue Nov 05 2013 - 10:21:49 EST
This patch fixes the of_irq_parse_raw() function to check for reg
property only when really parsing interrupt map property, as it is not
required otherwise and breaks existing device trees.
Signed-off-by: Tomasz Figa <t.figa@xxxxxxxxxxx>
---
drivers/of/irq.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 717eed4..72e9c51 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -147,17 +147,8 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
pr_debug(" -> addrsize=%d\n", addrsize);
- /* If we were passed no "reg" property and we attempt to parse
- * an interrupt-map, then #address-cells must be 0.
- * Fail if it's not.
- */
- if (addr == NULL && addrsize != 0) {
- pr_debug(" -> no reg passed in when needed !\n");
- return -EINVAL;
- }
-
/* Precalculate the match array - this simplifies match loop */
- for (i = 0; i < addrsize; i++)
+ for (i = 0; i < addrsize && addr; i++)
initial_match_array[i] = addr[i];
for (i = 0; i < intsize; i++)
initial_match_array[addrsize + i] = cpu_to_be32(out_irq->args[i]);
@@ -184,6 +175,16 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
}
imaplen /= sizeof(u32);
+ /*
+ * If we were passed no "reg" property and we attempt to parse
+ * an interrupt-map, then #address-cells must be 0.
+ * Fail if it's not.
+ */
+ if (addr == NULL && addrsize != 0) {
+ pr_debug(" -> no reg passed in when needed !\n");
+ return -EINVAL;
+ }
+
/* Look for a mask */
imask = of_get_property(ipar, "interrupt-map-mask", NULL);
if (!imask)
--
1.8.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/