* [rafael-pm:bleeding-edge 43/45] drivers/thermal/thermal_sysfs.c:717:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
@ 2023-03-21 22:19 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-03-21 22:19 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: llvm, oe-kbuild-all, linux-acpi, devel, linux-pm, Zhang Rui
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head: 98fe6903f79cffbb0f271369f62f4e5fea0e978c
commit: 9b3fc1c6ba14f12e819e9d44c72013a1da58c0d9 [43/45] thermal: core: Introduce thermal_cooling_device_update()
config: i386-randconfig-a001-20230320 (https://download.01.org/0day-ci/archive/20230322/202303220652.Yhopf8F0-lkp@intel.com/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=9b3fc1c6ba14f12e819e9d44c72013a1da58c0d9
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 9b3fc1c6ba14f12e819e9d44c72013a1da58c0d9
# 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=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/thermal/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303220652.Yhopf8F0-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/thermal/thermal_sysfs.c:717:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!stats)
^~~~~~
drivers/thermal/thermal_sysfs.c:727:9: note: uninitialized use occurs here
return ret;
^~~
drivers/thermal/thermal_sysfs.c:717:2: note: remove the 'if' if its condition is always false
if (!stats)
^~~~~~~~~~~
drivers/thermal/thermal_sysfs.c:712:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.
vim +717 drivers/thermal/thermal_sysfs.c
706
707 static ssize_t total_trans_show(struct device *dev,
708 struct device_attribute *attr, char *buf)
709 {
710 struct thermal_cooling_device *cdev = to_cooling_device(dev);
711 struct cooling_dev_stats *stats;
712 int ret;
713
714 mutex_lock(&cdev->lock);
715
716 stats = cdev->stats;
> 717 if (!stats)
718 goto unlock;
719
720 spin_lock(&stats->lock);
721 ret = sprintf(buf, "%u\n", stats->total_trans);
722 spin_unlock(&stats->lock);
723
724 unlock:
725 mutex_unlock(&cdev->lock);
726
727 return ret;
728 }
729
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-21 22:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 22:19 [rafael-pm:bleeding-edge 43/45] drivers/thermal/thermal_sysfs.c:717:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).