* [PATCH 0/5] fix leaked of_node references in drivers/pinctrl
@ 2019-04-12 6:02 Wen Yang
2019-04-12 6:02 ` [PATCH 1/5] pinctrl: pistachio: fix leaked of_node references Wen Yang
` (4 more replies)
0 siblings, 5 replies; 15+ messages in thread
From: Wen Yang @ 2019-04-12 6:02 UTC (permalink / raw)
To: linux-kernel; +Cc: wang.yi59, Wen Yang
The call to of_get_cpu_node/of_find_compatible_node/of_parse_phandle...
returns a node pointer with refcount incremented thus it must be
explicitly decremented after the last usage.
We developed a coccinelle SmPL to detect drivers/pinctrl code and
found some issues.
This patch series fixes those issues.
Wen Yang (5):
pinctrl: pistachio: fix leaked of_node references
pinctrl: rockchip: fix leaked of_node references
pinctrl: st: fix leaked of_node references
pinctrl: samsung: fix leaked of_node references
pinctrl: zte: fix leaked of_node references
drivers/pinctrl/pinctrl-pistachio.c | 2 ++
drivers/pinctrl/pinctrl-rockchip.c | 1 +
drivers/pinctrl/pinctrl-st.c | 15 ++++++++++-----
drivers/pinctrl/samsung/pinctrl-exynos-arm.c | 1 +
drivers/pinctrl/zte/pinctrl-zx.c | 1 +
5 files changed, 15 insertions(+), 5 deletions(-)
--
2.9.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/5] pinctrl: pistachio: fix leaked of_node references
2019-04-12 6:02 [PATCH 0/5] fix leaked of_node references in drivers/pinctrl Wen Yang
@ 2019-04-12 6:02 ` Wen Yang
2019-04-14 13:15 ` Markus Elfring
2019-04-23 10:34 ` Linus Walleij
2019-04-12 6:02 ` [PATCH 2/5] pinctrl: rockchip: " Wen Yang
` (3 subsequent siblings)
4 siblings, 2 replies; 15+ messages in thread
From: Wen Yang @ 2019-04-12 6:02 UTC (permalink / raw)
To: linux-kernel; +Cc: wang.yi59, Wen Yang, Linus Walleij, linux-gpio
The call to of_get_child_by_name returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/pinctrl-pistachio.c:1422:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1360, but without a corresponding object release within this function.
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/pinctrl/pinctrl-pistachio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c
index aa5f949..5b0678f 100644
--- a/drivers/pinctrl/pinctrl-pistachio.c
+++ b/drivers/pinctrl/pinctrl-pistachio.c
@@ -1367,6 +1367,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
if (!of_find_property(child, "gpio-controller", NULL)) {
dev_err(pctl->dev,
"No gpio-controller property for bank %u\n", i);
+ of_node_put(child);
ret = -ENODEV;
goto err;
}
@@ -1374,6 +1375,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
irq = irq_of_parse_and_map(child, 0);
if (irq < 0) {
dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq);
+ of_node_put(child);
ret = irq;
goto err;
}
--
2.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/5] pinctrl: rockchip: fix leaked of_node references
2019-04-12 6:02 [PATCH 0/5] fix leaked of_node references in drivers/pinctrl Wen Yang
2019-04-12 6:02 ` [PATCH 1/5] pinctrl: pistachio: fix leaked of_node references Wen Yang
@ 2019-04-12 6:02 ` Wen Yang
2019-04-12 8:08 ` Heiko Stübner
2019-04-12 6:02 ` [PATCH 3/5] pinctrl: st: " Wen Yang
` (2 subsequent siblings)
4 siblings, 1 reply; 15+ messages in thread
From: Wen Yang @ 2019-04-12 6:02 UTC (permalink / raw)
To: linux-kernel
Cc: wang.yi59, Wen Yang, Linus Walleij, Heiko Stuebner, linux-gpio,
linux-arm-kernel, linux-rockchip
The call to of_parse_phandle returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/pinctrl-rockchip.c:3221:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3196, but without a corresponding object release within this function.
./drivers/pinctrl/pinctrl-rockchip.c:3223:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3196, but without a corresponding object release within this function.
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: linux-gpio@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
drivers/pinctrl/pinctrl-rockchip.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 16bf21b..e22d387 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -3195,6 +3195,7 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
node = of_parse_phandle(bank->of_node->parent,
"rockchip,pmu", 0);
+ of_node_put(node);
if (!node) {
if (of_address_to_resource(bank->of_node, 1, &res)) {
dev_err(info->dev, "cannot find IO resource for bank\n");
--
2.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/5] pinctrl: st: fix leaked of_node references
2019-04-12 6:02 [PATCH 0/5] fix leaked of_node references in drivers/pinctrl Wen Yang
2019-04-12 6:02 ` [PATCH 1/5] pinctrl: pistachio: fix leaked of_node references Wen Yang
2019-04-12 6:02 ` [PATCH 2/5] pinctrl: rockchip: " Wen Yang
@ 2019-04-12 6:02 ` Wen Yang
2019-04-12 8:57 ` Patrice CHOTARD
2019-04-23 9:02 ` Linus Walleij
2019-04-12 6:02 ` [PATCH 4/5] pinctrl: samsung: " Wen Yang
2019-04-12 6:02 ` [PATCH 5/5] pinctrl: zte: " Wen Yang
4 siblings, 2 replies; 15+ messages in thread
From: Wen Yang @ 2019-04-12 6:02 UTC (permalink / raw)
To: linux-kernel
Cc: wang.yi59, Wen Yang, Patrice Chotard, Linus Walleij, linux-gpio
The call to of_get_child_by_name returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/pinctrl-st.c:1188:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
./drivers/pinctrl/pinctrl-st.c:1188:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
./drivers/pinctrl/pinctrl-st.c:1199:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
./drivers/pinctrl/pinctrl-st.c:1199:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org (open list)
---
drivers/pinctrl/pinctrl-st.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index e66af93..195b442 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -1170,7 +1170,7 @@ static int st_pctl_dt_parse_groups(struct device_node *np,
struct property *pp;
struct st_pinconf *conf;
struct device_node *pins;
- int i = 0, npins = 0, nr_props;
+ int i = 0, npins = 0, nr_props, ret = 0;
pins = of_get_child_by_name(np, "st,pins");
if (!pins)
@@ -1185,7 +1185,8 @@ static int st_pctl_dt_parse_groups(struct device_node *np,
npins++;
} else {
pr_warn("Invalid st,pins in %pOFn node\n", np);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out_put_node;
}
}
@@ -1195,8 +1196,10 @@ static int st_pctl_dt_parse_groups(struct device_node *np,
grp->pin_conf = devm_kcalloc(info->dev,
npins, sizeof(*conf), GFP_KERNEL);
- if (!grp->pins || !grp->pin_conf)
- return -ENOMEM;
+ if (!grp->pins || !grp->pin_conf) {
+ ret = -ENOMEM;
+ goto out_put_node;
+ }
/* <bank offset mux direction rt_type rt_delay rt_clk> */
for_each_property_of_node(pins, pp) {
@@ -1229,9 +1232,11 @@ static int st_pctl_dt_parse_groups(struct device_node *np,
}
i++;
}
+
+out_put_node:
of_node_put(pins);
- return 0;
+ return ret;
}
static int st_pctl_parse_functions(struct device_node *np,
--
2.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/5] pinctrl: samsung: fix leaked of_node references
2019-04-12 6:02 [PATCH 0/5] fix leaked of_node references in drivers/pinctrl Wen Yang
` (2 preceding siblings ...)
2019-04-12 6:02 ` [PATCH 3/5] pinctrl: st: " Wen Yang
@ 2019-04-12 6:02 ` Wen Yang
2019-04-12 7:12 ` Krzysztof Kozlowski
2019-04-23 9:00 ` Linus Walleij
2019-04-12 6:02 ` [PATCH 5/5] pinctrl: zte: " Wen Yang
4 siblings, 2 replies; 15+ messages in thread
From: Wen Yang @ 2019-04-12 6:02 UTC (permalink / raw)
To: linux-kernel
Cc: wang.yi59, Wen Yang, Linus Walleij, Tomasz Figa,
Krzysztof Kozlowski, Sylwester Nawrocki, Kukjin Kim,
linux-samsung-soc, linux-gpio
The call to of_find_compatible_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/samsung/pinctrl-exynos-arm.c:76:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
./drivers/pinctrl/samsung/pinctrl-exynos-arm.c:82:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Tomasz Figa <tomasz.figa@gmail.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/pinctrl/samsung/pinctrl-exynos-arm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
index 44c6b75..85ddf49 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
@@ -71,6 +71,7 @@ s5pv210_retention_init(struct samsung_pinctrl_drv_data *drvdata,
}
clk_base = of_iomap(np, 0);
+ of_node_put(np);
if (!clk_base) {
pr_err("%s: failed to map clock registers\n", __func__);
return ERR_PTR(-EINVAL);
--
2.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 5/5] pinctrl: zte: fix leaked of_node references
2019-04-12 6:02 [PATCH 0/5] fix leaked of_node references in drivers/pinctrl Wen Yang
` (3 preceding siblings ...)
2019-04-12 6:02 ` [PATCH 4/5] pinctrl: samsung: " Wen Yang
@ 2019-04-12 6:02 ` Wen Yang
2019-04-16 5:56 ` Shawn Guo
2019-04-23 10:53 ` Linus Walleij
4 siblings, 2 replies; 15+ messages in thread
From: Wen Yang @ 2019-04-12 6:02 UTC (permalink / raw)
To: linux-kernel
Cc: wang.yi59, Wen Yang, Linus Walleij, Jun Nie, Shawn Guo, linux-gpio
The call to of_parse_phandle returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.
Detected by coccinelle with the following warnings:
./drivers/pinctrl/zte/pinctrl-zx.c:415:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
./drivers/pinctrl/zte/pinctrl-zx.c:422:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
./drivers/pinctrl/zte/pinctrl-zx.c:436:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
./drivers/pinctrl/zte/pinctrl-zx.c:444:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
./drivers/pinctrl/zte/pinctrl-zx.c:448:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Jun Nie <jun.nie@linaro.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/pinctrl/zte/pinctrl-zx.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pinctrl/zte/pinctrl-zx.c b/drivers/pinctrl/zte/pinctrl-zx.c
index caa44dd..3cb6930 100644
--- a/drivers/pinctrl/zte/pinctrl-zx.c
+++ b/drivers/pinctrl/zte/pinctrl-zx.c
@@ -411,6 +411,7 @@ int zx_pinctrl_init(struct platform_device *pdev,
}
zpctl->aux_base = of_iomap(np, 0);
+ of_node_put(np);
if (!zpctl->aux_base)
return -ENOMEM;
--
2.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 4/5] pinctrl: samsung: fix leaked of_node references
2019-04-12 6:02 ` [PATCH 4/5] pinctrl: samsung: " Wen Yang
@ 2019-04-12 7:12 ` Krzysztof Kozlowski
2019-04-23 9:00 ` Linus Walleij
1 sibling, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2019-04-12 7:12 UTC (permalink / raw)
To: Wen Yang
Cc: linux-kernel, wang.yi59, Linus Walleij, Tomasz Figa,
Krzysztof Kozlowski, Sylwester Nawrocki, Kukjin Kim,
linux-samsung-soc, linux-gpio
On Fri, 12 Apr 2019 at 08:01, Wen Yang <wen.yang99@zte.com.cn> wrote:
>
> The call to of_find_compatible_node returns a node pointer with refcount
> incremented thus it must be explicitly decremented after the last
> usage.
>
> Detected by coccinelle with the following warnings:
> ./drivers/pinctrl/samsung/pinctrl-exynos-arm.c:76:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
> ./drivers/pinctrl/samsung/pinctrl-exynos-arm.c:82:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/5] pinctrl: rockchip: fix leaked of_node references
2019-04-12 6:02 ` [PATCH 2/5] pinctrl: rockchip: " Wen Yang
@ 2019-04-12 8:08 ` Heiko Stübner
0 siblings, 0 replies; 15+ messages in thread
From: Heiko Stübner @ 2019-04-12 8:08 UTC (permalink / raw)
To: Wen Yang
Cc: linux-kernel, wang.yi59, Linus Walleij, linux-gpio,
linux-arm-kernel, linux-rockchip
Hi,
Am Freitag, 12. April 2019, 08:02:20 CEST schrieb Wen Yang:
> The call to of_parse_phandle returns a node pointer with refcount
> incremented thus it must be explicitly decremented after the last
> usage.
>
> Detected by coccinelle with the following warnings:
> ./drivers/pinctrl/pinctrl-rockchip.c:3221:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3196, but without a corresponding object release within this function.
> ./drivers/pinctrl/pinctrl-rockchip.c:3223:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3196, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Heiko Stuebner <heiko@sntech.de>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-rockchip@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/pinctrl/pinctrl-rockchip.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
> index 16bf21b..e22d387 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -3195,6 +3195,7 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
>
> node = of_parse_phandle(bank->of_node->parent,
> "rockchip,pmu", 0);
> + of_node_put(node);
> if (!node) {
> if (of_address_to_resource(bank->of_node, 1, &res)) {
> dev_err(info->dev, "cannot find IO resource for bank\n");
>
hmm, the conditional does still use the node pointer, so the of_node_put
should probably be below the whole if clause?
Heiko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/5] pinctrl: st: fix leaked of_node references
2019-04-12 6:02 ` [PATCH 3/5] pinctrl: st: " Wen Yang
@ 2019-04-12 8:57 ` Patrice CHOTARD
2019-04-23 9:02 ` Linus Walleij
1 sibling, 0 replies; 15+ messages in thread
From: Patrice CHOTARD @ 2019-04-12 8:57 UTC (permalink / raw)
To: Wen Yang, linux-kernel; +Cc: wang.yi59, Linus Walleij, linux-gpio
Hi Wen
On 4/12/19 8:02 AM, Wen Yang wrote:
> The call to of_get_child_by_name returns a node pointer with refcount
> incremented thus it must be explicitly decremented after the last
> usage.
>
> Detected by coccinelle with the following warnings:
> ./drivers/pinctrl/pinctrl-st.c:1188:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
> ./drivers/pinctrl/pinctrl-st.c:1188:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
> ./drivers/pinctrl/pinctrl-st.c:1199:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
> ./drivers/pinctrl/pinctrl-st.c:1199:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org (open list)
> ---
> drivers/pinctrl/pinctrl-st.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
> index e66af93..195b442 100644
> --- a/drivers/pinctrl/pinctrl-st.c
> +++ b/drivers/pinctrl/pinctrl-st.c
> @@ -1170,7 +1170,7 @@ static int st_pctl_dt_parse_groups(struct device_node *np,
> struct property *pp;
> struct st_pinconf *conf;
> struct device_node *pins;
> - int i = 0, npins = 0, nr_props;
> + int i = 0, npins = 0, nr_props, ret = 0;
>
> pins = of_get_child_by_name(np, "st,pins");
> if (!pins)
> @@ -1185,7 +1185,8 @@ static int st_pctl_dt_parse_groups(struct device_node *np,
> npins++;
> } else {
> pr_warn("Invalid st,pins in %pOFn node\n", np);
> - return -EINVAL;
> + ret = -EINVAL;
> + goto out_put_node;
> }
> }
>
> @@ -1195,8 +1196,10 @@ static int st_pctl_dt_parse_groups(struct device_node *np,
> grp->pin_conf = devm_kcalloc(info->dev,
> npins, sizeof(*conf), GFP_KERNEL);
>
> - if (!grp->pins || !grp->pin_conf)
> - return -ENOMEM;
> + if (!grp->pins || !grp->pin_conf) {
> + ret = -ENOMEM;
> + goto out_put_node;
> + }
>
> /* <bank offset mux direction rt_type rt_delay rt_clk> */
> for_each_property_of_node(pins, pp) {
> @@ -1229,9 +1232,11 @@ static int st_pctl_dt_parse_groups(struct device_node *np,
> }
> i++;
> }
> +
> +out_put_node:
> of_node_put(pins);
>
> - return 0;
> + return ret;
> }
>
> static int st_pctl_parse_functions(struct device_node *np,
>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Thanks
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/5] pinctrl: pistachio: fix leaked of_node references
2019-04-12 6:02 ` [PATCH 1/5] pinctrl: pistachio: fix leaked of_node references Wen Yang
@ 2019-04-14 13:15 ` Markus Elfring
2019-04-23 10:34 ` Linus Walleij
1 sibling, 0 replies; 15+ messages in thread
From: Markus Elfring @ 2019-04-14 13:15 UTC (permalink / raw)
To: Wen Yang, Linus Walleij, linux-gpio; +Cc: linux-kernel, Yi Wang
> @@ -1367,6 +1367,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
> if (!of_find_property(child, "gpio-controller", NULL)) {
> dev_err(pctl->dev,
> "No gpio-controller property for bank %u\n", i);
> + of_node_put(child);
> ret = -ENODEV;
> goto err;
> }
> @@ -1374,6 +1375,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
> irq = irq_of_parse_and_map(child, 0);
> if (irq < 0) {
> dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq);
> + of_node_put(child);
> ret = irq;
> goto err;
> }
Would you like to move such duplicate statements (and other function calls)
to additional jump targets for the desired exception handling?
Regards,
Markus
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 5/5] pinctrl: zte: fix leaked of_node references
2019-04-12 6:02 ` [PATCH 5/5] pinctrl: zte: " Wen Yang
@ 2019-04-16 5:56 ` Shawn Guo
2019-04-23 10:53 ` Linus Walleij
1 sibling, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2019-04-16 5:56 UTC (permalink / raw)
To: Wen Yang; +Cc: linux-kernel, wang.yi59, Linus Walleij, Jun Nie, linux-gpio
On Fri, Apr 12, 2019 at 02:02:23PM +0800, Wen Yang wrote:
> The call to of_parse_phandle returns a node pointer with refcount
> incremented thus it must be explicitly decremented after the last
> usage.
>
> Detected by coccinelle with the following warnings:
> ./drivers/pinctrl/zte/pinctrl-zx.c:415:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
> ./drivers/pinctrl/zte/pinctrl-zx.c:422:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
> ./drivers/pinctrl/zte/pinctrl-zx.c:436:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
> ./drivers/pinctrl/zte/pinctrl-zx.c:444:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
> ./drivers/pinctrl/zte/pinctrl-zx.c:448:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Jun Nie <jun.nie@linaro.org>
> Cc: Shawn Guo <shawnguo@kernel.org>
Acked-by: Shawn Guo <shawnguo@kernel.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 4/5] pinctrl: samsung: fix leaked of_node references
2019-04-12 6:02 ` [PATCH 4/5] pinctrl: samsung: " Wen Yang
2019-04-12 7:12 ` Krzysztof Kozlowski
@ 2019-04-23 9:00 ` Linus Walleij
1 sibling, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2019-04-23 9:00 UTC (permalink / raw)
To: Wen Yang
Cc: linux-kernel, wang.yi59, Tomasz Figa, Krzysztof Kozlowski,
Sylwester Nawrocki, Kukjin Kim, linux-samsung-soc,
open list:GPIO SUBSYSTEM
On Fri, Apr 12, 2019 at 8:01 AM Wen Yang <wen.yang99@zte.com.cn> wrote:
> The call to of_find_compatible_node returns a node pointer with refcount
> incremented thus it must be explicitly decremented after the last
> usage.
>
> Detected by coccinelle with the following warnings:
> ./drivers/pinctrl/samsung/pinctrl-exynos-arm.c:76:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
> ./drivers/pinctrl/samsung/pinctrl-exynos-arm.c:82:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 66, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Tomasz Figa <tomasz.figa@gmail.com>
> Cc: Krzysztof Kozlowski <krzk@kernel.org>
> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: linux-samsung-soc@vger.kernel.org
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
Patch applied with Krzysztof's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/5] pinctrl: st: fix leaked of_node references
2019-04-12 6:02 ` [PATCH 3/5] pinctrl: st: " Wen Yang
2019-04-12 8:57 ` Patrice CHOTARD
@ 2019-04-23 9:02 ` Linus Walleij
1 sibling, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2019-04-23 9:02 UTC (permalink / raw)
To: Wen Yang
Cc: linux-kernel, wang.yi59, Patrice Chotard, open list:GPIO SUBSYSTEM
On Fri, Apr 12, 2019 at 8:01 AM Wen Yang <wen.yang99@zte.com.cn> wrote:
> The call to of_get_child_by_name returns a node pointer with refcount
> incremented thus it must be explicitly decremented after the last
> usage.
>
> Detected by coccinelle with the following warnings:
> ./drivers/pinctrl/pinctrl-st.c:1188:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
> ./drivers/pinctrl/pinctrl-st.c:1188:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
> ./drivers/pinctrl/pinctrl-st.c:1199:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
> ./drivers/pinctrl/pinctrl-st.c:1199:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1175, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org (open list)
Patch applied with Patrice's review tag.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/5] pinctrl: pistachio: fix leaked of_node references
2019-04-12 6:02 ` [PATCH 1/5] pinctrl: pistachio: fix leaked of_node references Wen Yang
2019-04-14 13:15 ` Markus Elfring
@ 2019-04-23 10:34 ` Linus Walleij
1 sibling, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2019-04-23 10:34 UTC (permalink / raw)
To: Wen Yang; +Cc: linux-kernel, wang.yi59, open list:GPIO SUBSYSTEM
On Fri, Apr 12, 2019 at 8:01 AM Wen Yang <wen.yang99@zte.com.cn> wrote:
> The call to of_get_child_by_name returns a node pointer with refcount
> incremented thus it must be explicitly decremented after the last
> usage.
>
> Detected by coccinelle with the following warnings:
> ./drivers/pinctrl/pinctrl-pistachio.c:1422:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 1360, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 5/5] pinctrl: zte: fix leaked of_node references
2019-04-12 6:02 ` [PATCH 5/5] pinctrl: zte: " Wen Yang
2019-04-16 5:56 ` Shawn Guo
@ 2019-04-23 10:53 ` Linus Walleij
1 sibling, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2019-04-23 10:53 UTC (permalink / raw)
To: Wen Yang
Cc: linux-kernel, wang.yi59, Jun Nie, Shawn Guo, open list:GPIO SUBSYSTEM
On Fri, Apr 12, 2019 at 8:01 AM Wen Yang <wen.yang99@zte.com.cn> wrote:
> The call to of_parse_phandle returns a node pointer with refcount
> incremented thus it must be explicitly decremented after the last
> usage.
>
> Detected by coccinelle with the following warnings:
> ./drivers/pinctrl/zte/pinctrl-zx.c:415:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
> ./drivers/pinctrl/zte/pinctrl-zx.c:422:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
> ./drivers/pinctrl/zte/pinctrl-zx.c:436:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
> ./drivers/pinctrl/zte/pinctrl-zx.c:444:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
> ./drivers/pinctrl/zte/pinctrl-zx.c:448:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 407, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Jun Nie <jun.nie@linaro.org>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
Patch applied with Shawn's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2019-04-23 10:53 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12 6:02 [PATCH 0/5] fix leaked of_node references in drivers/pinctrl Wen Yang
2019-04-12 6:02 ` [PATCH 1/5] pinctrl: pistachio: fix leaked of_node references Wen Yang
2019-04-14 13:15 ` Markus Elfring
2019-04-23 10:34 ` Linus Walleij
2019-04-12 6:02 ` [PATCH 2/5] pinctrl: rockchip: " Wen Yang
2019-04-12 8:08 ` Heiko Stübner
2019-04-12 6:02 ` [PATCH 3/5] pinctrl: st: " Wen Yang
2019-04-12 8:57 ` Patrice CHOTARD
2019-04-23 9:02 ` Linus Walleij
2019-04-12 6:02 ` [PATCH 4/5] pinctrl: samsung: " Wen Yang
2019-04-12 7:12 ` Krzysztof Kozlowski
2019-04-23 9:00 ` Linus Walleij
2019-04-12 6:02 ` [PATCH 5/5] pinctrl: zte: " Wen Yang
2019-04-16 5:56 ` Shawn Guo
2019-04-23 10:53 ` Linus Walleij
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).