linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] leds: tlc591xx: fix device_node_continue.cocci warnings (fwd)
@ 2018-12-06 20:28 Julia Lawall
  2018-12-06 22:09 ` Pavel Machek
  2018-12-07 22:25 ` Jacek Anaszewski
  0 siblings, 2 replies; 4+ messages in thread
From: Julia Lawall @ 2018-12-06 20:28 UTC (permalink / raw)
  To: Jyri Sarha
  Cc: Peter Ujfalusi, Jacek Anaszewski, Pavel Machek, linux-leds,
	linux-kernel, kbuild-all

Hello,

The code seems to be wrong in several ways.  If the continue is wanted,
the of_node_put is not needed; it will happen on the next iteration.  If
the continue is not wanted, the of_node_put is needed, and the continue
should be dropped.

julia

---------- Forwarded message ----------
Date: Thu, 6 Dec 2018 19:48:54 +0800
From: kbuild test robot <lkp@intel.com>
To: kbuild@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH] leds: tlc591xx: fix device_node_continue.cocci warnings

CC: kbuild-all@01.org
TO: Jyri Sarha <jsarha@ti.com>
CC: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Jacek Anaszewski <jacek.anaszewski@gmail.com>
CC: Pavel Machek <pavel@ucw.cz>
CC: linux-leds@vger.kernel.org
CC: linux-kernel@vger.kernel.org

From: kbuild test robot <fengguang.wu@intel.com>

drivers/leds/leds-tlc591xx.c:342:3-14: ERROR: probable double put.

 Device node iterators put the previous value of the index variable, so an
 explicit put causes a double put.

Generated by: scripts/coccinelle/iterators/device_node_continue.cocci

Fixes: 7b2d34aaede7 ("leds: tlc591xx: Add gpio output support")
CC: Jyri Sarha <jsarha@ti.com>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
---

tree:   https://github.com/omap-audio/linux-audio peter/ti-linux-4.19.y/wip
head:   838f24e2deaf1229002bd6555eb7e889b09ac1f9
commit: 7b2d34aaede727b4abfc78061bbd2202fcd92bc8 [62/67] leds: tlc591xx: Add gpio output support
:::::: branch date: 26 hours ago
:::::: commit date: 26 hours ago

Please take the patch only if it's a positive warning. Thanks!

 leds-tlc591xx.c |    1 -
 1 file changed, 1 deletion(-)

