]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] I2C: fixed a little memory leak in i2c-ali15x3.c
authorDaniele Bellucci <bellucda@tiscali.it>
Fri, 1 Aug 2003 14:39:02 +0000 (07:39 -0700)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 1 Aug 2003 14:39:02 +0000 (07:39 -0700)
there is a little memory leak in i2c-ali15x3.c .
You can reproduce the BUG as follows:
In a PC with no such device unloading i2c-ali15x3 cause an oops in release_region.
I've fixed by moving release_region() from i2c_ali15x3_exit() to ali15x3_remove().

drivers/i2c/busses/i2c-ali15x3.c

index 0fef7bd6bba057f31b076078a4eb7af4ea8502f9..9c70bae5b87d6ed93bcd3ec439d84314b553e1a3 100644 (file)
@@ -508,6 +508,7 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_
 static void __devexit ali15x3_remove(struct pci_dev *dev)
 {
        i2c_del_adapter(&ali15x3_adapter);
+       release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE);
 }
 
 static struct pci_driver ali15x3_driver = {
@@ -526,7 +527,6 @@ static int __init i2c_ali15x3_init(void)
 static void __exit i2c_ali15x3_exit(void)
 {
        pci_unregister_driver(&ali15x3_driver);
-       release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE);
 }
 
 MODULE_AUTHOR ("Frodo Looijaard <frodol@dds.nl>, "