linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Remove clientdata before kfree?
Date: Sun, 21 Feb 2010 11:32:39 +0100	[thread overview]
Message-ID: <20100221113239.4f44752e@hyperion.delvare> (raw)
In-Reply-To: <20100221102034.GD25833-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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

      parent reply	other threads:[~2010-02-21 10:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100221113239.4f44752e@hyperion.delvare \
    --to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).