--- a/drivers/leds/leds-tlc591xx.c
+++ b/drivers/leds/leds-tlc591xx.c
@@ -339,7 +339,6 @@ tlc591xx_probe(struct i2c_client *client
 	for_each_child_of_node(np, child) {
 		err = of_property_read_u32(child, "reg", &reg);
 		if (err) {
-			of_node_put(child);
 			continue;
 			return err;
 		}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: tlc591xx: fix device_node_continue.cocci warnings (fwd)
  2018-12-06 20:28 [PATCH] leds: tlc591xx: fix device_node_continue.cocci warnings (fwd) Julia Lawall
@ 2018-12-06 22:09 ` Pavel Machek
  2018-12-07 22:25 ` Jacek Anaszewski
  1 sibling, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2018-12-06 22:09 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Jyri Sarha, Peter Ujfalusi, Jacek Anaszewski, linux-leds,
	linux-kernel, kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2436 bytes --]

On Thu 2018-12-06 21:28:16, Julia Lawall wrote:
> Hello,
> 
> The code seems to be wrong in several ways.  If the continue is wanted,
> the of_node_put is not needed; it will happen on the next iteration.  If
> the continue is not wanted, the of_node_put is needed, and the continue
> should be dropped.

Yep, code is confusing. But the patch is bad, we don't want "continue; return;"

Hmm, continue seems more logical to me -- but I guess Jyri should
decde?

									Pavel

> ---------- Forwarded message ----------
> Date: Thu, 6 Dec 2018 19:48:54 +0800
> From: kbuild test robot <lkp@intel.com>
> To: kbuild@01.org
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Subject: [PATCH] leds: tlc591xx: fix device_node_continue.cocci warnings
> 
> CC: kbuild-all@01.org
> TO: Jyri Sarha <jsarha@ti.com>
> CC: Peter Ujfalusi <peter.ujfalusi@ti.com>
> CC: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> CC: Pavel Machek <pavel@ucw.cz>
> CC: linux-leds@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> 
> From: kbuild test robot <fengguang.wu@intel.com>
> 
> drivers/leds/leds-tlc591xx.c:342:3-14: ERROR: probable double put.
> 
>  Device node iterators put the previous value of the index variable, so an
>  explicit put causes a double put.
> 
> Generated by: scripts/coccinelle/iterators/device_node_continue.cocci
> 
> Fixes: 7b2d34aaede7 ("leds: tlc591xx: Add gpio output support")
> CC: Jyri Sarha <jsarha@ti.com>
> Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> ---
> 
> tree:   https://github.com/omap-audio/linux-audio peter/ti-linux-4.19.y/wip
> head:   838f24e2deaf1229002bd6555eb7e889b09ac1f9
> commit: 7b2d34aaede727b4abfc78061bbd2202fcd92bc8 [62/67] leds: tlc591xx: Add gpio output support
> :::::: branch date: 26 hours ago
> :::::: commit date: 26 hours ago
> 
> Please take the patch only if it's a positive warning. Thanks!
> 
>  leds-tlc591xx.c |    1 -
>  1 file changed, 1 deletion(-)
> 
> --- a/drivers/leds/leds-tlc591xx.c
> +++ b/drivers/leds/leds-tlc591xx.c
> @@ -339,7 +339,6 @@ tlc591xx_probe(struct i2c_client *client
>  	for_each_child_of_node(np, child) {
>  		err = of_property_read_u32(child, "reg", &reg);
>  		if (err) {
> -			of_node_put(child);
>  			continue;
>  			return err;
>  		}

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: tlc591xx: fix device_node_continue.cocci warnings (fwd)
  2018-12-06 20:28 [PATCH] leds: tlc591xx: fix device_node_continue.cocci warnings (fwd) Julia Lawall
  2018-12-06 22:09 ` Pavel Machek
@ 2018-12-07 22:25 ` Jacek Anaszewski
  2018-12-08  7:28   ` Julia Lawall
  1 sibling, 1 reply; 4+ messages in thread
From: Jacek Anaszewski @ 2018-12-07 22:25 UTC (permalink / raw)
  To: Julia Lawall, Jyri Sarha
  Cc: Peter Ujfalusi, Pavel Machek, linux-leds, linux-kernel, kbuild-all

Hi Julia,

Thank you for the patch, but it doesn't apply to LED tree.

The patch causing the problem is out-of-LED-tree.

Best regards,
Jacek Anaszewski

On 12/6/18 9:28 PM, Julia Lawall wrote:
> Hello,
> 
> The code seems to be wrong in several ways.  If the continue is wanted,
> the of_node_put is not needed; it will happen on the next iteration.  If
> the continue is not wanted, the of_node_put is needed, and the continue
> should be dropped.
> 
> julia
> 
> ---------- Forwarded message ----------
> Date: Thu, 6 Dec 2018 19:48:54 +0800
> From: kbuild test robot <lkp@intel.com>
> To: kbuild@01.org
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Subject: [PATCH] leds: tlc591xx: fix device_node_continue.cocci warnings
> 
> CC: kbuild-all@01.org
> TO: Jyri Sarha <jsarha@ti.com>
> CC: Peter Ujfalusi <peter.ujfalusi@ti.com>
> CC: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> CC: Pavel Machek <pavel@ucw.cz>
> CC: linux-leds@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> 
> From: kbuild test robot <fengguang.wu@intel.com>
> 
> drivers/leds/leds-tlc591xx.c:342:3-14: ERROR: probable double put.
> 
>   Device node iterators put the previous value of the index variable, so an
>   explicit put causes a double put.
> 
> Generated by: scripts/coccinelle/iterators/device_node_continue.cocci
> 
> Fixes: 7b2d34aaede7 ("leds: tlc591xx: Add gpio output support")
> CC: Jyri Sarha <jsarha@ti.com>
> Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> ---
> 
> tree:   https://github.com/omap-audio/linux-audio peter/ti-linux-4.19.y/wip
> head:   838f24e2deaf1229002bd6555eb7e889b09ac1f9
> commit: 7b2d34aaede727b4abfc78061bbd2202fcd92bc8 [62/67] leds: tlc591xx: Add gpio output support
> :::::: branch date: 26 hours ago
> :::::: commit date: 26 hours ago
> 
> Please take the patch only if it's a positive warning. Thanks!
> 
>   leds-tlc591xx.c |    1 -
>   1 file changed, 1 deletion(-)
> 
> --- a/drivers/leds/leds-tlc591xx.c
> +++ b/drivers/leds/leds-tlc591xx.c
> @@ -339,7 +339,6 @@ tlc591xx_probe(struct i2c_client *client
>   	for_each_child_of_node(np, child) {
>   		err = of_property_read_u32(child, "reg", &reg);
>   		if (err) {
> -			of_node_put(child);
>   			continue;
>   			return err;
>   		}
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: tlc591xx: fix device_node_continue.cocci warnings (fwd)
  2018-12-07 22:25 ` Jacek Anaszewski
@ 2018-12-08  7:28   ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2018-12-08  7:28 UTC (permalink / raw)
  To: Jacek Anaszewski
  Cc: Jyri Sarha, Peter Ujfalusi, Pavel Machek, linux-leds,
	linux-kernel, kbuild-all



On Fri, 7 Dec 2018, Jacek Anaszewski wrote:

> Hi Julia,
>
> Thank you for the patch, but it doesn't apply to LED tree.
>
> The patch causing the problem is out-of-LED-tree.

OK, I guess that the patch is in a TI-specific tree, given the name.

Thanks for looking into it.

julia

>
> Best regards,
> Jacek Anaszewski
>
> On 12/6/18 9:28 PM, Julia Lawall wrote:
> > Hello,
> >
> > The code seems to be wrong in several ways.  If the continue is wanted,
> > the of_node_put is not needed; it will happen on the next iteration.  If
> > the continue is not wanted, the of_node_put is needed, and the continue
> > should be dropped.
> >
> > julia
> >
> > ---------- Forwarded message ----------
> > Date: Thu, 6 Dec 2018 19:48:54 +0800
> > From: kbuild test robot <lkp@intel.com>
> > To: kbuild@01.org
> > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > Subject: [PATCH] leds: tlc591xx: fix device_node_continue.cocci warnings
> >
> > CC: kbuild-all@01.org
> > TO: Jyri Sarha <jsarha@ti.com>
> > CC: Peter Ujfalusi <peter.ujfalusi@ti.com>
> > CC: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> > CC: Pavel Machek <pavel@ucw.cz>
> > CC: linux-leds@vger.kernel.org
> > CC: linux-kernel@vger.kernel.org
> >
> > From: kbuild test robot <fengguang.wu@intel.com>
> >
> > drivers/leds/leds-tlc591xx.c:342:3-14: ERROR: probable double put.
> >
> >   Device node iterators put the previous value of the index variable, so an
> >   explicit put causes a double put.
> >
> > Generated by: scripts/coccinelle/iterators/device_node_continue.cocci
> >
> > Fixes: 7b2d34aaede7 ("leds: tlc591xx: Add gpio output support")
> > CC: Jyri Sarha <jsarha@ti.com>
> > Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> > ---
> >
> > tree:   https://github.com/omap-audio/linux-audio peter/ti-linux-4.19.y/wip
> > head:   838f24e2deaf1229002bd6555eb7e889b09ac1f9
> > commit: 7b2d34aaede727b4abfc78061bbd2202fcd92bc8 [62/67] leds: tlc591xx: Add
> > gpio output support
> > :::::: branch date: 26 hours ago
> > :::::: commit date: 26 hours ago
> >
> > Please take the patch only if it's a positive warning. Thanks!
> >
> >   leds-tlc591xx.c |    1 -
> >   1 file changed, 1 deletion(-)
> >
> > --- a/drivers/leds/leds-tlc591xx.c
> > +++ b/drivers/leds/leds-tlc591xx.c
> > @@ -339,7 +339,6 @@ tlc591xx_probe(struct i2c_client *client
> >   	for_each_child_of_node(np, child) {
> >   		err = of_property_read_u32(child, "reg", &reg);
> >   		if (err) {
> > -			of_node_put(child);
> >   			continue;
> >   			return err;
> >   		}
> >
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-08  7:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06 20:28 [PATCH] leds: tlc591xx: fix device_node_continue.cocci warnings (fwd) Julia Lawall
2018-12-06 22:09 ` Pavel Machek
2018-12-07 22:25 ` Jacek Anaszewski
2018-12-08  7:28   ` Julia Lawall

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).