[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>

+5 -4
+5 -4
drivers/cpufreq/cpufreq.c
··· 696 696 { 697 697 struct cpufreq_policy * policy = to_policy(kobj); 698 698 struct freq_attr * fattr = to_attr(attr); 699 - ssize_t ret; 699 + ssize_t ret = -EINVAL; 700 700 policy = cpufreq_cpu_get(policy->cpu); 701 701 if (!policy) 702 - return -EINVAL; 702 + goto no_policy; 703 703 704 704 if (lock_policy_rwsem_write(policy->cpu) < 0) 705 - return -EINVAL; 705 + goto fail; 706 706 707 707 if (fattr->store) 708 708 ret = fattr->store(policy, buf, count); ··· 710 710 ret = -EIO; 711 711 712 712 unlock_policy_rwsem_write(policy->cpu); 713 - 713 + fail: 714 714 cpufreq_cpu_put(policy); 715 + no_policy: 715 716 return ret; 716 717 } 717 718