[CPUFREQ] s5pv210-cpufreq.c: Add missing clk_put
authorJulia Lawall <julia@diku.dk>
Tue, 7 Jun 2011 01:59:02 +0000 (18:59 -0700)
committerDave Jones <davej@redhat.com>
Wed, 13 Jul 2011 22:29:54 +0000 (18:29 -0400)
commit4911ca1031c2ade225fdf22cc872bc121c2c2ec5
treef3e949229f7b1c112cd1c70cd3ebeb18df138ef4
parent15964d388528c1dbb672027c8003fe7e81630a35
[CPUFREQ] s5pv210-cpufreq.c: Add missing clk_put

The successive calls to clk_get each call clk_put in the case of failure,
but this is not done for subsequent error handling code.  The calls to
clk_get are moved to the end of the function, and appropriate gotos are
added.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
expression e1,e2;
statement S;
@@

e1 = clk_get@p1(...);
... when != e1 = e2
    when != clk_put(e1)
    when any
if (...) { ... when != clk_put(e1)
               when != if (...) { ... clk_put(e1) ... }
* return@p3 ...;
 } else S
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Dave Jones <davej@redhat.com>
drivers/cpufreq/s5pv210-cpufreq.c