diff options
author | Dave Jones <davej@redhat.com> | 2008-03-05 14:22:25 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2008-03-05 14:45:31 -0500 |
commit | a07530b44547a892dae59f4e0f141f4e6f5e2e40 (patch) | |
tree | 0e14831fba0a476f213d1f5e0f5795b16e6a5c85 /drivers/cpufreq/cpufreq.c | |
parent | 0db4a8a99f6a8534c526e8c9d4b13d098400d485 (diff) | |
download | lwn-a07530b44547a892dae59f4e0f141f4e6f5e2e40.tar.gz lwn-a07530b44547a892dae59f4e0f141f4e6f5e2e40.zip |
[CPUFREQ] Fix missing cpufreq_cpu_put() call in ->store
refactor to use gotos instead of explicit exit paths
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 6602e1d02de2..5a639b173d54 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -696,13 +696,13 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr, { struct cpufreq_policy * policy = to_policy(kobj); struct freq_attr * fattr = to_attr(attr); - ssize_t ret; + ssize_t ret = -EINVAL; policy = cpufreq_cpu_get(policy->cpu); if (!policy) - return -EINVAL; + goto no_policy; if (lock_policy_rwsem_write(policy->cpu) < 0) - return -EINVAL; + goto fail; if (fattr->store) ret = fattr->store(policy, buf, count); @@ -710,8 +710,9 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr, ret = -EIO; unlock_policy_rwsem_write(policy->cpu); - +fail: cpufreq_cpu_put(policy); +no_policy: return ret; } |