* Remove clientdata before kfree?
@ 2010-02-21 10:20 Wolfram Sang
[not found] ` <20100221102034.GD25833-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2010-02-21 10:20 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Jean Delvare
[-- Attachment #1: Type: text/plain, Size: 744 bytes --]
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
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Remove clientdata before kfree?
[not found] ` <20100221102034.GD25833-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2010-02-21 10:32 ` Jean Delvare
0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2010-02-21 10:32 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA
On Sun, 21 Feb 2010 11:20:34 +0100, Wolfram Sang wrote:
> 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.
--
Jean Delvare
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-21 10:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-21 10:20 Remove clientdata before kfree? Wolfram Sang
[not found] ` <20100221102034.GD25833-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-02-21 10:32 ` Jean Delvare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).