From: kernel test robot <lkp@intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
linux-acpi@vger.kernel.org, devel@acpica.org,
linux-pm@vger.kernel.org, Zhang Rui <rui.zhang@intel.com>
Subject: [rafael-pm:bleeding-edge 43/45] drivers/thermal/thermal_sysfs.c:717:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
Date: Wed, 22 Mar 2023 06:19:09 +0800 [thread overview]
Message-ID: <202303220652.Yhopf8F0-lkp@intel.com> (raw)
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
reply other threads:[~2023-03-21 22:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202303220652.Yhopf8F0-lkp@intel.com \
--to=lkp@intel.com \
--cc=devel@acpica.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).