diff options
| author | Brian-SY Yang <brian-sy.yang@mediatek.com> | 2017-09-27 09:47:54 +0800 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2019-07-18 22:05:57 +0200 |
| commit | 4a2167983f4a24985b20279301e54f8ae6b5a0b7 (patch) | |
| tree | 814a14c50145563b1be51951f7dff4ff999c6ddd | |
| parent | 8a177017a15a40228ea7fc7191f01ff943490552 (diff) | |
GPU DVFS: fix procfs write KE
[Detail] KE always happens when write /proc/gpufreq/gpufreq_fixed_freq
by IoFuzz test
[Solution] add input freq check
MTK-Commit-Id: 74092efbcddc8d1584e56bb81df4722affa0b512
Change-Id: I10525c42e946088d63b8adeb29594f754710747f
Signed-off-by: Brian-SY Yang <brian-sy.yang@mediatek.com>
CR-Id: ALPS03519258
Feature: Others
(cherry picked from commit bcbce651ad5b50bc7add53f65c0c355a3b932c33)
(cherry picked from commit fa8f434d44293d39b89b3b1585ae114fa1f1d549)
| -rw-r--r-- | drivers/misc/mediatek/mach/mt6735/mt_gpufreq.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/misc/mediatek/mach/mt6735/mt_gpufreq.c b/drivers/misc/mediatek/mach/mt6735/mt_gpufreq.c index 05f9094a8..dee955fe7 100644 --- a/drivers/misc/mediatek/mach/mt6735/mt_gpufreq.c +++ b/drivers/misc/mediatek/mach/mt6735/mt_gpufreq.c @@ -2698,12 +2698,22 @@ static ssize_t mt_gpufreq_fixed_freq_proc_write(struct file *file, const char __ if(fixed_freq == 0) { mt_gpufreq_fixed_freq_state = false; mt_gpufreq_fixed_frequency = 0; - } - else { - _mt_gpufreq_set_cur_freq(fixed_freq); - mt_gpufreq_fixed_freq_state = true; - mt_gpufreq_fixed_frequency = fixed_freq; - g_cur_gpu_OPPidx = 0; // keep Max Vcore + } else { + int i, found = 0; + + for (i = 0; i < mt_gpufreqs_num; i++) { + if (fixed_freq == mt_gpufreqs[i].gpufreq_khz) { + found = 1; + break; + } + } + + if (found == 1) { + _mt_gpufreq_set_cur_freq(fixed_freq); + mt_gpufreq_fixed_freq_state = true; + mt_gpufreq_fixed_frequency = fixed_freq; + g_cur_gpu_OPPidx = 0; /* keep Max Vcore */ + } } mutex_unlock(&mt_gpufreq_lock); } |
