* [PATCH 0/5] add missing of_node_put @ 2015-10-10 12:30 Julia Lawall 2015-10-10 12:30 ` [PATCH 1/5] backlight: 88pm860x_bl: " Julia Lawall 0 siblings, 1 reply; 3+ messages in thread From: Julia Lawall @ 2015-10-10 12:30 UTC (permalink / raw) To: 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. The complete semantic patch that fixes this problem is (http://coccinelle.lip6.fr): // <smpl> @@ expression root,e; local idexpression child; iterator name for_each_child_of_node; @@ for_each_child_of_node(root, child) { ... when != of_node_put(child) when != e = child + of_node_put(child); ? break; ... } ... when != child @@ expression root,e; local idexpression child; @@ for_each_child_of_node(root, child) { ... when != of_node_put(child) when != e = child ( return child; | + of_node_put(child); ? return ...; ) ... } // </smpl> --- arch/arm/kernel/devtree.c | 1 + arch/arm/mach-shmobile/pm-rmobile.c | 4 +++- drivers/power/charger-manager.c | 4 +++- drivers/regulator/of_regulator.c | 1 + drivers/video/backlight/88pm860x_bl.c | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/5] backlight: 88pm860x_bl: add missing of_node_put 2015-10-10 12:30 [PATCH 0/5] add missing of_node_put Julia Lawall @ 2015-10-10 12:30 ` Julia Lawall 2015-10-13 8:15 ` Lee Jones 0 siblings, 1 reply; 3+ messages in thread From: Julia Lawall @ 2015-10-10 12:30 UTC (permalink / raw) To: Jingoo Han Cc: kernel-janitors, Lee Jones, Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev, linux-kernel, Russell King - ARM Linux, Thomas Petazzoni, Andrew Lunn, Bjorn Helgaas, Jason Cooper 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. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ expression root,e; local idexpression child; iterator name for_each_child_of_node; @@ for_each_child_of_node(root, child) { ... when != of_node_put(child) when != e = child + of_node_put(child); ? break; ... } ... when != child // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- drivers/video/backlight/88pm860x_bl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c index 2da5862..6d8dc2c 100644 --- a/drivers/video/backlight/88pm860x_bl.c +++ b/drivers/video/backlight/88pm860x_bl.c @@ -180,6 +180,7 @@ static int pm860x_backlight_dt_init(struct platform_device *pdev, data->iset = PM8606_WLED_CURRENT(iset); of_property_read_u32(np, "marvell,88pm860x-pwm", &data->pwm); + of_node_put(np); break; } } ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/5] backlight: 88pm860x_bl: add missing of_node_put 2015-10-10 12:30 ` [PATCH 1/5] backlight: 88pm860x_bl: " Julia Lawall @ 2015-10-13 8:15 ` Lee Jones 0 siblings, 0 replies; 3+ messages in thread From: Lee Jones @ 2015-10-13 8:15 UTC (permalink / raw) To: Julia Lawall Cc: Jingoo Han, kernel-janitors, Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev, linux-kernel, Russell King - ARM Linux, Thomas Petazzoni, Andrew Lunn, Bjorn Helgaas, Jason Cooper On Sat, 10 Oct 2015, Julia Lawall 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. > > The semantic patch that fixes this problem is as follows > (http://coccinelle.lip6.fr): > > // <smpl> > @@ > expression root,e; > local idexpression child; > iterator name for_each_child_of_node; > @@ > > for_each_child_of_node(root, child) { > ... when != of_node_put(child) > when != e = child > + of_node_put(child); > ? break; > ... > } > ... when != child > // </smpl> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> > > --- > drivers/video/backlight/88pm860x_bl.c | 1 + > 1 file changed, 1 insertion(+) Applied, thanks. > diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c > index 2da5862..6d8dc2c 100644 > --- a/drivers/video/backlight/88pm860x_bl.c > +++ b/drivers/video/backlight/88pm860x_bl.c > @@ -180,6 +180,7 @@ static int pm860x_backlight_dt_init(struct platform_device *pdev, > data->iset = PM8606_WLED_CURRENT(iset); > of_property_read_u32(np, "marvell,88pm860x-pwm", > &data->pwm); > + of_node_put(np); > break; > } > } > -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-13 8:15 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-10-10 12:30 [PATCH 0/5] add missing of_node_put Julia Lawall 2015-10-10 12:30 ` [PATCH 1/5] backlight: 88pm860x_bl: " Julia Lawall 2015-10-13 8:15 ` Lee Jones
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).