From: kernel test robot <lkp@intel.com>
To: Akshay Gupta <Akshay.Gupta@amd.com>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>,
Guenter Roeck <linux@roeck-us.net>,
Naveen Krishna Chatradhi <nchatrad@amd.com>
Subject: [linux-next:master 3918/4407] drivers/hwmon/sbrmi.c:211:7: warning: variable 'ret' is used uninitialized whenever switch case is taken
Date: Fri, 30 Jul 2021 21:03:31 +0800 [thread overview]
Message-ID: <202107302120.M9mjOgXZ-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2862 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 4ccc9e2db7ac33f450a1ff6ce158a71e5a81ded9
commit: 4f5b70eb322a2ab7efc7a60a572fa72e46c89f16 [3918/4407] hwmon: Add support for SB-RMI power module
config: x86_64-buildonly-randconfig-r002-20210730 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4f71f59bf3d9914188a11d0c41bedbb339d36ff5)
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/next/linux-next.git/commit/?id=4f5b70eb322a2ab7efc7a60a572fa72e46c89f16
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 4f5b70eb322a2ab7efc7a60a572fa72e46c89f16
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/hwmon/sbrmi.c:211:7: warning: variable 'ret' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
case hwmon_power_cap_max:
^~~~~~~~~~~~~~~~~~~
drivers/hwmon/sbrmi.c:217:6: note: uninitialized use occurs here
if (ret < 0)
^~~
drivers/hwmon/sbrmi.c:196:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.
vim +/ret +211 drivers/hwmon/sbrmi.c
190
191 static int sbrmi_read(struct device *dev, enum hwmon_sensor_types type,
192 u32 attr, int channel, long *val)
193 {
194 struct sbrmi_data *data = dev_get_drvdata(dev);
195 struct sbrmi_mailbox_msg msg = { 0 };
196 int ret;
197
198 if (type != hwmon_power)
199 return -EINVAL;
200
201 msg.read = true;
202 switch (attr) {
203 case hwmon_power_input:
204 msg.cmd = SBRMI_READ_PKG_PWR_CONSUMPTION;
205 ret = rmi_mailbox_xfer(data, &msg);
206 break;
207 case hwmon_power_cap:
208 msg.cmd = SBRMI_READ_PKG_PWR_LIMIT;
209 ret = rmi_mailbox_xfer(data, &msg);
210 break;
> 211 case hwmon_power_cap_max:
212 msg.data_out = data->pwr_limit_max;
213 break;
214 default:
215 return -EINVAL;
216 }
217 if (ret < 0)
218 return ret;
219 /* hwmon power attributes are in microWatt */
220 *val = (long)msg.data_out * 1000;
221 return ret;
222 }
223
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34105 bytes --]
reply other threads:[~2021-07-30 13:03 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=202107302120.M9mjOgXZ-lkp@intel.com \
--to=lkp@intel.com \
--cc=Akshay.Gupta@amd.com \
--cc=clang-built-linux@googlegroups.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-mm@kvack.org \
--cc=linux@roeck-us.net \
--cc=nchatrad@amd.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).