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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 28 May 2011, Belisko Marek wrote:

> On Sat, May 28, 2011 at 6:29 PM, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> 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
========================================================================
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux