[rafael-pm:bleeding-edge 173/175] drivers/thermal/intel/intel_powerclamp.c:422:6: warning: variable 'update' is used uninitialized whenever 'if' condition is false

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head:   f24bb5858fe63bcdab4f0680e7648f907304789c
commit: da0e3490ff71f89e5d3438ae0b2e412d543eab11 [173/175] thermal: intel: powerclamp: Use powercap idle-inject feature
config: x86_64-randconfig-a003 (https://download.01.org/0day-ci/archive/20230203/202302030328.3iKhirHI-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?id=da0e3490ff71f89e5d3438ae0b2e412d543eab11
        git remote add rafael-pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
        git fetch --no-tags rafael-pm bleeding-edge
        git checkout da0e3490ff71f89e5d3438ae0b2e412d543eab11
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/thermal/intel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/thermal/intel/intel_powerclamp.c:422:6: warning: variable 'update' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (!(powerclamp_data.count % powerclamp_data.window_size_now)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/thermal/intel/intel_powerclamp.c:430:6: note: uninitialized use occurs here
           if (update) {
               ^~~~~~
   drivers/thermal/intel/intel_powerclamp.c:422:2: note: remove the 'if' if its condition is always true
           if (!(powerclamp_data.count % powerclamp_data.window_size_now)) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/thermal/intel/intel_powerclamp.c:416:13: note: initialize the variable 'update' to silence this warning
           bool update;
                      ^
                       = 0
   1 warning generated.


vim +422 drivers/thermal/intel/intel_powerclamp.c

   408	
   409	/*
   410	 * This function is called from idle injection core on timer expiry
   411	 * for the run duration. This allows powerclamp to readjust or skip
   412	 * injecting idle for this cycle.
   413	 */
   414	static bool idle_inject_update(void)
   415	{
   416		bool update;
   417	
   418		/* We can't sleep in this callback */
   419		if (!mutex_trylock(&powerclamp_lock))
   420			return true;
   421	
 > 422		if (!(powerclamp_data.count % powerclamp_data.window_size_now)) {
   423	
   424			should_skip = powerclamp_adjust_controls(powerclamp_data.target_ratio,
   425								 powerclamp_data.guard,
   426								 powerclamp_data.window_size_now);
   427			update = true;
   428		}
   429	
   430		if (update) {
   431			unsigned int runtime = get_run_time();
   432	
   433			idle_inject_set_duration(ii_dev, runtime, duration);
   434		}
   435	
   436		powerclamp_data.count++;
   437	
   438		mutex_unlock(&powerclamp_lock);
   439	
   440		if (should_skip)
   441			return false;
   442	
   443		return true;
   444	}
   445	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux