* [PATCH 01/11] arm-cci: add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
@ 2023-09-07 9:55 ` Julia Lawall
2023-09-07 9:55 ` [PATCH 02/11] net: bcmasp: " Julia Lawall
` (12 subsequent siblings)
13 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2023-09-07 9:55 UTC (permalink / raw)
To: linux-kernel; +Cc: kernel-janitors
for_each_available_child_of_node performs an of_node_get
on each iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
drivers/bus/arm-cci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff -u -p a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -461,8 +461,10 @@ static int cci_probe_ports(struct device
i = nb_ace + nb_ace_lite;
- if (i >= nb_cci_ports)
+ if (i >= nb_cci_ports) {
+ of_node_put(cp);
break;
+ }
if (of_property_read_string(cp, "interface-type",
&match_str)) {
^ permalink raw reply [flat|nested] 23+ messages in thread* [PATCH 02/11] net: bcmasp: add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
2023-09-07 9:55 ` [PATCH 01/11] arm-cci: " Julia Lawall
@ 2023-09-07 9:55 ` Julia Lawall
2023-09-10 13:49 ` Simon Horman
2023-09-07 9:55 ` [PATCH 03/11] powerpc/powermac: " Julia Lawall
` (11 subsequent siblings)
13 siblings, 1 reply; 23+ messages in thread
From: Julia Lawall @ 2023-09-07 9:55 UTC (permalink / raw)
To: Justin Chen
Cc: kernel-janitors, Florian Fainelli, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, bcm-kernel-feedback-list, netdev,
linux-kernel
for_each_available_child_of_node performs an of_node_get
on each iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
drivers/net/ethernet/broadcom/asp2/bcmasp.c | 1 +
1 file changed, 1 insertion(+)
diff -u -p a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
@@ -1300,6 +1300,7 @@ static int bcmasp_probe(struct platform_
if (!intf) {
dev_err(dev, "Cannot create eth interface %d\n", i);
bcmasp_remove_intfs(priv);
+ of_node_put(intf_node);
goto of_put_exit;
}
list_add_tail(&intf->list, &priv->intfs);
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 02/11] net: bcmasp: add missing of_node_put
2023-09-07 9:55 ` [PATCH 02/11] net: bcmasp: " Julia Lawall
@ 2023-09-10 13:49 ` Simon Horman
0 siblings, 0 replies; 23+ messages in thread
From: Simon Horman @ 2023-09-10 13:49 UTC (permalink / raw)
To: Julia Lawall
Cc: Justin Chen, kernel-janitors, Florian Fainelli, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
bcm-kernel-feedback-list, netdev, linux-kernel
On Thu, Sep 07, 2023 at 11:55:12AM +0200, Julia Lawall wrote:
> for_each_available_child_of_node performs an of_node_get
> on each iteration, so a break out of the loop requires an
> of_node_put.
>
> This was done using the Coccinelle semantic patch
> iterators/for_each_child.cocci
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 03/11] powerpc/powermac: add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
2023-09-07 9:55 ` [PATCH 01/11] arm-cci: " Julia Lawall
2023-09-07 9:55 ` [PATCH 02/11] net: bcmasp: " Julia Lawall
@ 2023-09-07 9:55 ` Julia Lawall
2023-09-07 9:55 ` [PATCH 04/11] genpd: ti: " Julia Lawall
` (10 subsequent siblings)
13 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2023-09-07 9:55 UTC (permalink / raw)
To: Michael Ellerman
Cc: kernel-janitors, Nicholas Piggin, Christophe Leroy, linuxppc-dev,
linux-kernel
for_each_node_by_name performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
arch/powerpc/platforms/powermac/low_i2c.c | 4 +++-
arch/powerpc/platforms/powermac/smp.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff -u -p a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -598,8 +598,10 @@ static void __init smp_core99_setup_i2c_
name = "Pulsar";
break;
}
- if (pmac_tb_freeze != NULL)
+ if (pmac_tb_freeze != NULL) {
+ of_node_put(cc);
break;
+ }
}
if (pmac_tb_freeze != NULL) {
/* Open i2c bus for synchronous access */
diff -u -p a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -925,8 +925,10 @@ static void __init smu_i2c_probe(void)
sz = sizeof(struct pmac_i2c_bus) + sizeof(struct smu_i2c_cmd);
bus = kzalloc(sz, GFP_KERNEL);
- if (bus == NULL)
+ if (bus == NULL) {
+ of_node_put(busnode);
return;
+ }
bus->controller = controller;
bus->busnode = of_node_get(busnode);
^ permalink raw reply [flat|nested] 23+ messages in thread* [PATCH 04/11] genpd: ti: add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
` (2 preceding siblings ...)
2023-09-07 9:55 ` [PATCH 03/11] powerpc/powermac: " Julia Lawall
@ 2023-09-07 9:55 ` Julia Lawall
2023-10-04 22:24 ` Ulf Hansson
2023-09-07 9:55 ` [PATCH 05/11] mmc: atmel-mci: " Julia Lawall
` (9 subsequent siblings)
13 siblings, 1 reply; 23+ messages in thread
From: Julia Lawall @ 2023-09-07 9:55 UTC (permalink / raw)
To: Nishanth Menon
Cc: kernel-janitors, Tero Kristo, Santosh Shilimkar, Ulf Hansson,
linux-arm-kernel, linux-pm, linux-kernel
for_each_node_with_property performs an of_node_get on
each iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
drivers/genpd/ti/ti_sci_pm_domains.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff -u -p a/drivers/genpd/ti/ti_sci_pm_domains.c b/drivers/genpd/ti/ti_sci_pm_domains.c
--- a/drivers/genpd/ti/ti_sci_pm_domains.c
+++ b/drivers/genpd/ti/ti_sci_pm_domains.c
@@ -153,14 +153,18 @@ static int ti_sci_pm_domain_probe(struct
max_id = args.args[0];
pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
- if (!pd)
+ if (!pd) {
+ of_node_put(np);
return -ENOMEM;
+ }
pd->pd.name = devm_kasprintf(dev, GFP_KERNEL,
"pd:%d",
args.args[0]);
- if (!pd->pd.name)
+ if (!pd->pd.name) {
+ of_node_put(np);
return -ENOMEM;
+ }
pd->pd.power_off = ti_sci_pd_power_off;
pd->pd.power_on = ti_sci_pd_power_on;
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 04/11] genpd: ti: add missing of_node_put
2023-09-07 9:55 ` [PATCH 04/11] genpd: ti: " Julia Lawall
@ 2023-10-04 22:24 ` Ulf Hansson
0 siblings, 0 replies; 23+ messages in thread
From: Ulf Hansson @ 2023-10-04 22:24 UTC (permalink / raw)
To: Julia Lawall
Cc: Nishanth Menon, kernel-janitors, Tero Kristo, Santosh Shilimkar,
linux-arm-kernel, linux-pm, linux-kernel
On Thu, 7 Sept 2023 at 11:55, Julia Lawall <Julia.Lawall@inria.fr> wrote:
>
> for_each_node_with_property performs an of_node_get on
> each iteration, so a break out of the loop requires an
> of_node_put.
>
> This was done using the Coccinelle semantic patch
> iterators/for_each_child.cocci
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Applied for next (by amending the change to pmdomain instead of genpd), thanks!
Kind regards
Uffe
>
> ---
> drivers/genpd/ti/ti_sci_pm_domains.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff -u -p a/drivers/genpd/ti/ti_sci_pm_domains.c b/drivers/genpd/ti/ti_sci_pm_domains.c
> --- a/drivers/genpd/ti/ti_sci_pm_domains.c
> +++ b/drivers/genpd/ti/ti_sci_pm_domains.c
> @@ -153,14 +153,18 @@ static int ti_sci_pm_domain_probe(struct
> max_id = args.args[0];
>
> pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
> - if (!pd)
> + if (!pd) {
> + of_node_put(np);
> return -ENOMEM;
> + }
>
> pd->pd.name = devm_kasprintf(dev, GFP_KERNEL,
> "pd:%d",
> args.args[0]);
> - if (!pd->pd.name)
> + if (!pd->pd.name) {
> + of_node_put(np);
> return -ENOMEM;
> + }
>
> pd->pd.power_off = ti_sci_pd_power_off;
> pd->pd.power_on = ti_sci_pd_power_on;
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 05/11] mmc: atmel-mci: add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
` (3 preceding siblings ...)
2023-09-07 9:55 ` [PATCH 04/11] genpd: ti: " Julia Lawall
@ 2023-09-07 9:55 ` Julia Lawall
2023-09-14 14:47 ` Ulf Hansson
2023-09-07 9:55 ` [PATCH 06/11] powerpc/kexec_file: " Julia Lawall
` (8 subsequent siblings)
13 siblings, 1 reply; 23+ messages in thread
From: Julia Lawall @ 2023-09-07 9:55 UTC (permalink / raw)
To: Ludovic Desroches
Cc: kernel-janitors, Ulf Hansson, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea, linux-mmc, linux-arm-kernel, linux-kernel
for_each_child_of_node performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
drivers/mmc/host/atmel-mci.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff -u -p a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -674,8 +674,10 @@ atmci_of_init(struct platform_device *pd
"cd", GPIOD_IN, "cd-gpios");
err = PTR_ERR_OR_ZERO(pdata->slot[slot_id].detect_pin);
if (err) {
- if (err != -ENOENT)
+ if (err != -ENOENT) {
+ of_node_put(cnp);
return ERR_PTR(err);
+ }
pdata->slot[slot_id].detect_pin = NULL;
}
@@ -687,8 +689,10 @@ atmci_of_init(struct platform_device *pd
"wp", GPIOD_IN, "wp-gpios");
err = PTR_ERR_OR_ZERO(pdata->slot[slot_id].wp_pin);
if (err) {
- if (err != -ENOENT)
+ if (err != -ENOENT) {
+ of_node_put(cnp);
return ERR_PTR(err);
+ }
pdata->slot[slot_id].wp_pin = NULL;
}
}
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 05/11] mmc: atmel-mci: add missing of_node_put
2023-09-07 9:55 ` [PATCH 05/11] mmc: atmel-mci: " Julia Lawall
@ 2023-09-14 14:47 ` Ulf Hansson
0 siblings, 0 replies; 23+ messages in thread
From: Ulf Hansson @ 2023-09-14 14:47 UTC (permalink / raw)
To: Julia Lawall
Cc: Ludovic Desroches, kernel-janitors, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea, linux-mmc, linux-arm-kernel,
linux-kernel
On Thu, 7 Sept 2023 at 11:55, Julia Lawall <Julia.Lawall@inria.fr> wrote:
>
> for_each_child_of_node performs an of_node_get on each
> iteration, so a break out of the loop requires an
> of_node_put.
>
> This was done using the Coccinelle semantic patch
> iterators/for_each_child.cocci
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Applied for next, thanks!
Kind regards
Uffe
>
> ---
> drivers/mmc/host/atmel-mci.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff -u -p a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -674,8 +674,10 @@ atmci_of_init(struct platform_device *pd
> "cd", GPIOD_IN, "cd-gpios");
> err = PTR_ERR_OR_ZERO(pdata->slot[slot_id].detect_pin);
> if (err) {
> - if (err != -ENOENT)
> + if (err != -ENOENT) {
> + of_node_put(cnp);
> return ERR_PTR(err);
> + }
> pdata->slot[slot_id].detect_pin = NULL;
> }
>
> @@ -687,8 +689,10 @@ atmci_of_init(struct platform_device *pd
> "wp", GPIOD_IN, "wp-gpios");
> err = PTR_ERR_OR_ZERO(pdata->slot[slot_id].wp_pin);
> if (err) {
> - if (err != -ENOENT)
> + if (err != -ENOENT) {
> + of_node_put(cnp);
> return ERR_PTR(err);
> + }
> pdata->slot[slot_id].wp_pin = NULL;
> }
> }
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 06/11] powerpc/kexec_file: add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
` (4 preceding siblings ...)
2023-09-07 9:55 ` [PATCH 05/11] mmc: atmel-mci: " Julia Lawall
@ 2023-09-07 9:55 ` Julia Lawall
2023-09-07 9:55 ` [PATCH 07/11] soc: dove: " Julia Lawall
` (7 subsequent siblings)
13 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2023-09-07 9:55 UTC (permalink / raw)
To: Michael Ellerman
Cc: kernel-janitors, Nicholas Piggin, Christophe Leroy, linuxppc-dev,
linux-kernel
for_each_node_with_property performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
arch/powerpc/kexec/file_load_64.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff -u -p a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -1138,11 +1138,15 @@ static int update_pci_dma_nodes(void *fd
continue;
ret = copy_property(fdt, pci_offset, dn, "ibm,dma-window");
- if (ret < 0)
+ if (ret < 0) {
+ of_node_put(dn);
break;
+ }
ret = copy_property(fdt, pci_offset, dn, dmapropname);
- if (ret < 0)
+ if (ret < 0) {
+ of_node_put(dn);
break;
+ }
}
return ret;
^ permalink raw reply [flat|nested] 23+ messages in thread* [PATCH 07/11] soc: dove: add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
` (5 preceding siblings ...)
2023-09-07 9:55 ` [PATCH 06/11] powerpc/kexec_file: " Julia Lawall
@ 2023-09-07 9:55 ` Julia Lawall
2023-09-20 9:30 ` Gregory CLEMENT
2023-09-07 9:55 ` [PATCH 08/11] thermal/of: " Julia Lawall
` (6 subsequent siblings)
13 siblings, 1 reply; 23+ messages in thread
From: Julia Lawall @ 2023-09-07 9:55 UTC (permalink / raw)
To: Andrew Lunn
Cc: kernel-janitors, Sebastian Hesselbarth, Gregory Clement,
linux-arm-kernel, linux-kernel
for_each_available_child_of_node performs an of_node_get
on each iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
drivers/soc/dove/pmu.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff -u -p a/drivers/soc/dove/pmu.c b/drivers/soc/dove/pmu.c
--- a/drivers/soc/dove/pmu.c
+++ b/drivers/soc/dove/pmu.c
@@ -410,13 +410,16 @@ int __init dove_init_pmu(void)
struct pmu_domain *domain;
domain = kzalloc(sizeof(*domain), GFP_KERNEL);
- if (!domain)
+ if (!domain) {
+ of_node_put(np);
break;
+ }
domain->pmu = pmu;
domain->base.name = kasprintf(GFP_KERNEL, "%pOFn", np);
if (!domain->base.name) {
kfree(domain);
+ of_node_put(np);
break;
}
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 07/11] soc: dove: add missing of_node_put
2023-09-07 9:55 ` [PATCH 07/11] soc: dove: " Julia Lawall
@ 2023-09-20 9:30 ` Gregory CLEMENT
0 siblings, 0 replies; 23+ messages in thread
From: Gregory CLEMENT @ 2023-09-20 9:30 UTC (permalink / raw)
To: Julia Lawall, Andrew Lunn
Cc: kernel-janitors, Sebastian Hesselbarth, linux-arm-kernel,
linux-kernel
Julia Lawall <Julia.Lawall@inria.fr> writes:
> for_each_available_child_of_node performs an of_node_get
> on each iteration, so a break out of the loop requires an
> of_node_put.
>
> This was done using the Coccinelle semantic patch
> iterators/for_each_child.cocci
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Applied on mvebu/arm
Thanks,
Gregory
>
> ---
> drivers/soc/dove/pmu.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff -u -p a/drivers/soc/dove/pmu.c b/drivers/soc/dove/pmu.c
> --- a/drivers/soc/dove/pmu.c
> +++ b/drivers/soc/dove/pmu.c
> @@ -410,13 +410,16 @@ int __init dove_init_pmu(void)
> struct pmu_domain *domain;
>
> domain = kzalloc(sizeof(*domain), GFP_KERNEL);
> - if (!domain)
> + if (!domain) {
> + of_node_put(np);
> break;
> + }
>
> domain->pmu = pmu;
> domain->base.name = kasprintf(GFP_KERNEL, "%pOFn", np);
> if (!domain->base.name) {
> kfree(domain);
> + of_node_put(np);
> break;
> }
>
>
--
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 08/11] thermal/of: add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
` (6 preceding siblings ...)
2023-09-07 9:55 ` [PATCH 07/11] soc: dove: " Julia Lawall
@ 2023-09-07 9:55 ` Julia Lawall
2023-09-11 15:12 ` Rafael J. Wysocki
2023-09-07 9:55 ` [PATCH 09/11] drm/mediatek: " Julia Lawall
` (5 subsequent siblings)
13 siblings, 1 reply; 23+ messages in thread
From: Julia Lawall @ 2023-09-07 9:55 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: kernel-janitors, Daniel Lezcano, Amit Kucheria, Zhang Rui,
linux-pm, linux-kernel
for_each_child_of_node performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
drivers/thermal/thermal_of.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff -u -p a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -37,8 +37,10 @@ static int of_find_trip_id(struct device
*/
for_each_child_of_node(trips, t) {
- if (t == trip)
+ if (t == trip) {
+ of_node_put(t);
goto out;
+ }
i++;
}
@@ -401,8 +403,10 @@ static int thermal_of_for_each_cooling_m
for_each_child_of_node(cm_np, child) {
ret = thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, action);
- if (ret)
+ if (ret) {
+ of_node_put(child);
break;
+ }
}
of_node_put(cm_np);
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 08/11] thermal/of: add missing of_node_put
2023-09-07 9:55 ` [PATCH 08/11] thermal/of: " Julia Lawall
@ 2023-09-11 15:12 ` Rafael J. Wysocki
0 siblings, 0 replies; 23+ messages in thread
From: Rafael J. Wysocki @ 2023-09-11 15:12 UTC (permalink / raw)
To: Julia Lawall
Cc: Rafael J. Wysocki, kernel-janitors, Daniel Lezcano, Amit Kucheria,
Zhang Rui, linux-pm, linux-kernel
On Thu, Sep 7, 2023 at 11:56 AM Julia Lawall <Julia.Lawall@inria.fr> wrote:
>
> for_each_child_of_node performs an of_node_get on each
> iteration, so a break out of the loop requires an
> of_node_put.
>
> This was done using the Coccinelle semantic patch
> iterators/for_each_child.cocci
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> drivers/thermal/thermal_of.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff -u -p a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -37,8 +37,10 @@ static int of_find_trip_id(struct device
> */
> for_each_child_of_node(trips, t) {
>
> - if (t == trip)
> + if (t == trip) {
> + of_node_put(t);
> goto out;
> + }
> i++;
> }
>
> @@ -401,8 +403,10 @@ static int thermal_of_for_each_cooling_m
>
> for_each_child_of_node(cm_np, child) {
> ret = thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, action);
> - if (ret)
> + if (ret) {
> + of_node_put(child);
> break;
> + }
> }
>
> of_node_put(cm_np);
>
Applied as 6.6-rc material, thanks!
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 09/11] drm/mediatek: add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
` (7 preceding siblings ...)
2023-09-07 9:55 ` [PATCH 08/11] thermal/of: " Julia Lawall
@ 2023-09-07 9:55 ` Julia Lawall
2023-09-07 9:55 ` [PATCH 10/11] ASoC: rsnd: " Julia Lawall
` (4 subsequent siblings)
13 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2023-09-07 9:55 UTC (permalink / raw)
To: Chun-Kuang Hu
Cc: kernel-janitors, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, dri-devel,
linux-mediatek, linux-kernel, linux-arm-kernel
for_each_child_of_node performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 4 +++-
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff -u -p a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -377,8 +377,10 @@ static bool mtk_drm_get_all_drm_priv(str
if (all_drm_priv[cnt] && all_drm_priv[cnt]->mtk_drm_bound)
cnt++;
- if (cnt == MAX_CRTC)
+ if (cnt == MAX_CRTC) {
+ of_node_put(node);
break;
+ }
}
if (drm_priv->data->mmsys_dev_num == cnt) {
diff -u -p a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
@@ -436,8 +436,10 @@ static int ovl_adaptor_comp_init(struct
}
comp_pdev = of_find_device_by_node(node);
- if (!comp_pdev)
+ if (!comp_pdev) {
+ of_node_put(node);
return -EPROBE_DEFER;
+ }
priv->ovl_adaptor_comp[id] = &comp_pdev->dev;
^ permalink raw reply [flat|nested] 23+ messages in thread* [PATCH 10/11] ASoC: rsnd: add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
` (8 preceding siblings ...)
2023-09-07 9:55 ` [PATCH 09/11] drm/mediatek: " Julia Lawall
@ 2023-09-07 9:55 ` Julia Lawall
2023-09-08 6:05 ` Kuninori Morimoto
2023-09-07 9:55 ` [PATCH 11/11] media: platform: mtk-mdp3: " Julia Lawall
` (3 subsequent siblings)
13 siblings, 1 reply; 23+ messages in thread
From: Julia Lawall @ 2023-09-07 9:55 UTC (permalink / raw)
To: Liam Girdwood
Cc: kernel-janitors, Mark Brown, Jaroslav Kysela, Takashi Iwai,
alsa-devel, linux-kernel
for_each_child_of_node performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
sound/soc/sh/rcar/core.c | 1 +
1 file changed, 1 insertion(+)
diff -u -p a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -1303,6 +1303,7 @@ audio_graph:
if (i >= RSND_MAX_COMPONENT) {
dev_info(dev, "reach to max component\n");
of_node_put(node);
+ of_node_put(ports);
break;
}
}
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 10/11] ASoC: rsnd: add missing of_node_put
2023-09-07 9:55 ` [PATCH 10/11] ASoC: rsnd: " Julia Lawall
@ 2023-09-08 6:05 ` Kuninori Morimoto
2023-09-08 8:25 ` Julia Lawall
0 siblings, 1 reply; 23+ messages in thread
From: Kuninori Morimoto @ 2023-09-08 6:05 UTC (permalink / raw)
To: Julia Lawall
Cc: Liam Girdwood, kernel-janitors, Mark Brown, Jaroslav Kysela,
Takashi Iwai, alsa-devel, linux-kernel
Hi Julia
Thank you for the patch
> for_each_child_of_node performs an of_node_get on each
> iteration, so a break out of the loop requires an
> of_node_put.
>
> This was done using the Coccinelle semantic patch
> iterators/for_each_child.cocci
>
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
>
> ---
> sound/soc/sh/rcar/core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff -u -p a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
> --- a/sound/soc/sh/rcar/core.c
> +++ b/sound/soc/sh/rcar/core.c
> @@ -1303,6 +1303,7 @@ audio_graph:
> if (i >= RSND_MAX_COMPONENT) {
> dev_info(dev, "reach to max component\n");
> of_node_put(node);
> + of_node_put(ports);
> break;
> }
> }
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
I noticed that existing "of_node_put(node)" itself is not needed.
We can remove it, and I will post the patch next week.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 10/11] ASoC: rsnd: add missing of_node_put
2023-09-08 6:05 ` Kuninori Morimoto
@ 2023-09-08 8:25 ` Julia Lawall
2023-09-10 22:43 ` Kuninori Morimoto
0 siblings, 1 reply; 23+ messages in thread
From: Julia Lawall @ 2023-09-08 8:25 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: Liam Girdwood, kernel-janitors, Mark Brown, Jaroslav Kysela,
Takashi Iwai, alsa-devel, linux-kernel
On Fri, 8 Sep 2023, Kuninori Morimoto wrote:
>
> Hi Julia
>
> Thank you for the patch
>
> > for_each_child_of_node performs an of_node_get on each
> > iteration, so a break out of the loop requires an
> > of_node_put.
> >
> > This was done using the Coccinelle semantic patch
> > iterators/for_each_child.cocci
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> >
> > ---
> > sound/soc/sh/rcar/core.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff -u -p a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
> > --- a/sound/soc/sh/rcar/core.c
> > +++ b/sound/soc/sh/rcar/core.c
> > @@ -1303,6 +1303,7 @@ audio_graph:
> > if (i >= RSND_MAX_COMPONENT) {
> > dev_info(dev, "reach to max component\n");
> > of_node_put(node);
> > + of_node_put(ports);
> > break;
> > }
> > }
>
> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> I noticed that existing "of_node_put(node)" itself is not needed.
> We can remove it, and I will post the patch next week.
Oops, indeed the better way to make the change would have been to convert
node to ports. It's just a copy paste error with respect to the code
above the audio_graph label. Do you want me to send this change instead?
julia
>
>
> Thank you for your help !!
>
> Best regards
> ---
> Kuninori Morimoto
>
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 10/11] ASoC: rsnd: add missing of_node_put
2023-09-08 8:25 ` Julia Lawall
@ 2023-09-10 22:43 ` Kuninori Morimoto
0 siblings, 0 replies; 23+ messages in thread
From: Kuninori Morimoto @ 2023-09-10 22:43 UTC (permalink / raw)
To: Julia Lawall
Cc: Liam Girdwood, kernel-janitors, Mark Brown, Jaroslav Kysela,
Takashi Iwai, alsa-devel, linux-kernel
Hi Julia, Mark
Thank you for your feedback
> > I noticed that existing "of_node_put(node)" itself is not needed.
> > We can remove it, and I will post the patch next week.
>
> Oops, indeed the better way to make the change would have been to convert
> node to ports. It's just a copy paste error with respect to the code
> above the audio_graph label. Do you want me to send this change instead?
No problem
"add missing no_node_put()" and "remove unneeded no_node_put()" are
mutual independent, it can be separate patch, I think.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 11/11] media: platform: mtk-mdp3: add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
` (9 preceding siblings ...)
2023-09-07 9:55 ` [PATCH 10/11] ASoC: rsnd: " Julia Lawall
@ 2023-09-07 9:55 ` Julia Lawall
2023-09-10 18:00 ` [PATCH 00/11] " patchwork-bot+netdevbpf
` (2 subsequent siblings)
13 siblings, 0 replies; 23+ messages in thread
From: Julia Lawall @ 2023-09-07 9:55 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: kernel-janitors, Matthias Brugger, AngeloGioacchino Del Regno,
linux-media, linux-kernel, linux-arm-kernel, linux-mediatek
for_each_child_of_node performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
---
drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c | 1 +
1 file changed, 1 insertion(+)
diff -u -p a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
@@ -1137,6 +1137,7 @@ int mdp_comp_config(struct mdp_dev *mdp)
comp = mdp_comp_create(mdp, node, id);
if (IS_ERR(comp)) {
ret = PTR_ERR(comp);
+ of_node_put(node);
goto err_init_comps;
}
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 00/11] add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
` (10 preceding siblings ...)
2023-09-07 9:55 ` [PATCH 11/11] media: platform: mtk-mdp3: " Julia Lawall
@ 2023-09-10 18:00 ` patchwork-bot+netdevbpf
2023-09-11 15:08 ` (subset) " Mark Brown
2023-09-21 9:30 ` Michael Ellerman
13 siblings, 0 replies; 23+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-10 18:00 UTC (permalink / raw)
To: Julia Lawall
Cc: alsa-devel, kernel-janitors, rui.zhang, amitk, linux-pm,
linux-arm-kernel, netdev, bcm-kernel-feedback-list, linux-kernel,
npiggin, christophe.leroy, linuxppc-dev, linux-mmc, dri-devel,
linux-mediatek, angelogioacchino.delregno, linux-media
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Thu, 7 Sep 2023 11:55:10 +0200 you wrote:
> Add of_node_put on a break out of an of_node loop.
>
> ---
>
> arch/powerpc/kexec/file_load_64.c | 8 ++++++--
> arch/powerpc/platforms/powermac/low_i2c.c | 4 +++-
> arch/powerpc/platforms/powermac/smp.c | 4 +++-
> drivers/bus/arm-cci.c | 4 +++-
> drivers/genpd/ti/ti_sci_pm_domains.c | 8 ++++++--
> drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 4 +++-
> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 +++-
> drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c | 1 +
> drivers/mmc/host/atmel-mci.c | 8 ++++++--
> drivers/net/ethernet/broadcom/asp2/bcmasp.c | 1 +
> drivers/soc/dove/pmu.c | 5 ++++-
> drivers/thermal/thermal_of.c | 8 ++++++--
> sound/soc/sh/rcar/core.c | 1 +
> 13 files changed, 46 insertions(+), 14 deletions(-)
Here is the summary with links:
- [02/11] net: bcmasp: add missing of_node_put
https://git.kernel.org/netdev/net/c/e73d1ab6cd7e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: (subset) [PATCH 00/11] add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
` (11 preceding siblings ...)
2023-09-10 18:00 ` [PATCH 00/11] " patchwork-bot+netdevbpf
@ 2023-09-11 15:08 ` Mark Brown
2023-09-21 9:30 ` Michael Ellerman
13 siblings, 0 replies; 23+ messages in thread
From: Mark Brown @ 2023-09-11 15:08 UTC (permalink / raw)
To: alsa-devel, Julia Lawall
Cc: kernel-janitors, Zhang Rui, Amit Kucheria, linux-pm,
linux-arm-kernel, netdev, bcm-kernel-feedback-list, linux-kernel,
Nicholas Piggin, Christophe Leroy, linuxppc-dev, linux-mmc,
dri-devel, linux-mediatek, AngeloGioacchino Del Regno,
linux-media
On Thu, 07 Sep 2023 11:55:10 +0200, Julia Lawall wrote:
> Add of_node_put on a break out of an of_node loop.
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[10/11] ASoC: rsnd: add missing of_node_put
commit: 28115b1c4f2bb76e786436bf6597c5eb27638a5c
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 00/11] add missing of_node_put
2023-09-07 9:55 [PATCH 00/11] add missing of_node_put Julia Lawall
` (12 preceding siblings ...)
2023-09-11 15:08 ` (subset) " Mark Brown
@ 2023-09-21 9:30 ` Michael Ellerman
13 siblings, 0 replies; 23+ messages in thread
From: Michael Ellerman @ 2023-09-21 9:30 UTC (permalink / raw)
To: alsa-devel, Julia Lawall
Cc: kernel-janitors, Zhang Rui, Amit Kucheria, linux-pm,
linux-arm-kernel, netdev, bcm-kernel-feedback-list, linux-kernel,
Nicholas Piggin, Christophe Leroy, linuxppc-dev, linux-mmc,
dri-devel, linux-mediatek, AngeloGioacchino Del Regno,
linux-media
On Thu, 07 Sep 2023 11:55:10 +0200, Julia Lawall wrote:
> Add of_node_put on a break out of an of_node loop.
>
Patches 3 and 6 applied to powerpc/next.
[03/11] powerpc/powermac: add missing of_node_put
https://git.kernel.org/powerpc/c/a59e9eb25216eb1dc99e14fc31b76aa648d79540
[06/11] powerpc/kexec_file: add missing of_node_put
https://git.kernel.org/powerpc/c/06b627c1236216ac1239c5e1afcc75359af3fb72
cheers
^ permalink raw reply [flat|nested] 23+ messages in thread