Remove clientdata before kfree?
Hi Jean,
I am teaching myself coccinelle at the moment and created a semantic patch which detects missing 'i2c_set_clientdata(client, NULL)' before freeing the used data-structure. There are a number of drivers missing that.
While doing this, it is also trivial to change a few drivers to FIRST use i2c_set_clientdata() and THEN kfree (those few are doing it the other way around). I think it is cleaner this way, but probably doesn't matter much in reality. So, should I do this transformation or rather drop it (which is also trivial ;)).
Kind regards,
Wolfram
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Wolfram Sang
Hi Jean,
I am teaching myself coccinelle at the moment and created a semantic patch which detects missing '
i2c_set_clientdata(client, NULL)' before freeing the used data-structure. There are a number of drivers missing that.While doing this, it is also trivial to change a few drivers to FIRST use
i2c_set_clientdata()and THEN kfree (those few are doing it the other way around). I think it is cleaner this way, but probably doesn't matter much in reality. So, should I do this transformation or rather drop it (which is also trivial ;)).
I am very much in favor of enforcing the use of i2c_set_clientdata(client, NULL) before freeing memory. I admit it probably doesn't matter that much in practice, but it is a simple matter of good practice.
Signature · 1 line
Jean Delvare