powerpc/pmac: Fix DT refcount imbalance in pmac_pic_probe_oldstyle
authorGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 3 Mar 2015 10:02:15 +0000 (11:02 +0100)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 25 Mar 2015 05:53:27 +0000 (16:53 +1100)
Internally, of_find_node_by_name() calls of_node_put() on its "from"
parameter, which must not be done on "master", as it's still in use, and
will be released manually later.  This may cause a zero kref refcount.

Call of_node_get() before to compensate for this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/powermac/pic.c

index 4c24bf60d39d2834a0795982d583aabce22ae89b..59cfc9d63c2d51a711448c1de281cf42fcf04349 100644 (file)
@@ -321,6 +321,9 @@ static void __init pmac_pic_probe_oldstyle(void)
                max_irqs = max_real_irqs = 64;
 
                /* We might have a second cascaded heathrow */
+
+               /* Compensate for of_node_put() in of_find_node_by_name() */
+               of_node_get(master);
                slave = of_find_node_by_name(master, "mac-io");
 
                /* Check ordering of master & slave */