Re: [PATCH] leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'

2020-11-25 Thread Heikki Krogerus
On Wed, Nov 25, 2020 at 11:46:29AM +0100, Pavel Machek wrote: > Hi! > > > > > > I have been trying to teach Smatch to understand reference counting so > > > > > it can discover these kinds of bugs automatically. > > > > > > > > > > I don't know how software_node_get_next_child() can work when it

Re: [PATCH] leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'

2020-11-25 Thread Pavel Machek
On Tue 2020-09-22 23:05:15, Christophe JAILLET wrote: > In case of memory allocation failure, we must release some resources as > done in all other error handling paths of the function. > > 'goto child_out' instead of a direct return so that 'fwnode_handle_put()' > is called when we break out of

Re: [PATCH] leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'

2020-11-25 Thread Pavel Machek
Hi! > > > > I have been trying to teach Smatch to understand reference counting so > > > > it can discover these kinds of bugs automatically. > > > > > > > > I don't know how software_node_get_next_child() can work when it doesn't > > > > call kobject_get(). This sort of bug would have been

Re: [PATCH] leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'

2020-09-28 Thread Heikki Krogerus
On Thu, Sep 24, 2020 at 09:49:32AM +0300, Dan Carpenter wrote: > On Wed, Sep 23, 2020 at 08:49:56PM +0200, Christophe JAILLET wrote: > > Le 23/09/2020 à 15:35, Dan Carpenter a écrit : > > > I've added Heikki Krogerus to the CC list because my question is mostly > > > about commit 59abd83672f7

Re: [PATCH] leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'

2020-09-24 Thread Dan Carpenter
On Wed, Sep 23, 2020 at 08:49:56PM +0200, Christophe JAILLET wrote: > Le 23/09/2020 à 15:35, Dan Carpenter a écrit : > > I've added Heikki Krogerus to the CC list because my question is mostly > > about commit 59abd83672f7 ("drivers: base: Introducing software nodes to > > the firmware node

Re: [PATCH] leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'

2020-09-23 Thread Christophe JAILLET
Le 23/09/2020 à 15:35, Dan Carpenter a écrit : I've added Heikki Krogerus to the CC list because my question is mostly about commit 59abd83672f7 ("drivers: base: Introducing software nodes to the firmware node framework"). I have been trying to teach Smatch to understand reference counting so

Re: [PATCH] leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'

2020-09-23 Thread Dan Carpenter
I've added Heikki Krogerus to the CC list because my question is mostly about commit 59abd83672f7 ("drivers: base: Introducing software nodes to the firmware node framework"). I have been trying to teach Smatch to understand reference counting so it can discover these kinds of bugs automatically.

Re: [PATCH] leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'

2020-09-23 Thread Dan Murphy
Christophe On 9/22/20 4:05 PM, Christophe JAILLET wrote: In case of memory allocation failure, we must release some resources as done in all other error handling paths of the function. 'goto child_out' instead of a direct return so that 'fwnode_handle_put()' is called when we break out of a

[PATCH] leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'

2020-09-22 Thread Christophe JAILLET
In case of memory allocation failure, we must release some resources as done in all other error handling paths of the function. 'goto child_out' instead of a direct return so that 'fwnode_handle_put()' is called when we break out of a 'device_for_each_child_node' loop. Fixes: 242b81170fb8