diff options
Diffstat (limited to 'drivers/of/irq.c')
-rw-r--r-- | drivers/of/irq.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 0d7765807f49..1a7980692f25 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
@@ -290,7 +290,7 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar | |||
290 | struct device_node *p; | 290 | struct device_node *p; |
291 | const __be32 *intspec, *tmp, *addr; | 291 | const __be32 *intspec, *tmp, *addr; |
292 | u32 intsize, intlen; | 292 | u32 intsize, intlen; |
293 | int i, res = -EINVAL; | 293 | int i, res; |
294 | 294 | ||
295 | pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index); | 295 | pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index); |
296 | 296 | ||
@@ -323,15 +323,19 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar | |||
323 | 323 | ||
324 | /* Get size of interrupt specifier */ | 324 | /* Get size of interrupt specifier */ |
325 | tmp = of_get_property(p, "#interrupt-cells", NULL); | 325 | tmp = of_get_property(p, "#interrupt-cells", NULL); |
326 | if (tmp == NULL) | 326 | if (tmp == NULL) { |
327 | res = -EINVAL; | ||
327 | goto out; | 328 | goto out; |
329 | } | ||
328 | intsize = be32_to_cpu(*tmp); | 330 | intsize = be32_to_cpu(*tmp); |
329 | 331 | ||
330 | pr_debug(" intsize=%d intlen=%d\n", intsize, intlen); | 332 | pr_debug(" intsize=%d intlen=%d\n", intsize, intlen); |
331 | 333 | ||
332 | /* Check index */ | 334 | /* Check index */ |
333 | if ((index + 1) * intsize > intlen) | 335 | if ((index + 1) * intsize > intlen) { |
336 | res = -EINVAL; | ||
334 | goto out; | 337 | goto out; |
338 | } | ||
335 | 339 | ||
336 | /* Copy intspec into irq structure */ | 340 | /* Copy intspec into irq structure */ |
337 | intspec += index * intsize; | 341 | intspec += index * intsize; |