]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
powerpc: Fix unterminated of_device_id array in legacy_serial.c
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 7 Jul 2008 06:39:50 +0000 (16:39 +1000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 7 Jul 2008 15:53:49 +0000 (08:53 -0700)
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>
arch/powerpc/kernel/legacy_serial.c

index cf37f5ca4b71e6b30c2a3d7bb46fb17f8bf66f50..4d96e1db55ee276c6c7a1e5e7b063c38d926b338 100644 (file)
@@ -33,13 +33,14 @@ static struct legacy_serial_info {
        phys_addr_t                     taddr;
 } legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];
 
-static struct __initdata of_device_id parents[] = {
+static struct __initdata of_device_id legacy_serial_parents[] = {
        {.type = "soc",},
        {.type = "tsi-bridge",},
        {.type = "opb", },
        {.compatible = "ibm,opb",},
        {.compatible = "simple-bus",},
        {.compatible = "wrs,epld-localbus",},
+       {},
 };
 
 static unsigned int legacy_serial_count;
@@ -327,7 +328,7 @@ void __init find_legacy_serial_ports(void)
                struct device_node *parent = of_get_parent(np);
                if (!parent)
                        continue;
-               if (of_match_node(parents, parent) != NULL) {
+               if (of_match_node(legacy_serial_parents, parent) != NULL) {
                        index = add_legacy_soc_port(np, np);
                        if (index >= 0 && np == stdout)
                                legacy_serial_console = index;