linux/drivers/cpufreq
Julia Lawall f1829e4a37 [CPUFREQ] drivers/cpufreq/cpufreq.c: Adjust error handling code involving cpufreq_cpu_put
After calling cpufreq_cpu_get, error handling code should call
cpufreq_cpu_put.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r@
expression x,E;
statement S;
position p1,p2,p3;
@@

(
if ((x = cpufreq_cpu_get@p1(...)) == NULL || ...) S
|
x = cpufreq_cpu_get@p1(...)
... when != x
if (x == NULL || ...) S
)
<...
if@p3 (...) { ... when != cpufreq_cpu_put(x)
                  when != if (x) { ... cpufreq_cpu_put(x); ...}
    return@p2 ...;
}
...>
(
return x;
|
return 0;
|
x = E
|
E = x
|
cpufreq_cpu_put(x)
)

@exists@
position r.p1,r.p2,r.p3;
expression x;
int ret != 0;
statement S;
@@

* x = cpufreq_cpu_get@p1(...)
  <...
* if@p3 (...)
  S
  ...>
* return@p2 \(NULL\|ret\);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Dave Jones <davej@redhat.com>
2008-10-09 13:52:43 -04:00
..
cpufreq_conservative.c [CPUFREQ] Fix -Wshadow warning in conservative governor. 2008-08-08 16:00:48 -04:00
cpufreq_ondemand.c [CPUFREQ] add error handling for cpufreq_register_governor() error 2008-10-09 13:52:43 -04:00
cpufreq_performance.c [CPUFREQ] Fix coding style issues in cpufreq. 2006-11-06 19:16:34 -05:00
cpufreq_powersave.c [CPUFREQ] allow use of the powersave governor as the default one 2008-04-28 16:27:08 -04:00
cpufreq_stats.c [CPUFREQ] change cpu freq arrays to per_cpu variables 2008-05-19 18:17:49 -04:00
cpufreq_userspace.c NR_CPUS: Replace NR_CPUS in cpufreq userspace routines 2008-07-20 10:21:11 +02:00
cpufreq.c [CPUFREQ] drivers/cpufreq/cpufreq.c: Adjust error handling code involving cpufreq_cpu_put 2008-10-09 13:52:43 -04:00
freq_table.c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq 2008-07-21 15:10:37 -07:00
Kconfig [CPUFREQ] allow use of the powersave governor as the default one 2008-04-28 16:27:08 -04:00
Makefile [CPUFREQ] Conservative cpufreq governer 2005-05-31 19:03:47 -07:00