Re: Remove clientdata before kfree?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux