linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] pinctrl: call of_node_put() when breaking out of for_each_available_child_of_node()
  2022-11-22  7:58 [PATCH] pinctrl: call of_node_put() when breaking out of for_each_available_child_of_node() Peng Zhang
@ 2022-11-22  7:45 ` Damien Le Moal
  2022-11-22  8:36 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2022-11-22  7:45 UTC (permalink / raw)
  To: Peng Zhang, linus.walleij@linaro.org, seanga2@gmail.com,
	palmerdabbelt@google.com
  Cc: linux-riscv@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, sunnanyong@huawei.com,
	wangkefeng.wang@huawei.com

On 2022/11/22 16:33, Peng Zhang wrote:
> From: ZhangPeng <zhangpeng362@huawei.com>
> 
> Since for_each_available_child_of_node() will increase the refcount of
> node, we need to call of_node_put() manually when breaking out of the
> iteration.
> 
> Fixes: d4c34d09ab03 ("pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver")
> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
> ---
>  drivers/pinctrl/pinctrl-k210.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c
> index ecab6bf63dc6..ad4db99094a7 100644
> --- a/drivers/pinctrl/pinctrl-k210.c
> +++ b/drivers/pinctrl/pinctrl-k210.c
> @@ -862,8 +862,10 @@ static int k210_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
>  	for_each_available_child_of_node(np_config, np) {
>  		ret = k210_pinctrl_dt_subnode_to_map(pctldev, np, map,
>  						     &reserved_maps, num_maps);
> -		if (ret < 0)
> +		if (ret < 0) {
> +			of_node_put(np);
>  			goto err;
> +		}
>  	}
>  	return 0;
>  

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] pinctrl: call of_node_put() when breaking out of for_each_available_child_of_node()
@ 2022-11-22  7:58 Peng Zhang
  2022-11-22  7:45 ` Damien Le Moal
  2022-11-22  8:36 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Peng Zhang @ 2022-11-22  7:58 UTC (permalink / raw)
  To: damien.lemoal, linus.walleij, seanga2, palmerdabbelt
  Cc: linux-riscv, linux-gpio, linux-kernel, sunnanyong,
	wangkefeng.wang, ZhangPeng

From: ZhangPeng <zhangpeng362@huawei.com>

Since for_each_available_child_of_node() will increase the refcount of
node, we need to call of_node_put() manually when breaking out of the
iteration.

Fixes: d4c34d09ab03 ("pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver")
Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
---
 drivers/pinctrl/pinctrl-k210.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c
index ecab6bf63dc6..ad4db99094a7 100644
--- a/drivers/pinctrl/pinctrl-k210.c
+++ b/drivers/pinctrl/pinctrl-k210.c
@@ -862,8 +862,10 @@ static int k210_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
 	for_each_available_child_of_node(np_config, np) {
 		ret = k210_pinctrl_dt_subnode_to_map(pctldev, np, map,
 						     &reserved_maps, num_maps);
-		if (ret < 0)
+		if (ret < 0) {
+			of_node_put(np);
 			goto err;
+		}
 	}
 	return 0;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: call of_node_put() when breaking out of for_each_available_child_of_node()
  2022-11-22  7:58 [PATCH] pinctrl: call of_node_put() when breaking out of for_each_available_child_of_node() Peng Zhang
  2022-11-22  7:45 ` Damien Le Moal
@ 2022-11-22  8:36 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2022-11-22  8:36 UTC (permalink / raw)
  To: Peng Zhang
  Cc: damien.lemoal, seanga2, palmerdabbelt, linux-riscv, linux-gpio,
	linux-kernel, sunnanyong, wangkefeng.wang

On Tue, Nov 22, 2022 at 8:34 AM Peng Zhang <zhangpeng362@huawei.com> wrote:

> From: ZhangPeng <zhangpeng362@huawei.com>
>
> Since for_each_available_child_of_node() will increase the refcount of
> node, we need to call of_node_put() manually when breaking out of the
> iteration.
>
> Fixes: d4c34d09ab03 ("pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver")
> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-22  8:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-22  7:58 [PATCH] pinctrl: call of_node_put() when breaking out of for_each_available_child_of_node() Peng Zhang
2022-11-22  7:45 ` Damien Le Moal
2022-11-22  8:36 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).