]> www.infradead.org Git - users/hch/misc.git/commitdiff
cpufreq: mediatek: avoid redundant conditions
authorLiao Yuanhong <liaoyuanhong@vivo.com>
Wed, 3 Sep 2025 12:12:27 +0000 (20:12 +0800)
committerViresh Kumar <viresh.kumar@linaro.org>
Thu, 4 Sep 2025 04:50:44 +0000 (10:20 +0530)
While 'if (i <= 0) ... else if (i > 0) ...' is technically equivalent to
'if (i <= 0) ... else ...', the latter is vastly easier to read because
it avoids writing out a condition that is unnecessary. Let's drop such
unnecessary conditions.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/mediatek-cpufreq.c

index fae062a6431fb6cc26e780a097f44b806a1eeb21..00de1166188ab7c61255ef65ccba71d010b0dd21 100644 (file)
@@ -123,7 +123,7 @@ static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info,
                                                      soc_data->sram_max_volt);
                                return ret;
                        }
-               } else if (pre_vproc > new_vproc) {
+               } else {
                        vproc = max(new_vproc,
                                    pre_vsram - soc_data->max_volt_shift);
                        ret = regulator_set_voltage(proc_reg, vproc,