]> Pileus Git - ~andy/linux/blobdiff - drivers/of/irq.c
Merge tag 'v3.2-rc2' into staging/for_v3.3
[~andy/linux] / drivers / of / irq.c
index 791270b8bd1ca755e27632c1b68f9f252662a3a0..6d3dd3988d0f2891e65514a2bac68b184409ac1d 100644 (file)
@@ -60,27 +60,27 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
  */
 struct device_node *of_irq_find_parent(struct device_node *child)
 {
-       struct device_node *p;
+       struct device_node *p, *c = child;
        const __be32 *parp;
 
-       if (!of_node_get(child))
+       if (!of_node_get(c))
                return NULL;
 
        do {
-               parp = of_get_property(child, "interrupt-parent", NULL);
+               parp = of_get_property(c, "interrupt-parent", NULL);
                if (parp == NULL)
-                       p = of_get_parent(child);
+                       p = of_get_parent(c);
                else {
                        if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
                                p = of_node_get(of_irq_dflt_pic);
                        else
                                p = of_find_node_by_phandle(be32_to_cpup(parp));
                }
-               of_node_put(child);
-               child = p;
+               of_node_put(c);
+               c = p;
        } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL);
 
-       return p;
+       return (p == child) ? NULL : p;
 }
 
 /**