aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-07 02:39:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-07 11:53:49 -0400
commit3bc5ab9b7f2760d2892fd0a0589e1077e869d4f5 (patch)
tree3e47e57b1a685afc24f0e7c4122f2bc69a19385c /arch
parent0fe1ef24f7bd0020f29ffe287dfdb9ead33ca0b2 (diff)
powerpc: Fix unterminated of_device_id array in legacy_serial.c
A recent patch to legacy_serial.c factored out some code by using the of_match_node() facility to match a node against an array of possible matches. However, the patch didn't properly terminate the array causing potential crashes in cases where no match is found. In addition, the name of the array was poorly chosen for a static symbol making debugging harder. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/legacy_serial.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index cf37f5ca4b71..4d96e1db55ee 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -33,13 +33,14 @@ static struct legacy_serial_info {
33 phys_addr_t taddr; 33 phys_addr_t taddr;
34} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS]; 34} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];
35 35
36static struct __initdata of_device_id parents[] = { 36static struct __initdata of_device_id legacy_serial_parents[] = {
37 {.type = "soc",}, 37 {.type = "soc",},
38 {.type = "tsi-bridge",}, 38 {.type = "tsi-bridge",},
39 {.type = "opb", }, 39 {.type = "opb", },
40 {.compatible = "ibm,opb",}, 40 {.compatible = "ibm,opb",},
41 {.compatible = "simple-bus",}, 41 {.compatible = "simple-bus",},
42 {.compatible = "wrs,epld-localbus",}, 42 {.compatible = "wrs,epld-localbus",},
43 {},
43}; 44};
44 45
45static unsigned int legacy_serial_count; 46static unsigned int legacy_serial_count;
@@ -327,7 +328,7 @@ void __init find_legacy_serial_ports(void)
327 struct device_node *parent = of_get_parent(np); 328 struct device_node *parent = of_get_parent(np);
328 if (!parent) 329 if (!parent)
329 continue; 330 continue;
330 if (of_match_node(parents, parent) != NULL) { 331 if (of_match_node(legacy_serial_parents, parent) != NULL) {
331 index = add_legacy_soc_port(np, np); 332 index = add_legacy_soc_port(np, np);
332 if (index >= 0 && np == stdout) 333 if (index >= 0 && np == stdout)
333 legacy_serial_console = index; 334 legacy_serial_console = index;