Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1379793 > unrolled thread
| Started by | Jon Hunter <jonathanh@nvidia.com> |
|---|---|
| First post | 2016-04-15 14:50 +0200 |
| Last post | 2016-04-15 17:40 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] i2c: core: Add missing of_node_put() Jon Hunter <jonathanh@nvidia.com> - 2016-04-15 14:50 +0200
Re: [PATCH] i2c: core: Add missing of_node_put() Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> - 2016-04-15 17:00 +0200
Re: [PATCH] i2c: core: Add missing of_node_put() Jon Hunter <jonathanh@nvidia.com> - 2016-04-15 17:40 +0200
| From | Jon Hunter <jonathanh@nvidia.com> |
|---|---|
| Date | 2016-04-15 14:50 +0200 |
| Subject | [PATCH] i2c: core: Add missing of_node_put() |
| Message-ID | <robm9-36m-7@gated-at.bofh.it> |
for_each_available_child_of_node performs an of_node_get on each
iteration, so of_node_put() must be called on each iteration once
we are finished with the node pointer.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
drivers/i2c/i2c-core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 4979728f7fb2..38f4dae681a9 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1428,9 +1428,9 @@ static void of_i2c_register_devices(struct i2c_adapter *adap)
dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");
for_each_available_child_of_node(adap->dev.of_node, node) {
- if (of_node_test_and_set_flag(node, OF_POPULATED))
- continue;
- of_i2c_register_device(adap, node);
+ if (!of_node_test_and_set_flag(node, OF_POPULATED))
+ of_i2c_register_device(adap, node);
+ of_node_put(node);
}
}
--
2.1.4
[toc] | [next] | [standalone]
| From | Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> |
|---|---|
| Date | 2016-04-15 17:00 +0200 |
| Message-ID | <rodnY-4BO-25@gated-at.bofh.it> |
| In reply to | #1379793 |
On 15.04.2016 15:43, Jon Hunter wrote:
> for_each_available_child_of_node performs an of_node_get on each
> iteration, so of_node_put() must be called on each iteration once
> we are finished with the node pointer.
This is wrong, embedded of_get_next_available_child() correctly decrements
ref counter of an examined node.
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> drivers/i2c/i2c-core.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 4979728f7fb2..38f4dae681a9 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -1428,9 +1428,9 @@ static void of_i2c_register_devices(struct i2c_adapter *adap)
> dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");
>
> for_each_available_child_of_node(adap->dev.of_node, node) {
> - if (of_node_test_and_set_flag(node, OF_POPULATED))
> - continue;
> - of_i2c_register_device(adap, node);
> + if (!of_node_test_and_set_flag(node, OF_POPULATED))
> + of_i2c_register_device(adap, node);
> + of_node_put(node);
> }
> }
>
>
--
With best wishes,
Vladimir
[toc] | [prev] | [next] | [standalone]
| From | Jon Hunter <jonathanh@nvidia.com> |
|---|---|
| Date | 2016-04-15 17:40 +0200 |
| Message-ID | <roe0G-5dC-23@gated-at.bofh.it> |
| In reply to | #1379898 |
On 15/04/16 15:58, Vladimir Zapolskiy wrote: > On 15.04.2016 15:43, Jon Hunter wrote: >> for_each_available_child_of_node performs an of_node_get on each >> iteration, so of_node_put() must be called on each iteration once >> we are finished with the node pointer. > > This is wrong, embedded of_get_next_available_child() correctly decrements > ref counter of an examined node. Oh yes, sorry, I see that now. Sorry for the noise and mis-interpretation here :-( Jon
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web