linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: Julia Lawall <julia@diku.dk>
Cc: David Brown <davidb@codeaurora.org>,
	kernel-janitors@vger.kernel.org,
	Daniel Walker <dwalker@fifo99.com>,
	Bryan Huntsman <bryanh@codeaurora.org>,
	linux-arm-msm@vger.kernel.org, linux-fbdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] drivers/video/msm/mdp.c: adjust error handling code
Date: Wed, 13 Jul 2011 08:13:19 +0000	[thread overview]
Message-ID: <20110713081318.GB13701@linux-sh.org> (raw)
In-Reply-To: <1309788705-22278-5-git-send-email-julia@diku.dk>

On Mon, Jul 04, 2011 at 04:11:45PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> Use the error handling code at the end of the function, rather than
> returning directly.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @r@
> identifier x;
> @@
> 
> kfree(x)
> 
> @@
> identifier r.x;
> expression E1!=0,E2,E3,E4;
> statement S;
> @@
> 
> (
> if (<+...x...+>) S
> |
> if (...) { ... when != kfree(x)
>                when != if (...) { ... kfree(x); ... }
>                when != x = E3
> * return E1;
> }
> ... when != x = E2
> if (...) { ... when != x = E4
>  kfree(x); ... return ...; }
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
Applied, thanks.

> I wonder if the error handling code at the end of the function should be
> calling clk_put as well?  In that case, having a separate label for this
> case would be useful.  Otherwise, one of error_request_irq and error_get_clk
> can be deleted
> 
The MSM implementation for it is simply a nop, so it's not going to
really matter one way or the other. In terms of general consistency it
might be worth implementing.

I expect that there are probably quite a few drivers that don't balance
out their clk_get()'s with clk_put()'s however, perhaps this is another
semantic patch candidate? At the very least it would be interesting to
see the statistics.

  reply	other threads:[~2011-07-13  8:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04 14:11 [PATCH 5/5] drivers/video/msm/mdp.c: adjust error handling code Julia Lawall
2011-07-13  8:13 ` Paul Mundt [this message]
2011-07-13 17:49   ` David Brown

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=20110713081318.GB13701@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=bryanh@codeaurora.org \
    --cc=davidb@codeaurora.org \
    --cc=dwalker@fifo99.com \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-fbdev@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;
as well as URLs for NNTP newsgroup(s).