HID: i2c-hid: also call i2c_hid_free_buffers in i2c_hid_remove
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>
Tue, 4 Dec 2012 15:27:54 +0000 (16:27 +0100)
committerJiri Kosina <jkosina@suse.cz>
Wed, 5 Dec 2012 10:26:36 +0000 (11:26 +0100)
In the case where the hid driver in charge of handling the hid part
of the device (hid-generic for instance) fails at probe, neither
i2c_hid_start nor i2c_hid_stop are called.
Thus, the buffers allocated in i2c_hid_probe are never freed.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/i2c-hid/i2c-hid.c

index 035a0cdd129ee8d2594a65ea6b515a48c4bd3cd7..aab3357626c7865bf82a1353628a9e413912a154 100644 (file)
@@ -908,6 +908,9 @@ static int __devexit i2c_hid_remove(struct i2c_client *client)
 
        free_irq(client->irq, ihid);
 
+       if (ihid->bufsize)
+               i2c_hid_free_buffers(ihid);
+
        kfree(ihid);
 
        return 0;