From: Mark M. Hoffman Date: Sat, 27 Aug 2005 01:34:08 +0000 (-0700) Subject: [PATCH] I2C hwmon: kfree fixes X-Git-Tag: v2.6.13~17 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=bebf4688e9dbbfdd421736685d607bced91a3c91;p=linux-2.6-omap-h63xx.git [PATCH] I2C hwmon: kfree fixes 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 Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index ded6e8adc85..c8a7f47911f 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c @@ -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; } diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 4211c8b4601..93625095727 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c @@ -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; }