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

cpufreq: s3c64xx: Remove pointless NULL check in s3c64xx_cpufreq_driver_init

When building with Clang + -Wtautological-pointer-compare:

drivers/cpufreq/s3c64xx-cpufreq.c:152:6: warning: comparison of array
's3c64xx_freq_table' equal to a null pointer is always false
[-Wtautological-pointer-compare]
if (s3c64xx_freq_table == NULL) {
^~~~~~~~~~~~~~~~~~ ~~~~
1 warning generated.

The definition of s3c64xx_freq_table is surrounded by an ifdef
directive for CONFIG_CPU_S3C6410, which is always true for this driver
because it depends on it in drivers/cpufreq/Kconfig.arm (and if it
weren't, there would be a build error because s3c64xx_freq_table would
not be a defined symbol).

Resolve this warning by removing the unnecessary NULL check because it
is always false as Clang notes. While we are at it, remove the
unnecessary ifdef conditional because it is always true.

Fixes: b3748ddd8056 ("[ARM] S3C64XX: Initial support for DVFS")
Link: https://github.com/ClangBuiltLinux/linux/issues/748
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

authored by

Nathan Chancellor and committed by
Viresh Kumar
e458eb97 af44d180

-7
-7
drivers/cpufreq/s3c64xx-cpufreq.c
··· 19 19 static struct regulator *vddarm; 20 20 static unsigned long regulator_latency; 21 21 22 - #ifdef CONFIG_CPU_S3C6410 23 22 struct s3c64xx_dvfs { 24 23 unsigned int vddarm_min; 25 24 unsigned int vddarm_max; ··· 47 48 { 0, 4, 800000 }, 48 49 { 0, 0, CPUFREQ_TABLE_END }, 49 50 }; 50 - #endif 51 51 52 52 static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy, 53 53 unsigned int index) ··· 146 148 147 149 if (policy->cpu != 0) 148 150 return -EINVAL; 149 - 150 - if (s3c64xx_freq_table == NULL) { 151 - pr_err("No frequency information for this CPU\n"); 152 - return -ENODEV; 153 - } 154 151 155 152 policy->clk = clk_get(NULL, "armclk"); 156 153 if (IS_ERR(policy->clk)) {