All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Xu <xuwei5@hisilicon.com>
To: Peng Wu <wupeng58@huawei.com>, <linux@armlinux.org.uk>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <liwei391@huawei.com>,
	<wangxiongfeng2@huawei.com>, <xuwei5@hisilicon.com>
Subject: Re: [PATCH] ARM: hisi: Add missing of_node_put after of_find_compatible_node
Date: Sat, 7 May 2022 16:25:26 +0800	[thread overview]
Message-ID: <62762CF6.3010004@hisilicon.com> (raw)
In-Reply-To: <20220428104306.21682-1-wupeng58@huawei.com>

Hi Peng,

On 2022/4/28 18:43, Peng Wu wrote:
> of_find_compatible_node  will increment the refcount of the returned
> device_node. Calling of_node_put() to avoid the refcount leak
> 
> Signed-off-by: Peng Wu <wupeng58@huawei.com>

Thanks!
Applied to the hisilicon armv7 SoC tree.

Best Regards,
Wei

> ---
>  arch/arm/mach-hisi/platsmp.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c
> index a56cc64deeb8..9ce93e0b6cdc 100644
> --- a/arch/arm/mach-hisi/platsmp.c
> +++ b/arch/arm/mach-hisi/platsmp.c
> @@ -67,14 +67,17 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
>  		}
>  		ctrl_base = of_iomap(np, 0);
>  		if (!ctrl_base) {
> +			of_node_put(np);
>  			pr_err("failed to map address\n");
>  			return;
>  		}
>  		if (of_property_read_u32(np, "smp-offset", &offset) < 0) {
> +			of_node_put(np);
>  			pr_err("failed to find smp-offset property\n");
>  			return;
>  		}
>  		ctrl_base += offset;
> +		of_node_put(np);
>  	}
>  }
>  
> @@ -160,6 +163,7 @@ static int hip01_boot_secondary(unsigned int cpu, struct task_struct *idle)
>  	if (WARN_ON(!node))
>  		return -1;
>  	ctrl_base = of_iomap(node, 0);
> +	of_node_put(node);
>  
>  	/* set the secondary core boot from DDR */
>  	remap_reg_value = readl_relaxed(ctrl_base + REG_SC_CTRL);
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Wei Xu <xuwei5@hisilicon.com>
To: Peng Wu <wupeng58@huawei.com>, <linux@armlinux.org.uk>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <liwei391@huawei.com>,
	<wangxiongfeng2@huawei.com>, <xuwei5@hisilicon.com>
Subject: Re: [PATCH] ARM: hisi: Add missing of_node_put after of_find_compatible_node
Date: Sat, 7 May 2022 16:25:26 +0800	[thread overview]
Message-ID: <62762CF6.3010004@hisilicon.com> (raw)
In-Reply-To: <20220428104306.21682-1-wupeng58@huawei.com>

Hi Peng,

On 2022/4/28 18:43, Peng Wu wrote:
> of_find_compatible_node  will increment the refcount of the returned
> device_node. Calling of_node_put() to avoid the refcount leak
> 
> Signed-off-by: Peng Wu <wupeng58@huawei.com>

Thanks!
Applied to the hisilicon armv7 SoC tree.

Best Regards,
Wei

> ---
>  arch/arm/mach-hisi/platsmp.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c
> index a56cc64deeb8..9ce93e0b6cdc 100644
> --- a/arch/arm/mach-hisi/platsmp.c
> +++ b/arch/arm/mach-hisi/platsmp.c
> @@ -67,14 +67,17 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
>  		}
>  		ctrl_base = of_iomap(np, 0);
>  		if (!ctrl_base) {
> +			of_node_put(np);
>  			pr_err("failed to map address\n");
>  			return;
>  		}
>  		if (of_property_read_u32(np, "smp-offset", &offset) < 0) {
> +			of_node_put(np);
>  			pr_err("failed to find smp-offset property\n");
>  			return;
>  		}
>  		ctrl_base += offset;
> +		of_node_put(np);
>  	}
>  }
>  
> @@ -160,6 +163,7 @@ static int hip01_boot_secondary(unsigned int cpu, struct task_struct *idle)
>  	if (WARN_ON(!node))
>  		return -1;
>  	ctrl_base = of_iomap(node, 0);
> +	of_node_put(node);
>  
>  	/* set the secondary core boot from DDR */
>  	remap_reg_value = readl_relaxed(ctrl_base + REG_SC_CTRL);
> 


  reply	other threads:[~2022-05-07  8:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 10:43 [PATCH] ARM: hisi: Add missing of_node_put after of_find_compatible_node Peng Wu
2022-04-28 10:43 ` Peng Wu
2022-05-07  8:25 ` Wei Xu [this message]
2022-05-07  8:25   ` Wei Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=62762CF6.3010004@hisilicon.com \
    --to=xuwei5@hisilicon.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=liwei391@huawei.com \
    --cc=wangxiongfeng2@huawei.com \
    --cc=wupeng58@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.