[PATCH] missing refcounting of of_find_node_by_name users

Paul Mackerras paulus at samba.org
Tue Feb 7 21:49:49 EST 2006


Olaf Hering writes:

> drop the refcount of the node returned from of_find_node_by_name
[snip]

> --- linux-2.6.16-rc2-olh.orig/arch/powerpc/platforms/powermac/feature.c
> +++ linux-2.6.16-rc2-olh/arch/powerpc/platforms/powermac/feature.c
> @@ -2772,6 +2772,7 @@ set_initial_features(void)
>  				g5_gmac_enable(np, 0, 1);
>  			np = of_find_node_by_name(np, "ethernet");
>  		}
> +		of_node_put(np);

This one isn't necessary, since np is NULL by the time we get out of
the loop.  Same applies to the other places in this file that this
patch affects.

> Index: linux-2.6.16-rc2-olh/arch/powerpc/platforms/powermac/pci.c
> ===================================================================
> --- linux-2.6.16-rc2-olh.orig/arch/powerpc/platforms/powermac/pci.c
> +++ linux-2.6.16-rc2-olh/arch/powerpc/platforms/powermac/pci.c
> @@ -695,6 +695,7 @@ static void __init fixup_nec_usb2(void)
>  				nec->intrs[0].line);
>  		}
>  	}
> +	of_put_node(nec);

Once again, nec is NULL by the time we get here.  And of_put_node
doesn't exist. :(  Did you compile-test this?

Regards,
Paul.



More information about the Linuxppc-dev mailing list