mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Coccinelle <cocci@systeme.lip6.fr>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Fabian Frederick <fabf@skynet.be>, Joe Perches <joe@perches.com>
Subject: Re: [patch 119/197] scripts/coccinelle/free: Delete NULL test before freeing functions
Date: Sat, 9 Aug 2014 10:37:51 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.02.1408091028520.2016@localhost6.localdomain6> (raw)
In-Reply-To: <53E5DA60.90902@users.sourceforge.net>

On Sat, 9 Aug 2014, SF Markus Elfring wrote:

> > +@r depends on context || report || org @
> > +expression E;
> > +position p;
> > +@@
> > +
> > +* if (E)
> > +*	\(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|usb_free_urb\)(E);
> 
> How do you think about to add the construct "@p" also behind the function name
> "usb_free_urb"?

Yes, that would be needed, thanks.  Also, it was recently suggested to add 
of_node_put to the list of things that are checked for.

> Is my previous update suggestion for such an issue worth for another look, too?

I still don't think this should be done for any random function that 
performs a null test on its argument.  The corrections involved here are 
not as trivial as they would seem.  Often it is not the case that the null 
test at the call site should be just deleted, instead the code should be 
reorganized.  Making a rule that treats 5000 functions that are 
automatically selected will just encourage people to do sloppy things.

(Personally, I don't like the whole null test removal idea.  It mixes the 
notion of something that is necessary and has failed and something that is 
optional.  In the case of something that is necessary and has failed, the 
null value is usually statically apparent, and the code can be reorganized 
so that a null value doesn't go where it is not wanted.  In the case of 
something that is simply optional, the presence of the null test gives 
the reader of the code some information.  Removing this information in 
rarely executed code seems unfortunate.)

julia

> 
> Regards,
> Markus
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2014-08-09  8:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <53e53fd1.zO3IbUqJ421c7VXf%akpm@linux-foundation.org>
2014-08-09  8:22 ` SF Markus Elfring
2014-08-09  8:37   ` Julia Lawall [this message]
2014-08-09  9:13     ` [patch 119/197] scripts/coccinelle/free: Delete NULL test before freeing functions? SF Markus Elfring
2015-05-06 13:45     ` [patch 119/197] scripts/coccinelle/free: Delete NULL test before freeing functions SF Markus Elfring

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=alpine.DEB.2.02.1408091028520.2016@localhost6.localdomain6 \
    --to=julia.lawall@lip6.fr \
    --cc=akpm@linux-foundation.org \
    --cc=cocci@systeme.lip6.fr \
    --cc=elfring@users.sourceforge.net \
    --cc=fabf@skynet.be \
    --cc=joe@perches.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome