<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace"><span style="font-family:arial">On Sun, Dec 29, 2013 at 8:37 PM, Benjamin Herrenschmidt </span><span dir="ltr" style="font-family:arial"><<a href="mailto:benh@kernel.crashing.org" target="_blank">benh@kernel.crashing.org</a>></span><span style="font-family:arial"> wrote:</span><br>
</div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, 2013-12-17 at 18:32 +0100, Cédric Le Goater wrote:<br>

> Commit 2361613206e6, "of/irq: Refactor interrupt-map parsing" changed<br>
> the refcount on the device_node causing an error in of_node_put():<br>
<br>
</div>Grant, Thierry, this is a regression, please send to Linus ASAP...<br>
<br></blockquote><div><br></div><div class="gmail_default" style="font-family:'courier new',monospace">I'm working on doing that right this moment.</div><div class="gmail_default" style="font-family:'courier new',monospace">
<br></div><div class="gmail_default" style="font-family:'courier new',monospace">Rob</div><div class="gmail_default" style="font-family:'courier new',monospace"></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Cheers,<br>
Ben.<br>
<div class="HOEnZb"><div class="h5"><br>
> ERROR: Bad of_node_put() on /pci@800000020000000<br>
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.13.0-rc3-dirty #2<br>
> Call Trace:<br>
> [c00000003e403500] [c0000000000144fc] .show_stack+0x7c/0x1f0 (unreliable)<br>
> [c00000003e4035d0] [c00000000070f250] .dump_stack+0x88/0xb4<br>
> [c00000003e403650] [c0000000005e8768] .of_node_release+0xd8/0xf0<br>
> [c00000003e4036e0] [c0000000005eeafc] .of_irq_parse_one+0x10c/0x280<br>
> [c00000003e4037a0] [c0000000005efd4c] .of_irq_parse_pci+0x3c/0x1d0<br>
> [c00000003e403840] [c000000000038240] .pcibios_setup_device+0xa0/0x2e0<br>
> [c00000003e403910] [c0000000000398f0] .pcibios_setup_bus_devices+0x60/0xd0<br>
> [c00000003e403990] [c00000000003b3a4] .__of_scan_bus+0x1a4/0x2b0<br>
> [c00000003e403a80] [c00000000003a62c] .pcibios_scan_phb+0x30c/0x410<br>
> [c00000003e403b60] [c0000000009fe430] .pcibios_init+0x7c/0xd4<br>
><br>
> This patch adjusts the refcount in the walk of the interrupt tree.<br>
> When a match is found, there is no need to increase the refcount<br>
> on 'out_irq->np' as 'newpar' is already holding a ref. The refcount<br>
> balance between 'ipar' and 'newpar' is maintained in the skiplevel:<br>
> goto label.<br>
><br>
> This patch also removes the usage of the device_node variable 'old'<br>
> which seems useless after the latest changes.<br>
><br>
> Signed-off-by: Cédric Le Goater <<a href="mailto:clg@fr.ibm.com">clg@fr.ibm.com</a>><br>
> ---<br>
><br>
> This patch was tested on powerpc, pseries and powernv. This is a<br>
> new area for me so I might have missed a path. Please take a look.<br>
><br>
> We could now introduce an helper routine to look for #address-cells in<br>
> of_irq_parse_raw(). This can be the subject of another patch.<br>
><br>
> Thanks,<br>
><br>
> C.<br>
><br>
>  drivers/of/irq.c |    5 +----<br>
>  1 file changed, 1 insertion(+), 4 deletions(-)<br>
><br>
> diff --git a/drivers/of/irq.c b/drivers/of/irq.c<br>
> index 786b0b47fae4..27212402c532 100644<br>
> --- a/drivers/of/irq.c<br>
> +++ b/drivers/of/irq.c<br>
> @@ -165,7 +165,6 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)<br>
>               if (of_get_property(ipar, "interrupt-controller", NULL) !=<br>
>                               NULL) {<br>
>                       pr_debug(" -> got it !\n");<br>
> -                     of_node_put(old);<br>
>                       return 0;<br>
>               }<br>
><br>
> @@ -250,8 +249,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)<br>
>                * Successfully parsed an interrrupt-map translation; copy new<br>
>                * interrupt specifier into the out_irq structure<br>
>                */<br>
> -             of_node_put(out_irq->np);<br>
> -             out_irq->np = of_node_get(newpar);<br>
> +             out_irq->np = newpar;<br>
><br>
>               match_array = imap - newaddrsize - newintsize;<br>
>               for (i = 0; i < newintsize; i++)<br>
> @@ -268,7 +266,6 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)<br>
>       }<br>
>   fail:<br>
>       of_node_put(ipar);<br>
> -     of_node_put(out_irq->np);<br>
>       of_node_put(newpar);<br>
><br>
>       return -EINVAL;<br>
<br>
<br>
--<br>
</div></div><div class="HOEnZb"><div class="h5">To unsubscribe from this list: send the line "unsubscribe devicetree" in<br>
the body of a message to <a href="mailto:majordomo@vger.kernel.org">majordomo@vger.kernel.org</a><br>
More majordomo info at  <a href="http://vger.kernel.org/majordomo-info.html" target="_blank">http://vger.kernel.org/majordomo-info.html</a><br>
</div></div></blockquote></div><br></div></div>