Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: exynos: call CPUFREQ_POSTCHANGE notfier in error cases

PRECHANGE and POSTCHANGE notifiers must be called in groups, i.e either both
should be called or both shouldn't be.

In case we have started PRECHANGE notifier and found an error, we must call
POSTCHANGE notifier with freqs.new = freqs.old to guarantee that sequence of
calling notifiers is complete.

This patch fixes it.

Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

+8 -2
+8 -2
drivers/cpufreq/exynos-cpufreq.c
··· 113 113 if (ret) { 114 114 pr_err("%s: failed to set cpu voltage to %d\n", 115 115 __func__, arm_volt); 116 - goto out; 116 + freqs.new = freqs.old; 117 + goto post_notify; 117 118 } 118 119 } 119 120 ··· 124 123 if (ret) { 125 124 pr_err("%s: failed to set cpu voltage to %d\n", 126 125 __func__, safe_arm_volt); 127 - goto out; 126 + freqs.new = freqs.old; 127 + goto post_notify; 128 128 } 129 129 } 130 130 131 131 exynos_info->set_freq(old_index, index); 132 132 133 + post_notify: 133 134 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 135 + 136 + if (ret) 137 + goto out; 134 138 135 139 /* When the new frequency is lower than current frequency */ 136 140 if ((freqs.new < freqs.old) ||