lkml.org 
[lkml]   [2000]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch] Fix for: OOPS with ns558 and usb-ohci
Vojtech Pavlik wrote:
> Yes, this is a genuine bug in ns558.c. It calls pci_register_driver and
> then exits if no gameport is found, without unregistering with the PCI
> layer. This is wrong. It should stay loaded, even if no cards were found
> yet, because the pci code could find them later.
>
> The attached patch fixes that in a simple way.
> ------------------------------------------------------------------------
>
> ns558.diffName: ns558.diff
> Type: Plain Text (text/plain)

You should probably use pci_module_init in this case. Note there
appears to be leak where the structure which is kmalloc'd in the pci
probe routine is never freed.

Also attached is a patch which fixes a resource leak.

Jeff



--
Jeff Garzik |
Building 1024 | Andre the Giant has a posse.
MandrakeSoft, Inc. |Index: drivers/char/joystick/ns558.c
===================================================================
RCS file: /g/cvslan/linux_2_3/drivers/char/joystick/ns558.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ns558.c
--- drivers/char/joystick/ns558.c 2000/06/22 00:32:50 1.1.1.1
+++ drivers/char/joystick/ns558.c 2000/08/13 22:03:44
@@ -182,6 +182,7 @@

if (!(port = kmalloc(sizeof(struct ns558), GFP_KERNEL))) {
printk(KERN_ERR "Memory allocation failed.\n");
+ release_region(ioport, iolen);
return -ENOMEM;
}
memset(port, 0, sizeof(struct ns558));
\
 
 \ /
  Last update: 2005-03-22 13:58    [from the cache]
©2003-2011 Jasper Spaans