should failed calls to device_register() always call put_device()?
Robert P. J. Day
rpjday at crashcourse.ca
Sat May 28 15:43:13 EDT 2011
On Sat, 28 May 2011, Belisko Marek wrote:
> On Sat, May 28, 2011 at 6:29 PM, Robert P. J. Day <rpjday at 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 seem to suggest. based on the
> > warning from the kernel source file, it would seem that you *must*
> > do a put_device() in that situation -- it's not optional.
> Sure you're right. You can send a patch to fix this problem. Good
> catch.
i didn't want to submit anything until i verified what correct code
should look like. and it's not like that's the only example -- others
are trivially easy to find, like this in
drivers/media/video/bt8xx/bttv-gpio.c (line 97):
err = device_register(&sub->dev);
if (0 != err) {
kfree(sub);
return err;
}
that would seem to be incorrect as well, no?
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
More information about the Kernelnewbies
mailing list