Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1296075 > unrolled thread
| Started by | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| First post | 2015-12-21 18:00 +0100 |
| Last post | 2015-12-21 18:00 +0100 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/5] add missing of_node_put Julia Lawall <Julia.Lawall@lip6.fr> - 2015-12-21 18:00 +0100
[PATCH 2/5] pinctrl: sirf: add missing of_node_put Julia Lawall <Julia.Lawall@lip6.fr> - 2015-12-21 18:00 +0100
Re: [PATCH 2/5] pinctrl: sirf: add missing of_node_put Linus Walleij <linus.walleij@linaro.org> - 2015-12-22 13:50 +0100
[PATCH 1/5] pinctrl-tegra: add missing of_node_put Julia Lawall <Julia.Lawall@lip6.fr> - 2015-12-21 18:00 +0100
Re: [PATCH 1/5] pinctrl-tegra: add missing of_node_put Linus Walleij <linus.walleij@linaro.org> - 2015-12-22 13:50 +0100
[PATCH 5/5] pinctrl: mediatek: add missing of_node_put Julia Lawall <Julia.Lawall@lip6.fr> - 2015-12-21 18:00 +0100
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-12-21 18:00 +0100 |
| Subject | [PATCH 0/5] add missing of_node_put |
| Message-ID | <qIbYu-zb-7@gated-at.bofh.it> |
The various for_each device_node iterators performs an of_node_get on each
iteration, so a break out of the loop requires an of_node_put.
The complete semantic patch that fixes this problem is
(http://coccinelle.lip6.fr):
// <smpl>
@r@
local idexpression n;
expression e1,e2;
iterator name for_each_node_by_name, for_each_node_by_type,
for_each_compatible_node, for_each_matching_node,
for_each_matching_node_and_match, for_each_child_of_node,
for_each_available_child_of_node, for_each_node_with_property;
iterator i;
statement S;
expression list [n1] es;
@@
(
(
for_each_node_by_name(n,e1) S
|
for_each_node_by_type(n,e1) S
|
for_each_compatible_node(n,e1,e2) S
|
for_each_matching_node(n,e1) S
|
for_each_matching_node_and_match(n,e1,e2) S
|
for_each_child_of_node(e1,n) S
|
for_each_available_child_of_node(e1,n) S
|
for_each_node_with_property(n,e1) S
)
&
i(es,n,...) S
)
@@
local idexpression r.n;
iterator r.i;
expression e;
expression list [r.n1] es;
@@
i(es,n,...) {
...
(
of_node_put(n);
|
e = n
|
return n;
|
+ of_node_put(n);
? return ...;
)
...
}
@@
local idexpression r.n;
iterator r.i;
expression e;
expression list [r.n1] es;
@@
i(es,n,...) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? break;
)
...
}
... when != n
@@
local idexpression r.n;
iterator r.i;
expression e;
identifier l;
expression list [r.n1] es;
@@
i(es,n,...) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? goto l;
)
...
}
...
l: ... when != n// </smpl>
---
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 1 +
drivers/pinctrl/pinctrl-rockchip.c | 5 ++++-
drivers/pinctrl/pinctrl-tegra-xusb.c | 4 +++-
drivers/pinctrl/pinctrl-tegra.c | 1 +
drivers/pinctrl/sh-pfc/pinctrl.c | 4 +++-
drivers/pinctrl/sirf/pinctrl-sirf.c | 8 ++++++--
6 files changed, 18 insertions(+), 5 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-12-21 18:00 +0100 |
| Subject | [PATCH 2/5] pinctrl: sirf: add missing of_node_put |
| Message-ID | <qIbYv-zb-19@gated-at.bofh.it> |
| In reply to | #1296075 |
for_each_child_of_node performs an of_node_get on each iteration, so a
return from the loop requires an of_node_put.
A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):
// <smpl>
@@
local idexpression n;
expression e,e1;
@@
for_each_child_of_node(e1,n) {
...
(
of_node_put(n);
|
e = n
|
return n;
|
+ of_node_put(n);
? return ...;
)
...
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/pinctrl/sirf/pinctrl-sirf.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c
index ae97bdc..18fe46d 100644
--- a/drivers/pinctrl/sirf/pinctrl-sirf.c
+++ b/drivers/pinctrl/sirf/pinctrl-sirf.c
@@ -85,12 +85,16 @@ static int sirfsoc_dt_node_to_map(struct pinctrl_dev *pctldev,
/* calculate number of maps required */
for_each_child_of_node(np_config, np) {
ret = of_property_read_string(np, "sirf,function", &function);
- if (ret < 0)
+ if (ret < 0) {
+ of_node_put(np);
return ret;
+ }
ret = of_property_count_strings(np, "sirf,pins");
- if (ret < 0)
+ if (ret < 0) {
+ of_node_put(np);
return ret;
+ }
count += ret;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2015-12-22 13:50 +0100 |
| Subject | Re: [PATCH 2/5] pinctrl: sirf: add missing of_node_put |
| Message-ID | <qIuy6-41F-3@gated-at.bofh.it> |
| In reply to | #1296078 |
On Mon, Dec 21, 2015 at 5:39 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote: > for_each_child_of_node performs an of_node_get on each iteration, so a > return from the loop requires an of_node_put. > > A simplified version of the semantic patch that fixes this problem is as > follows (http://coccinelle.lip6.fr): Patch applied. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-12-21 18:00 +0100 |
| Subject | [PATCH 1/5] pinctrl-tegra: add missing of_node_put |
| Message-ID | <qIbYv-zb-29@gated-at.bofh.it> |
| In reply to | #1296075 |
for_each_child_of_node performs an of_node_get on each iteration, so a
return from the loop requires an of_node_put.
A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):
// <smpl>
@@
local idexpression n;
expression e,e1;
@@
for_each_child_of_node(e1,n) {
...
(
of_node_put(n);
|
e = n
|
return n;
|
+ of_node_put(n);
? return ...;
)
...
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/pinctrl/pinctrl-tegra-xusb.c | 4 +++-
drivers/pinctrl/pinctrl-tegra.c | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c
index 84a43e6..bd3aa5a 100644
--- a/drivers/pinctrl/pinctrl-tegra-xusb.c
+++ b/drivers/pinctrl/pinctrl-tegra-xusb.c
@@ -253,8 +253,10 @@ static int tegra_xusb_padctl_dt_node_to_map(struct pinctrl_dev *pinctrl,
err = tegra_xusb_padctl_parse_subnode(padctl, np, maps,
&reserved_maps,
num_maps);
- if (err < 0)
+ if (err < 0) {
+ of_node_put(np);
return err;
+ }
}
return 0;
diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
index 0fd7fd2..9da4da2 100644
--- a/drivers/pinctrl/pinctrl-tegra.c
+++ b/drivers/pinctrl/pinctrl-tegra.c
@@ -217,6 +217,7 @@ static int tegra_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
if (ret < 0) {
pinctrl_utils_dt_free_map(pctldev, *map,
*num_maps);
+ of_node_put(np);
return ret;
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2015-12-22 13:50 +0100 |
| Subject | Re: [PATCH 1/5] pinctrl-tegra: add missing of_node_put |
| Message-ID | <qIuy6-41F-1@gated-at.bofh.it> |
| In reply to | #1296079 |
On Mon, Dec 21, 2015 at 5:39 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote: > for_each_child_of_node performs an of_node_get on each iteration, so a > return from the loop requires an of_node_put. > > A simplified version of the semantic patch that fixes this problem is as > follows (http://coccinelle.lip6.fr): Patch applied. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-12-21 18:00 +0100 |
| Subject | [PATCH 5/5] pinctrl: mediatek: add missing of_node_put |
| Message-ID | <qIbYv-zb-31@gated-at.bofh.it> |
| In reply to | #1296075 |
for_each_child_of_node performs an of_node_get on each iteration, so a
return from the loop requires an of_node_put.
A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):
// <smpl>
@@
local idexpression n;
expression e,e1;
@@
for_each_child_of_node(e1,n) {
...
(
of_node_put(n);
|
e = n
|
return n;
|
+ of_node_put(n);
? return ...;
)
...
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 45f3562..ee2287b 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -598,6 +598,7 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
&reserved_maps, num_maps);
if (ret < 0) {
pinctrl_utils_dt_free_map(pctldev, *map, *num_maps);
+ of_node_put(np);
return ret;
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web