[PATCH] I2C hwmon: kfree fixes
authorMark M. Hoffman <mhoffman@lightlink.com>
Sat, 27 Aug 2005 01:34:08 +0000 (18:34 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 27 Aug 2005 02:37:12 +0000 (19:37 -0700)
This patch fixes several instances of hwmon drivers kfree'ing the "wrong"
pointer; the existing code works somewhat by accident.

(akpm: plucked from Greg's queue based on lkml discussion.  Finishes off the
patch from Jon Corbet)

Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/hwmon/adm1026.c
drivers/hwmon/adm1031.c

index ded6e8adc8543b7560ace693234c3217c7dfdf8b..c8a7f47911f99f315189cc60cb73ba23e888b5fb 100644 (file)
@@ -325,7 +325,7 @@ int adm1026_attach_adapter(struct i2c_adapter *adapter)
 int adm1026_detach_client(struct i2c_client *client)
 {
        i2c_detach_client(client);
-       kfree(client);
+       kfree(i2c_get_clientdata(client));
        return 0;
 }
 
index 4211c8b4601a6d05168cbc74dc5d0ec5befc9d52..9362509572709596d92849a666199f4cf1bcb46a 100644 (file)
@@ -845,7 +845,7 @@ static int adm1031_detach_client(struct i2c_client *client)
        if ((ret = i2c_detach_client(client)) != 0) {
                return ret;
        }
-       kfree(client);
+       kfree(i2c_get_clientdata(client));
        return 0;
 }