mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia@diku.dk>
To: Greg Dietsche <gregory.dietsche@cuw.edu>
Cc: Gilles.Muller@lip6.fr, npalix.work@gmail.com, cocci@diku.dk,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] coccinelle: if(ret)return ret; return ret; semantic patch
Date: Tue, 7 Jun 2011 18:56:22 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.1106071855540.4074@ask.diku.dk> (raw)
In-Reply-To: <4DEE482D.7020505@cuw.edu>

On Tue, 7 Jun 2011, Greg Dietsche wrote:

> Hi Julia,
> 
> On 06/05/2011 11:55 PM, Julia Lawall wrote:
> > Thanks.  I tried this too, but I wasn't sure about the results.  The
> > question is why stop here.
> very interesting! Honestly I hadn't thought much further than what you see in
> my semantic patch. I'd noticed piece of code in the iwlegacy driver and
> wondered what'd happen if I taught myself a little bit about cocci :)
> >    For example, there are IS_ERR calls that one
> > could consider as well.  Or ret<  0.  Or why not just:
> >
> > @@
> > expression ret;
> > @@
> >
> > - if (...) return ret;
> >    return ret;
> >
> > Although there might be function calls that one doesn't want to touch, so:
> >
> > @@
> > identifier f != IS_ERR;
> > expression ret;
> > statement S;
> > @@
> >
> > (
> > if (<+...f(...)...+>) S
> > |
> > - if (...) return ret;
> >    return ret;
> > )
> >
> > julia
> >
> >
> >    
> There seem to be many variations on the theme to consider... though hopefully
> the compiler optimizes most of these out... For example, in
> sound/soc/codecs/wm8940.c, Jonathan Cameron pointed some code out to me that
> looks like this:
> 
>         if (ret)
>                 goto error_ret;
> 
> error_ret:
>         return ret;

Good one :)

> As an aside, I added a feature to the script for myself so that I can for
> example write 'make coccicheck M=drivers/net/wireless/' for example to focus
> in on that directory and just run the checks there... I can submit a patch for
> this... though I was wondering if there is already a way to do this and I just
> missed it. The thought was to make it work the same way you'd build a module.

I think it is possible, but Nicolas would know better.

julia

  reply	other threads:[~2011-06-07 16:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-06  0:26 Greg Dietsche
2011-06-06  4:55 ` Julia Lawall
2011-06-07 15:47   ` Greg Dietsche
2011-06-07 16:56     ` Julia Lawall [this message]
2011-06-07 21:54       ` Nicolas Palix
2011-06-07 22:59         ` Greg Dietsche
2011-06-08  7:11           ` Nicolas Palix
2011-06-08  7:24             ` Julia Lawall
2011-06-11 15:37   ` Greg Dietsche
2011-06-11 15:43     ` Julia Lawall
2011-06-06  4:56 ` Julia Lawall
2011-06-13 18:23   ` [PATCH v2] coccinelle: if (ret) return " Greg Dietsche
2011-06-13 18:36     ` Joe Perches
2011-06-13 18:38     ` Julia Lawall
2011-06-13 20:55       ` Greg Dietsche
2011-06-14  5:50         ` Julia Lawall
2011-06-14 21:24           ` Greg Dietsche
2011-06-15  1:15             ` Greg Dietsche
2011-06-15  5:58               ` Julia Lawall
2011-06-15 15:33                 ` [Cocci] " Greg Dietsche
2011-06-15 15:34                   ` Julia Lawall
2011-06-15 15:35                   ` Julia Lawall
2011-06-15 16:05                     ` Greg Dietsche
2011-06-15  1:29       ` [PATCH v3] " Greg Dietsche
2011-06-15  5:50         ` Julia Lawall
2011-06-15 15:50         ` [PATCH v4] " Greg Dietsche

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=Pine.LNX.4.64.1106071855540.4074@ask.diku.dk \
    --to=julia@diku.dk \
    --cc=Gilles.Muller@lip6.fr \
    --cc=cocci@diku.dk \
    --cc=gregory.dietsche@cuw.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npalix.work@gmail.com \
    /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

all inboxes | Powered by JetHome®