This error is seen in build of type "minsize":

In function 'power_init_for_setting_freq',
        drivers/power/intel_pstate/intel_pstate_cpufreq.c:205:30:
        error: 'max_non_turbo' may be used uninitialized
                [-Werror=maybe-uninitialized]
drivers/power/intel_pstate/intel_pstate_cpufreq.c:122:18:
        note: 'max_non_turbo' was declared here
  122 |         uint64_t max_non_turbo;

It looks to be a compiler issue because we are not supposed
to reach this point in case of power_read_turbo_pct() failure.

The variable is initialized to allow compiling with "minsize" option.

Signed-off-by: Thomas Monjalon <[email protected]>
---
 drivers/power/intel_pstate/intel_pstate_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/intel_pstate/intel_pstate_cpufreq.c 
b/drivers/power/intel_pstate/intel_pstate_cpufreq.c
index eba50b2874..8e27570e3c 100644
--- a/drivers/power/intel_pstate/intel_pstate_cpufreq.c
+++ b/drivers/power/intel_pstate/intel_pstate_cpufreq.c
@@ -119,7 +119,7 @@ power_init_for_setting_freq(struct pstate_power_info *pi)
        FILE *f_base = NULL, *f_base_min = NULL, *f_base_max = NULL,
             *f_min = NULL, *f_max = NULL;
        uint32_t base_ratio, base_min_ratio, base_max_ratio;
-       uint64_t max_non_turbo;
+       uint64_t max_non_turbo = 0;
        int ret;
 
        /* open all files we expect to have open */
-- 
2.52.0

Reply via email to