base-files: define yes/no as valid boolean options
[openwrt.git] / target / linux / mvebu / patches-3.10 / 0181-of-Fix-dereferencing-node-name-in-debug-output-to-be.patch
1 From 02abb20a226a5a1e5c6dfaaf765dd71a90200cf9 Mon Sep 17 00:00:00 2001
2 From: Grant Likely <grant.likely@linaro.org>
3 Date: Thu, 19 Dec 2013 09:30:52 -0300
4 Subject: [PATCH 181/203] of: Fix dereferencing node name in debug output to be
5  safe
6
7 Several locations in the of_address and of_irq code dereference the
8 full_name parameter from a device_node pointer without checking if the
9 pointer is valid.  This patch switches to use of_node_full_name() which
10 always checks the pointer.
11
12 Signed-off-by: Grant Likely <grant.likely@linaro.org>
13 ---
14  drivers/of/address.c | 6 +++---
15  drivers/of/irq.c     | 8 ++++----
16  2 files changed, 7 insertions(+), 7 deletions(-)
17
18 --- a/drivers/of/address.c
19 +++ b/drivers/of/address.c
20 @@ -482,7 +482,7 @@ static u64 __of_translate_address(struct
21         int na, ns, pna, pns;
22         u64 result = OF_BAD_ADDR;
23  
24 -       pr_debug("OF: ** translation for device %s **\n", dev->full_name);
25 +       pr_debug("OF: ** translation for device %s **\n", of_node_full_name(dev));
26  
27         /* Increase refcount at current level */
28         of_node_get(dev);
29 @@ -497,13 +497,13 @@ static u64 __of_translate_address(struct
30         bus->count_cells(dev, &na, &ns);
31         if (!OF_CHECK_COUNTS(na, ns)) {
32                 printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
33 -                      dev->full_name);
34 +                      of_node_full_name(dev));
35                 goto bail;
36         }
37         memcpy(addr, in_addr, na * 4);
38  
39         pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n",
40 -           bus->name, na, ns, parent->full_name);
41 +           bus->name, na, ns, of_node_full_name(parent));
42         of_dump_addr("OF: translating address:", addr, na);
43  
44         /* Translate */
45 --- a/drivers/of/irq.c
46 +++ b/drivers/of/irq.c
47 @@ -102,7 +102,7 @@ int of_irq_map_raw(struct device_node *p
48         int imaplen, match, i;
49  
50         pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n",
51 -                parent->full_name, be32_to_cpup(intspec),
52 +                of_node_full_name(parent), be32_to_cpup(intspec),
53                  be32_to_cpup(intspec + 1), ointsize);
54  
55         ipar = of_node_get(parent);
56 @@ -126,7 +126,7 @@ int of_irq_map_raw(struct device_node *p
57                 goto fail;
58         }
59  
60 -       pr_debug("of_irq_map_raw: ipar=%s, size=%d\n", ipar->full_name, intsize);
61 +       pr_debug("of_irq_map_raw: ipar=%s, size=%d\n", of_node_full_name(ipar), intsize);
62  
63         if (ointsize != intsize)
64                 return -EINVAL;
65 @@ -287,7 +287,7 @@ int of_irq_map_one(struct device_node *d
66         u32 intsize, intlen;
67         int res = -EINVAL;
68  
69 -       pr_debug("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index);
70 +       pr_debug("of_irq_map_one: dev=%s, index=%d\n", of_node_full_name(device), index);
71  
72         /* OldWorld mac stuff is "special", handle out of line */
73         if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)
74 @@ -361,7 +361,7 @@ int of_irq_to_resource(struct device_nod
75  
76                 r->start = r->end = irq;
77                 r->flags = IORESOURCE_IRQ;
78 -               r->name = name ? name : dev->full_name;
79 +               r->name = name ? name : of_node_full_name(dev);
80         }
81  
82         return irq;