All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 3918/4407] drivers/hwmon/sbrmi.c:211:7: warning: variable 'ret' is used uninitialized whenever switch case is taken
@ 2021-07-30 13:03 ` kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-07-30 13:03 UTC (permalink / raw)
  To: Akshay Gupta
  Cc: clang-built-linux, kbuild-all, Linux Memory Management List,
	Guenter Roeck, Naveen Krishna Chatradhi

[-- 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 --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [linux-next:master 3918/4407] drivers/hwmon/sbrmi.c:211:7: warning: variable 'ret' is used uninitialized whenever switch case is taken
@ 2021-07-30 13:03 ` kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-07-30 13:03 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2935 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 --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-next:master 3918/4407] drivers/hwmon/sbrmi.c:211:7: warning: variable 'ret' is used uninitialized whenever switch case is taken
  2021-07-30 13:03 ` kernel test robot
@ 2021-07-30 18:17   ` Guenter Roeck
  -1 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2021-07-30 18:17 UTC (permalink / raw)
  To: Akshay Gupta; +Cc: kbuild-all, Naveen Krishna Chatradhi, linux-hwmon

On 7/30/21 6:03 AM, kernel test robot wrote:
> 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.
> 

There is no need to send an updated patch; I fixed this up.

Thanks,
Guenter

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-next:master 3918/4407] drivers/hwmon/sbrmi.c:211:7: warning: variable 'ret' is used uninitialized whenever switch case is taken
@ 2021-07-30 18:17   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2021-07-30 18:17 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3268 bytes --]

On 7/30/21 6:03 AM, kernel test robot wrote:
> 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.
> 

There is no need to send an updated patch; I fixed this up.

Thanks,
Guenter

> 
> 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(a)lists.01.org
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-next:master 3918/4407] drivers/hwmon/sbrmi.c:211:7: warning: variable 'ret' is used uninitialized whenever switch case is taken
  2021-07-30 18:17   ` Guenter Roeck
  (?)
@ 2021-07-30 18:52   ` Naveen Krishna Ch
  -1 siblings, 0 replies; 5+ messages in thread
From: Naveen Krishna Ch @ 2021-07-30 18:52 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4004 bytes --]

Thank you Guenter.

On Fri, 30 Jul, 2021, 11:50 pm Guenter Roeck, <linux@roeck-us.net> wrote:

> On 7/30/21 6:03 AM, kernel test robot wrote:
> > 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.
> >
>
> There is no need to send an updated patch; I fixed this up.
>
> Thanks,
> Guenter
>
> >
> > 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(a)lists.01.org
> >
>
>

[-- Attachment #2: attachment.htm --]
[-- Type: text/html, Size: 5988 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-30 18:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 13:03 [linux-next:master 3918/4407] drivers/hwmon/sbrmi.c:211:7: warning: variable 'ret' is used uninitialized whenever switch case is taken kernel test robot
2021-07-30 13:03 ` kernel test robot
2021-07-30 18:17 ` Guenter Roeck
2021-07-30 18:17   ` Guenter Roeck
2021-07-30 18:52   ` Naveen Krishna Ch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.