On Fri, 2008-12-05 at 07:26 -0800, Greg KH wrote:> On Fri, Dec 05, 2008 at 04:25:31PM +0100, Jiri Slaby wrote:> > Mark McLoughlin wrote:> > >> Fix the virtio bus instead.> > > > > > Yeah, the patch I posted wasn't meant as a fix for this traceback.> > > > So what's the module_get patch needed for?> > > > > Here's one that does fix it.> > ...> > > From: Mark McLoughlin <markmc@redhat.com>> > > Subject: [PATCH] virtio: add device release() function> > > > > > Add a release() function for virtio_pci devices so as to avoid:> > > > > > Device 'virtio0' does not have a release() function, it is broken and must be fixed> > Just providing an empty release function to the kernel is the complete> wrong thing. Do you not think the kernel is actually trying to tell you> something here? If it could test for an empty release function it would> complain about that as well, providing one is no "fix" at all.> > You need to free your memory in the release function that is owned by> the device/structure. Please read the file, Documentation/kobject.txt> for details as to what you need to do.

Okay, consider me "mocked mercilessly by the kobject maintainer" :-)

Does this version look a bit more reasonable?

(The virtio_pci_root is statically allocated so I don't see howrelease() could be non-empty in this case, but let's debate whether wewant to keep this dummy device at all)

Device 'virtio0' does not have a release() function, it is broken and must be fixed

Move the code to free the resources associated with the devicefrom virtio_pci_remove() into this new function. virtio_pci_remove()now merely unregisters the device which should cause the finalref to be dropped and virtio_pci_release_dev() to be called.