[PATCH] ARM: shmobile: R-Mobile: Fix DT refcount bugs in PM domain code
Simon Horman
horms at verge.net.au
Wed Jan 14 15:38:46 PST 2015
On Wed, Jan 14, 2015 at 11:50:48AM +0100, Geert Uytterhoeven wrote:
> Fix two DT refcount imbalances in the PM domain code that scans the DT
> topology:
>
> 1. Add missing of_node_put() after of_find_compatible_node().
>
> 2. If CONFIG_OF_DYNAMIC=y:
>
> ERROR: Bad of_node_put() on /system-controller at e6180000
> <backtrace>
>
> of_find_node_by_name() calls of_node_put() on its "from" parameter,
> which must not be done on the for_each_compatible_node() iterator,
> as it causes a zero refcount later.
> Use of_get_child_by_name() instead to fix this.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
> ---
> Fixes: d7a3a10c8391fdcd ("ARM: shmobile: R-Mobile: Add DT support for PM domains")
> in Simon's git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git
> tag renesas-dt-pm-for-v3.20
Thanks.
As the patch above is not in the ARM SoC tree yet I have decided
to squash this patch into it.
> ---
> arch/arm/mach-shmobile/pm-rmobile.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
> index 07fb4ea4d8e94258..85a7fdd9823bc5a6 100644
> --- a/arch/arm/mach-shmobile/pm-rmobile.c
> +++ b/arch/arm/mach-shmobile/pm-rmobile.c
> @@ -270,8 +270,10 @@ static void __init get_special_pds(void)
>
> /* PM domain containing Coresight-ETM */
> np = of_find_compatible_node(NULL, NULL, "arm,coresight-etm3x");
> - if (np)
> + if (np) {
> debug_pd = of_parse_phandle(np, "power-domains", 0);
> + of_node_put(np);
> + }
> }
>
> static void __init put_special_pds(void)
> @@ -363,7 +365,7 @@ static int __init rmobile_init_pm_domains(void)
> continue;
> }
>
> - pmd = of_find_node_by_name(np, "pm-domains");
> + pmd = of_get_child_by_name(np, "pm-domains");
> if (!pmd) {
> pr_warn("%s lacks pm-domains node\n", np->full_name);
> continue;
> --
> 1.9.1
>
More information about the linux-arm-kernel
mailing list