Re: [patch] Fix for: OOPS with ns558 and usb-ohci

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Sun Aug 13 2000 - 17:05:18 EST


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));

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:31 EST