linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args()
@ 2013-04-09  6:56 Yuantian.Tang
  2013-04-10  9:03 ` Stephen Rothwell
  0 siblings, 1 reply; 4+ messages in thread
From: Yuantian.Tang @ 2013-04-09  6:56 UTC (permalink / raw)
  To: grant.likely
  Cc: Tang Yuantian, devicetree-discuss, linuxppc-dev, linux-kernel,
	rob.herring

From: Tang Yuantian <yuantian.tang@freescale.com>

As the function itself says it is caller's responsibility to call the
of_node_put().  So, remove it on success to keep the reference count
correct.

Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
---
 drivers/of/base.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 321d3ef..e8b4c28 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1168,9 +1168,6 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
 					out_args->args[i] = be32_to_cpup(list++);
 			}
 
-			/* Found it! return success */
-			if (node)
-				of_node_put(node);
 			return 0;
 		}
 
-- 
1.8.0

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

* Re: [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args()
  2013-04-09  6:56 [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args() Yuantian.Tang
@ 2013-04-10  9:03 ` Stephen Rothwell
  2013-04-10  9:06   ` Tang Yuantian-B29983
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2013-04-10  9:03 UTC (permalink / raw)
  To: Yuantian.Tang; +Cc: devicetree-discuss, linuxppc-dev, linux-kernel, rob.herring

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

Hi,

On Tue, 9 Apr 2013 14:56:09 +0800 <Yuantian.Tang@freescale.com> wrote:
>
> From: Tang Yuantian <yuantian.tang@freescale.com>
> 
> As the function itself says it is caller's responsibility to call the
> of_node_put().  So, remove it on success to keep the reference count
> correct.
> 
> Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
> ---
>  drivers/of/base.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 321d3ef..e8b4c28 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1168,9 +1168,6 @@ static int __of_parse_phandle_with_args(const struct device_node *np,
>  					out_args->args[i] = be32_to_cpup(list++);
>  			}
>  
> -			/* Found it! return success */
> -			if (node)
> -				of_node_put(node);

Actually, if out_args is NULL, you should do the of_node_put(node), so
probably the correct fix is to add an "else" before the above "if" (and
move the comment).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* RE: [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args()
  2013-04-10  9:03 ` Stephen Rothwell
@ 2013-04-10  9:06   ` Tang Yuantian-B29983
  2013-04-10 11:09     ` Stephen Rothwell
  0 siblings, 1 reply; 4+ messages in thread
From: Tang Yuantian-B29983 @ 2013-04-10  9:06 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: devicetree-discuss@lists.ozlabs.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	rob.herring@calxeda.com

DQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206IFN0ZXBoZW4gUm90aHdlbGwg
W21haWx0bzpzZnJAY2FuYi5hdXVnLm9yZy5hdV0NCj4gU2VudDogMjAxM8TqNNTCMTDI1SAxNzow
Mw0KPiBUbzogVGFuZyBZdWFudGlhbi1CMjk5ODMNCj4gQ2M6IGdyYW50Lmxpa2VseUBzZWNyZXRs
YWIuY2E7IGRldmljZXRyZWUtZGlzY3Vzc0BsaXN0cy5vemxhYnMub3JnOw0KPiBsaW51eHBwYy1k
ZXZA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ZHJpdmVycy9vZi9iYXNlLmMNCj4g
PiBAQCAtMTE2OCw5ICsxMTY4LDYgQEAgc3RhdGljIGludCBfX29mX3BhcnNlX3BoYW5kbGVfd2l0
aF9hcmdzKGNvbnN0DQo+IHN0cnVjdCBkZXZpY2Vfbm9kZSAqbnAsDQo+ID4gIAkJCQkJb3V0X2Fy
Z3MtPmFyZ3NbaV0gPSBiZTMyX3RvX2NwdXAobGlzdCsrKTsNCj4gPiAgCQkJfQ0KPiA+DQo+ID4g
LQkJCS8qIEZvdW5kIGl0ISByZXR1cm4gc3VjY2VzcyAqLw0KPiA+IC0JCQlpZiAobm9kZSkNCj4g
PiAtCQkJCW9mX25vZGVfcHV0KG5vZGUpOw0KPiANCj4gQWN0dWFsbHksIGlmIG91dF9hcmdzIGlz
IE5VTEwsIHlvdSBzaG91bGQgZG8gdGhlIG9mX25vZGVfcHV0KG5vZGUpLCBzbw0KPiBwcm9iYWJs
eSB0aGUgY29ycmVjdCBmaXggaXMgdG8gYWRkIGFuICJlbHNlIiBiZWZvcmUgdGhlIGFib3ZlICJp
ZiIgKGFuZA0KPiBtb3ZlIHRoZSBjb21tZW50KS4NCj4gDQoNClllcywgSSBhbHJlYWR5IHNlbnQg
b3V0IHRoZSB2MiBwYXRjaC4NClBsZWFzZSBzZWU6IGh0dHA6Ly9wYXRjaHdvcmsub3psYWJzLm9y
Zy9wYXRjaC8yMzUyODgvDQoNClJlZ2FyZHMsDQpZdWFudGlhbg0KDQo+IC0tDQo+IENoZWVycywN
Cj4gU3RlcGhlbiBSb3Rod2VsbCAgICAgICAgICAgICAgICAgICAgc2ZyQGNhbmIuYXV1Zy5vcmcu
YXUNCj4gaHR0cDovL3d3dy5jYW5iLmF1dWcub3JnLmF1L35zZnIvDQo=

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

* Re: [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args()
  2013-04-10  9:06   ` Tang Yuantian-B29983
@ 2013-04-10 11:09     ` Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2013-04-10 11:09 UTC (permalink / raw)
  To: Tang Yuantian-B29983
  Cc: devicetree-discuss@lists.ozlabs.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	rob.herring@calxeda.com

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

Hi,

On Wed, 10 Apr 2013 09:06:11 +0000 Tang Yuantian-B29983 <B29983@freescale.com> wrote:
>
> Yes, I already sent out the v2 patch.
> Please see: http://patchwork.ozlabs.org/patch/235288/

Thanks.  I should read all my email before replying to it :-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-04-10 11:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-09  6:56 [PATCH] of: remove the unnecessary of_node_put for of_parse_phandle_with_args() Yuantian.Tang
2013-04-10  9:03 ` Stephen Rothwell
2013-04-10  9:06   ` Tang Yuantian-B29983
2013-04-10 11:09     ` Stephen Rothwell

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).