summaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2013-11-01 10:50:50 -0700
committerGrant Likely <grant.likely@linaro.org>2013-11-03 23:16:35 +0000
commit78119fd1068cc068f6112a57a5f6de0e5b20245a (patch)
tree8e0726dc0a7527c0e7f571c7953e3115c7bded7f /drivers/of
parent0976c946a610d06e907335b7a3afa6db046f8e1b (diff)
downloadop-kernel-dev-78119fd1068cc068f6112a57a5f6de0e5b20245a.zip
op-kernel-dev-78119fd1068cc068f6112a57a5f6de0e5b20245a.tar.gz
of/irq: Fix bug in interrupt parsing refactor.
Commit 2361613206e6, "of/irq: Refactor interrupt-map parsing" introduced a bug. The irq parsing will fail for some nodes that don't have a reg property. It is fixed by deferring the check for reg until it is actually needed. Also adjust the testcase data to catch the bug. Signed-off-by: Grant Likely <grant.likely@linaro.org> Tested-by: Stephen Warren <swarren@nvidia.com> Tested-by: Ming Lei <tom.leiming@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com> Cc: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/irq.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 8cc62b4..52dba6a 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -147,18 +147,9 @@ 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++)
- initial_match_array[i] = addr[i];
+ initial_match_array[i] = addr ? addr[i] : 0;
for (i = 0; i < intsize; i++)
initial_match_array[addrsize + i] = cpu_to_be32(out_irq->args[i]);
@@ -174,6 +165,15 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
return 0;
}
+ /*
+ * interrupt-map parsing does not work without a reg
+ * property when #address-cells != 0
+ */
+ if (addrsize && !addr) {
+ pr_debug(" -> no reg passed in when needed !\n");
+ goto fail;
+ }
+
/* Now look for an interrupt-map */
imap = of_get_property(ipar, "interrupt-map", &imaplen);
/* No interrupt map, check for an interrupt parent */
OpenPOWER on IntegriCloud