diff options
-rw-r--r-- | arch/powerpc/kernel/prom_parse.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c index 8f0856f312da..8362620c9e6f 100644 --- a/arch/powerpc/kernel/prom_parse.c +++ b/arch/powerpc/kernel/prom_parse.c | |||
@@ -971,7 +971,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq | |||
971 | struct device_node *p; | 971 | struct device_node *p; |
972 | const u32 *intspec, *tmp, *addr; | 972 | const u32 *intspec, *tmp, *addr; |
973 | u32 intsize, intlen; | 973 | u32 intsize, intlen; |
974 | int res; | 974 | int res = -EINVAL; |
975 | 975 | ||
976 | DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); | 976 | DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); |
977 | 977 | ||
@@ -995,21 +995,20 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq | |||
995 | 995 | ||
996 | /* Get size of interrupt specifier */ | 996 | /* Get size of interrupt specifier */ |
997 | tmp = of_get_property(p, "#interrupt-cells", NULL); | 997 | tmp = of_get_property(p, "#interrupt-cells", NULL); |
998 | if (tmp == NULL) { | 998 | if (tmp == NULL) |
999 | of_node_put(p); | 999 | goto out; |
1000 | return -EINVAL; | ||
1001 | } | ||
1002 | intsize = *tmp; | 1000 | intsize = *tmp; |
1003 | 1001 | ||
1004 | DBG(" intsize=%d intlen=%d\n", intsize, intlen); | 1002 | DBG(" intsize=%d intlen=%d\n", intsize, intlen); |
1005 | 1003 | ||
1006 | /* Check index */ | 1004 | /* Check index */ |
1007 | if ((index + 1) * intsize > intlen) | 1005 | if ((index + 1) * intsize > intlen) |
1008 | return -EINVAL; | 1006 | goto out; |
1009 | 1007 | ||
1010 | /* Get new specifier and map it */ | 1008 | /* Get new specifier and map it */ |
1011 | res = of_irq_map_raw(p, intspec + index * intsize, intsize, | 1009 | res = of_irq_map_raw(p, intspec + index * intsize, intsize, |
1012 | addr, out_irq); | 1010 | addr, out_irq); |
1011 | out: | ||
1013 | of_node_put(p); | 1012 | of_node_put(p); |
1014 | return res; | 1013 | return res; |
1015 | } | 1014 | } |