lkml.org 
[lkml]   [2004]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject2.6.1-pci_register_driver() and counts
Is this code in drivers/pci/pci-driver.c, pci_register_driver() correct?

/* register with core */
count = driver_register(&drv->driver);
if (count >= 0) {
pci_populate_driver_dir(drv);
}
return count ? count : 1;

Looking at base/driver.c, driver_register() returns the output from
bus_add_driver().
Looking at base/bus.c, bus_add_driver() does not return a count, it only returns
error codes.

So the code in pci_register_driver() works as long as there is no error and the
return from driver_register() is zero, but it isn't going to work right in the
error case. Also the code is just wrong because it is expecting a count that
isn't returned.

I don't know if the count is needed, but if it is, it looks like driver_attach()
would need to modified to return it instead of void.

=====
Jon Smirl
jonsmirl@yahoo.com

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:59    [W:0.070 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site