diff options
-rw-r--r-- | arch/sparc/kernel/ebus.c | 2 | ||||
-rw-r--r-- | arch/sparc64/kernel/ebus.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c index e2d02fd13f35..d850785b2080 100644 --- a/arch/sparc/kernel/ebus.c +++ b/arch/sparc/kernel/ebus.c | |||
@@ -156,6 +156,8 @@ void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *d | |||
156 | dev->prom_node = dp; | 156 | dev->prom_node = dp; |
157 | 157 | ||
158 | regs = of_get_property(dp, "reg", &len); | 158 | regs = of_get_property(dp, "reg", &len); |
159 | if (!regs) | ||
160 | len = 0; | ||
159 | if (len % sizeof(struct linux_prom_registers)) { | 161 | if (len % sizeof(struct linux_prom_registers)) { |
160 | prom_printf("UGH: proplen for %s was %d, need multiple of %d\n", | 162 | prom_printf("UGH: proplen for %s was %d, need multiple of %d\n", |
161 | dev->prom_node->name, len, | 163 | dev->prom_node->name, len, |
diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c index bc9ae36f7a43..04ab81cb4f48 100644 --- a/arch/sparc64/kernel/ebus.c +++ b/arch/sparc64/kernel/ebus.c | |||
@@ -375,7 +375,10 @@ static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_de | |||
375 | dev->num_addrs = 0; | 375 | dev->num_addrs = 0; |
376 | dev->num_irqs = 0; | 376 | dev->num_irqs = 0; |
377 | } else { | 377 | } else { |
378 | (void) of_get_property(dp, "reg", &len); | 378 | const int *regs = of_get_property(dp, "reg", &len); |
379 | |||
380 | if (!regs) | ||
381 | len = 0; | ||
379 | dev->num_addrs = len / sizeof(struct linux_prom_registers); | 382 | dev->num_addrs = len / sizeof(struct linux_prom_registers); |
380 | 383 | ||
381 | for (i = 0; i < dev->num_addrs; i++) | 384 | for (i = 0; i < dev->num_addrs; i++) |