[linux-next:master 3918/4407] drivers/hwmon/sbrmi.c:211:7: warning: variable 'ret' is used uninitialized whenever switch case is taken

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

 



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@xxxxxxxxx>

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@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux