Skip to content

Commit bebf468

Browse files
Mark M. HoffmanLinus Torvalds
authored andcommitted
[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 <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>
1 parent 32818c2 commit bebf468

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/hwmon/adm1026.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ int adm1026_attach_adapter(struct i2c_adapter *adapter)
325325
int adm1026_detach_client(struct i2c_client *client)
326326
{
327327
i2c_detach_client(client);
328-
kfree(client);
328+
kfree(i2c_get_clientdata(client));
329329
return 0;
330330
}
331331

drivers/hwmon/adm1031.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ static int adm1031_detach_client(struct i2c_client *client)
845845
if ((ret = i2c_detach_client(client)) != 0) {
846846
return ret;
847847
}
848-
kfree(client);
848+
kfree(i2c_get_clientdata(client));
849849
return 0;
850850
}
851851

0 commit comments

Comments
 (0)