mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-01 15:49:14 +07:00
[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>
This commit is contained in:
parent
0db4a8a99f
commit
a07530b445
@ -696,13 +696,13 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr,
|
|||||||
{
|
{
|
||||||
struct cpufreq_policy * policy = to_policy(kobj);
|
struct cpufreq_policy * policy = to_policy(kobj);
|
||||||
struct freq_attr * fattr = to_attr(attr);
|
struct freq_attr * fattr = to_attr(attr);
|
||||||
ssize_t ret;
|
ssize_t ret = -EINVAL;
|
||||||
policy = cpufreq_cpu_get(policy->cpu);
|
policy = cpufreq_cpu_get(policy->cpu);
|
||||||
if (!policy)
|
if (!policy)
|
||||||
return -EINVAL;
|
goto no_policy;
|
||||||
|
|
||||||
if (lock_policy_rwsem_write(policy->cpu) < 0)
|
if (lock_policy_rwsem_write(policy->cpu) < 0)
|
||||||
return -EINVAL;
|
goto fail;
|
||||||
|
|
||||||
if (fattr->store)
|
if (fattr->store)
|
||||||
ret = fattr->store(policy, buf, count);
|
ret = fattr->store(policy, buf, count);
|
||||||
@ -710,8 +710,9 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr,
|
|||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
|
|
||||||
unlock_policy_rwsem_write(policy->cpu);
|
unlock_policy_rwsem_write(policy->cpu);
|
||||||
|
fail:
|
||||||
cpufreq_cpu_put(policy);
|
cpufreq_cpu_put(policy);
|
||||||
|
no_policy:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user