[CPUFREQ] Fix missing cpufreq_cpu_put() call in ->store
authorDave Jones <davej@redhat.com>
Wed, 5 Mar 2008 19:22:25 +0000 (14:22 -0500)
committerDave Jones <davej@redhat.com>
Wed, 5 Mar 2008 19:45:31 +0000 (14:45 -0500)
refactor to use gotos instead of explicit exit paths

Signed-off-by: Dave Jones <davej@redhat.com>
drivers/cpufreq/cpufreq.c

index 6602e1d02de20561203af4cddd8b1fcee78e74e4..5a639b173d54eab4c29d83596751be05f8f9c58c 100644 (file)
@@ -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;
 }