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)
Unified · Split
| @@ -325,7 +325,7 @@ int adm1026_attach_adapter(struct i2c_adapter *adapter) · 324 unmodified lines | ||
| 325 | 325 | int adm1026_detach_client(struct i2c_client *client) |
| 326 | 326 | { |
| 327 | 327 | i2c_detach_client(client); |
| 328 | − kfree(client); | |
| 328 | + kfree(i2c_get_clientdata(client)); | |
| 329 | 329 | return 0; |
| 330 | 330 | } |
| 331 | 331 | |
| @@ -845,7 +845,7 @@ static int adm1031_detach_client(struct i2c_client *client) · 844 unmodified lines | ||
| 845 | 845 | if ((ret = i2c_detach_client(client)) != 0) { |
| 846 | 846 | return ret; |
| 847 | 847 | } |
| 848 | − kfree(client); | |
| 848 | + kfree(i2c_get_clientdata(client)); | |
| 849 | 849 | return 0; |
| 850 | 850 | } |
| 851 | 851 | |