diff options
author | Julia Lawall <julia@diku.dk> | 2011-02-10 15:01:37 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-02-11 16:12:20 -0800 |
commit | 80d02d273641d515269c016d9e8da5882e4432e4 (patch) | |
tree | 48775b39bc9edfea0377d604f928912e3bc289fd /init | |
parent | 678ff896a37afdbca292c7846ec895463aed35a5 (diff) |
drivers/w1/masters/omap_hdq.c: add missing clk_put
This code makes two calls to clk_get, then test both return values and
fails if either failed.
The problem is that in the first inner if, where the first call to
clk_get has failed, it don't know if the second call has failed as well.
So it don't know whether clk_get should be called on the result of the
second call. Of course, it would be possible to test that value again.
A simpler solution is just to test the result of calling clk_get
directly after each call.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
position p1,p2;
expression e;
statement S;
@@
e = clk_get@p1(...)
...
if@p2 (IS_ERR(e)) S
@@
expression e;
statement S;
identifier l;
position r.p1, p2 != r.p2;
@@
*e = clk_get@p1(...)
... when != clk_put(e)
*if@p2 (...)
{
... when != clk_put(e)
* return ...;
}// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Amit Kucheria <amit.kucheria@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions