public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: add missing of_node_put in i2c_mux_del_adapters
@ 2017-03-03  7:57 Qi Hou
  2017-03-03 10:15 ` Peter Rosin
  2017-03-09 14:40 ` Wolfram Sang
  0 siblings, 2 replies; 4+ messages in thread
From: Qi Hou @ 2017-03-03  7:57 UTC (permalink / raw)
  To: peda, stable, robh, linux-i2c
  Cc: leif.lindholm, pantelis.antoniou, grant.likely, bruce.ashfield,
	paul.gortmaker, xiao.zhang

Refcount of of_node is increased with of_node_get() in i2c_mux_add_adapter().
It must be decreased with of_node_put() in i2c_mux_del_adapters().

Signe-off-by: Qi Hou <qi.hou@windriver.com>
Reviewed-by: Zhang Xiao <xiao.zhang@windriver.com>
Acked-by: Peter Rosin <peda@axentia.se>
---
 drivers/i2c/i2c-mux.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
index 83768e8..2178266 100644
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -429,6 +429,7 @@ void i2c_mux_del_adapters(struct i2c_mux_core *muxc)
 	while (muxc->num_adapters) {
 		struct i2c_adapter *adap = muxc->adapter[--muxc->num_adapters];
 		struct i2c_mux_priv *priv = adap->algo_data;
+		struct device_node *np = adap->dev.of_node;
 
 		muxc->adapter[muxc->num_adapters] = NULL;
 
@@ -438,6 +439,7 @@ void i2c_mux_del_adapters(struct i2c_mux_core *muxc)
 
 		sysfs_remove_link(&priv->adap.dev.kobj, "mux_device");
 		i2c_del_adapter(adap);
+		of_node_put(np);
 		kfree(priv);
 	}
 }
-- 
1.9.1

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

* Re: [PATCH] i2c: add missing of_node_put in i2c_mux_del_adapters
  2017-03-03  7:57 [PATCH] i2c: add missing of_node_put in i2c_mux_del_adapters Qi Hou
@ 2017-03-03 10:15 ` Peter Rosin
  2017-03-09 14:40 ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Rosin @ 2017-03-03 10:15 UTC (permalink / raw)
  To: Qi Hou, robh, linux-i2c
  Cc: leif.lindholm, pantelis.antoniou, grant.likely, bruce.ashfield,
	paul.gortmaker, xiao.zhang

On 2017-03-03 08:57, Qi Hou wrote:
> Refcount of of_node is increased with of_node_get() in i2c_mux_add_adapter().
> It must be decreased with of_node_put() in i2c_mux_del_adapters().

Oops, this one slipped though the cracks. Sorry about that!

> Signe-off-by: Qi Hou <qi.hou@windriver.com>

I fixed the above typo, added a Cc: stable tag and committed it to my
for-current branch.

Cheers,
peda

> Reviewed-by: Zhang Xiao <xiao.zhang@windriver.com>
> Acked-by: Peter Rosin <peda@axentia.se>
> ---
>  drivers/i2c/i2c-mux.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
> index 83768e8..2178266 100644
> --- a/drivers/i2c/i2c-mux.c
> +++ b/drivers/i2c/i2c-mux.c
> @@ -429,6 +429,7 @@ void i2c_mux_del_adapters(struct i2c_mux_core *muxc)
>  	while (muxc->num_adapters) {
>  		struct i2c_adapter *adap = muxc->adapter[--muxc->num_adapters];
>  		struct i2c_mux_priv *priv = adap->algo_data;
> +		struct device_node *np = adap->dev.of_node;
>  
>  		muxc->adapter[muxc->num_adapters] = NULL;
>  
> @@ -438,6 +439,7 @@ void i2c_mux_del_adapters(struct i2c_mux_core *muxc)
>  
>  		sysfs_remove_link(&priv->adap.dev.kobj, "mux_device");
>  		i2c_del_adapter(adap);
> +		of_node_put(np);
>  		kfree(priv);
>  	}
>  }
> 

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

* Re: [PATCH] i2c: add missing of_node_put in i2c_mux_del_adapters
  2017-03-03  7:57 [PATCH] i2c: add missing of_node_put in i2c_mux_del_adapters Qi Hou
  2017-03-03 10:15 ` Peter Rosin
@ 2017-03-09 14:40 ` Wolfram Sang
  2017-03-09 15:38   ` Wolfram Sang
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2017-03-09 14:40 UTC (permalink / raw)
  To: Qi Hou
  Cc: peda, stable, robh, linux-i2c, leif.lindholm, pantelis.antoniou,
	grant.likely, bruce.ashfield, paul.gortmaker, xiao.zhang

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

On Fri, Mar 03, 2017 at 03:57:11PM +0800, Qi Hou wrote:
> Refcount of of_node is increased with of_node_get() in i2c_mux_add_adapter().
> It must be decreased with of_node_put() in i2c_mux_del_adapters().
> 
> Signe-off-by: Qi Hou <qi.hou@windriver.com>
> Reviewed-by: Zhang Xiao <xiao.zhang@windriver.com>
> Acked-by: Peter Rosin <peda@axentia.se>

Applied to for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] i2c: add missing of_node_put in i2c_mux_del_adapters
  2017-03-09 14:40 ` Wolfram Sang
@ 2017-03-09 15:38   ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2017-03-09 15:38 UTC (permalink / raw)
  To: Qi Hou
  Cc: peda, stable, robh, linux-i2c, leif.lindholm, pantelis.antoniou,
	grant.likely, bruce.ashfield, paul.gortmaker, xiao.zhang

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

On Thu, Mar 09, 2017 at 03:40:33PM +0100, Wolfram Sang wrote:
> On Fri, Mar 03, 2017 at 03:57:11PM +0800, Qi Hou wrote:
> > Refcount of of_node is increased with of_node_get() in i2c_mux_add_adapter().
> > It must be decreased with of_node_put() in i2c_mux_del_adapters().
> > 
> > Signe-off-by: Qi Hou <qi.hou@windriver.com>
> > Reviewed-by: Zhang Xiao <xiao.zhang@windriver.com>
> > Acked-by: Peter Rosin <peda@axentia.se>
> 
> Applied to for-current, thanks!

For completeness, I reverted this patch and merged the fixed version
from Peter instead. Thanks Peter for the heads up!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-03-09 15:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-03  7:57 [PATCH] i2c: add missing of_node_put in i2c_mux_del_adapters Qi Hou
2017-03-03 10:15 ` Peter Rosin
2017-03-09 14:40 ` Wolfram Sang
2017-03-09 15:38   ` Wolfram Sang

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