Re: should failed calls to device_register() always call put_device()?

2011-05-29 Thread Robert P. J. Day
On Sun, 29 May 2011, Greg KH wrote: Trust me, dig through the driver core and kobject model, it's tricky to follow, but it's there. Or at least it was there the last time I did this, that is why I documented it so that no one would have to do that again and they could just easily follow the

Re: should failed calls to device_register() always call put_device()?

2011-05-29 Thread Greg KH
On Sun, May 29, 2011 at 07:21:10AM -0400, Robert P. J. Day wrote: On Sun, 29 May 2011, Greg KH wrote: Trust me, dig through the driver core and kobject model, it's tricky to follow, but it's there. Or at least it was there the last time I did this, that is why I documented it so that no

Re: should failed calls to device_register() always call put_device()?

2011-05-29 Thread Robert P. J. Day
On Sun, 29 May 2011, Greg KH wrote: On Sun, May 29, 2011 at 07:21:10AM -0400, Robert P. J. Day wrote: what is apparently *not* OK is to either call kfree() *before* calling put_device(), or to call kfree() and nothing else upon a failed device_register() call. some apparently broken

Re: should failed calls to device_register() always call put_device()?

2011-05-28 Thread Belisko Marek
Hi Robert, On Sat, May 28, 2011 at 5:15 PM, Robert P. J. Day rpj...@crashcourse.ca wrote:  from drivers/base/core.c, we have the fairly unambiguous advice: * NOTE: _Never_ directly free @dev after calling this function, even * if it returned an error! Always use put_device() to give up the

Re: should failed calls to device_register() always call put_device()?

2011-05-28 Thread Robert P. J. Day
On Sat, 28 May 2011, Belisko Marek wrote: Hi Robert, On Sat, May 28, 2011 at 5:15 PM, Robert P. J. Day rpj...@crashcourse.ca wrote:  from drivers/base/core.c, we have the fairly unambiguous advice: * NOTE: _Never_ directly free @dev after calling this function, even * if it

Re: should failed calls to device_register() always call put_device()?

2011-05-28 Thread Belisko Marek
On Sat, May 28, 2011 at 6:29 PM, Robert P. J. Day rpj...@crashcourse.ca wrote: On Sat, 28 May 2011, Belisko Marek wrote: Hi Robert, On Sat, May 28, 2011 at 5:15 PM, Robert P. J. Day rpj...@crashcourse.ca wrote:  from drivers/base/core.c, we have the fairly unambiguous advice: *

Re: should failed calls to device_register() always call put_device()?

2011-05-28 Thread Robert P. J. Day
On Sat, 28 May 2011, Belisko Marek wrote: On Sat, May 28, 2011 at 6:29 PM, Robert P. J. Day rpj...@crashcourse.ca wrote:  i agree that there should be a put_device(dev-dev); statement as you show above.  however, i still don't see how this can be just a stylistic improvement as you

Re: should failed calls to device_register() always call put_device()?

2011-05-28 Thread Belisko Marek
On Sat, May 28, 2011 at 9:43 PM, Robert P. J. Day rpj...@crashcourse.ca wrote: On Sat, 28 May 2011, Belisko Marek wrote: On Sat, May 28, 2011 at 6:29 PM, Robert P. J. Day rpj...@crashcourse.ca wrote:  i agree that there should be a put_device(dev-dev); statement as you show above.  

Re: should failed calls to device_register() always call put_device()?

2011-05-28 Thread Greg KH
On Sat, May 28, 2011 at 06:00:10PM +0200, Belisko Marek wrote: Hi Robert, On Sat, May 28, 2011 at 5:15 PM, Robert P. J. Day rpj...@crashcourse.ca wrote:  from drivers/base/core.c, we have the fairly unambiguous advice: * NOTE: _Never_ directly free @dev after calling this function,