public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] i2c: i2c-mux-gpmux: Add of_node_put() when breaking out of loop
@ 2022-07-22  1:24 Liang He
  2022-07-25 21:38 ` Peter Rosin
  0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-07-22  1:24 UTC (permalink / raw)
  To: peda, linux-i2c, windhl

In i2c_mux_probe(), we should call of_node_put() when breaking out
of for_each_child_of_node() which will automatically increase and
decrease the refcount.

Fixes: ac8498f0ce53 ("i2c: i2c-mux-gpmux: new driver")
Signed-off-by: Liang He <windhl@126.com>
---
 changelog:

 v2: make a correct patch pointed out by Peter 
 v1: https://lore.kernel.org/all/20220721081202.1300071-1-windhl@126.com/

 drivers/i2c/muxes/i2c-mux-gpmux.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c
index d3acd8d66c32..33024acaac02 100644
--- a/drivers/i2c/muxes/i2c-mux-gpmux.c
+++ b/drivers/i2c/muxes/i2c-mux-gpmux.c
@@ -134,6 +134,7 @@ static int i2c_mux_probe(struct platform_device *pdev)
 	return 0;
 
 err_children:
+	of_node_put(child);
 	i2c_mux_del_adapters(muxc);
 err_parent:
 	i2c_put_adapter(parent);
-- 
2.25.1


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

* Re: [PATCH v2] i2c: i2c-mux-gpmux: Add of_node_put() when breaking out of loop
  2022-07-22  1:24 [PATCH v2] i2c: i2c-mux-gpmux: Add of_node_put() when breaking out of loop Liang He
@ 2022-07-25 21:38 ` Peter Rosin
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Rosin @ 2022-07-25 21:38 UTC (permalink / raw)
  To: Liang He, linux-i2c

2022-07-22 at 03:24, Liang He wrote:
> In i2c_mux_probe(), we should call of_node_put() when breaking out
> of for_each_child_of_node() which will automatically increase and
> decrease the refcount.
> 
> Fixes: ac8498f0ce53 ("i2c: i2c-mux-gpmux: new driver")
> Signed-off-by: Liang He <windhl@126.com>

Acked-by: Peter Rosin <peda@axentia.se>

Cheers,
Peter

> ---
>  changelog:
> 
>  v2: make a correct patch pointed out by Peter 
>  v1: https://lore.kernel.org/all/20220721081202.1300071-1-windhl@126.com/
> 
>  drivers/i2c/muxes/i2c-mux-gpmux.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c
> index d3acd8d66c32..33024acaac02 100644
> --- a/drivers/i2c/muxes/i2c-mux-gpmux.c
> +++ b/drivers/i2c/muxes/i2c-mux-gpmux.c
> @@ -134,6 +134,7 @@ static int i2c_mux_probe(struct platform_device *pdev)
>  	return 0;
>  
>  err_children:
> +	of_node_put(child);
>  	i2c_mux_del_adapters(muxc);
>  err_parent:
>  	i2c_put_adapter(parent);

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

end of thread, other threads:[~2022-07-25 21:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-22  1:24 [PATCH v2] i2c: i2c-mux-gpmux: Add of_node_put() when breaking out of loop Liang He
2022-07-25 21:38 ` Peter Rosin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox