CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: "Václav Kubernát" <[email protected]>
CC: "Václav Kubernát" <[email protected]>
CC: Jean Delvare <[email protected]>
CC: Guenter Roeck <[email protected]>
CC: Jonathan Corbet <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]

Hi "Václav,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on hwmon/hwmon-next]
[also build test WARNING on v5.12-rc7 next-20210413]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/0day-ci/linux/commits/V-clav-Kubern-t/hwmon-max31790-Rework-to-use-regmap/20210413-110343
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git 
hwmon-next
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago
config: x86_64-randconfig-m001-20210413 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

New smatch warnings:
drivers/hwmon/max31790.c:191 max31790_read_fan() error: testing array offset 
'channel' after use.

Old smatch warnings:
drivers/hwmon/max31790.c:199 max31790_read_fan() error: testing array offset 
'channel' after use.

vim +/channel +191 drivers/hwmon/max31790.c

1abcccc3f14415 Václav Kubernát 2021-04-13  159  
54187ff9d766b2 Guenter Roeck   2016-07-01  160  static int 
max31790_read_fan(struct device *dev, u32 attr, int channel,
54187ff9d766b2 Guenter Roeck   2016-07-01  161                               
long *val)
195a4b4298a795 Il Han          2015-08-30  162  {
1abcccc3f14415 Václav Kubernát 2021-04-13  163          struct max31790_data 
*data = dev_get_drvdata(dev);
1abcccc3f14415 Václav Kubernát 2021-04-13  164          struct regmap *regmap = 
data->regmap;
1abcccc3f14415 Václav Kubernát 2021-04-13  165          int tach, fault;
195a4b4298a795 Il Han          2015-08-30  166  
54187ff9d766b2 Guenter Roeck   2016-07-01  167          switch (attr) {
54187ff9d766b2 Guenter Roeck   2016-07-01  168          case hwmon_fan_input:
8f9d7c0c9b7368 Václav Kubernát 2021-04-13  169                  if 
(!(data->fan_config[channel] & MAX31790_FAN_CFG_TACH_INPUT_EN))
8f9d7c0c9b7368 Václav Kubernát 2021-04-13  170                          return 
-ENODATA;
8f9d7c0c9b7368 Václav Kubernát 2021-04-13  171  
1abcccc3f14415 Václav Kubernát 2021-04-13  172                  tach = 
read_reg_word(regmap, MAX31790_REG_TACH_COUNT(channel));
1abcccc3f14415 Václav Kubernát 2021-04-13  173                  if (tach < 0)
1abcccc3f14415 Václav Kubernát 2021-04-13  174                          return 
tach;
1abcccc3f14415 Václav Kubernát 2021-04-13  175  
1abcccc3f14415 Václav Kubernát 2021-04-13  176                  *val = 
RPM_FROM_REG(tach, get_tach_period(data->fan_dynamics[channel]));
54187ff9d766b2 Guenter Roeck   2016-07-01  177                  return 0;
54187ff9d766b2 Guenter Roeck   2016-07-01  178          case hwmon_fan_target:
1abcccc3f14415 Václav Kubernát 2021-04-13  179                  tach = 
read_reg_word(regmap, MAX31790_REG_TARGET_COUNT(channel));
1abcccc3f14415 Václav Kubernát 2021-04-13  180                  if (tach < 0)
1abcccc3f14415 Václav Kubernát 2021-04-13  181                          return 
tach;
1abcccc3f14415 Václav Kubernát 2021-04-13  182  
1abcccc3f14415 Václav Kubernát 2021-04-13  183                  *val = 
RPM_FROM_REG(tach, get_tach_period(data->fan_dynamics[channel]));
54187ff9d766b2 Guenter Roeck   2016-07-01  184                  return 0;
54187ff9d766b2 Guenter Roeck   2016-07-01  185          case hwmon_fan_fault:
8f9d7c0c9b7368 Václav Kubernát 2021-04-13  186                  if 
(!(data->fan_config[channel] & MAX31790_FAN_CFG_TACH_INPUT_EN)) {
8f9d7c0c9b7368 Václav Kubernát 2021-04-13  187                          *val = 
0;
8f9d7c0c9b7368 Václav Kubernát 2021-04-13  188                          return 
0;
8f9d7c0c9b7368 Václav Kubernát 2021-04-13  189                  }
8f9d7c0c9b7368 Václav Kubernát 2021-04-13  190  
1abcccc3f14415 Václav Kubernát 2021-04-13 @191                  if (channel > 6)
1abcccc3f14415 Václav Kubernát 2021-04-13  192                          fault = 
read_reg_byte(regmap, MAX31790_REG_FAN_FAULT_STATUS2);
1abcccc3f14415 Václav Kubernát 2021-04-13  193                  else
1abcccc3f14415 Václav Kubernát 2021-04-13  194                          fault = 
read_reg_byte(regmap, MAX31790_REG_FAN_FAULT_STATUS1);
1abcccc3f14415 Václav Kubernát 2021-04-13  195  
1abcccc3f14415 Václav Kubernát 2021-04-13  196                  if (fault < 0)
1abcccc3f14415 Václav Kubernát 2021-04-13  197                          return 
fault;
1abcccc3f14415 Václav Kubernát 2021-04-13  198  
1abcccc3f14415 Václav Kubernát 2021-04-13  199                  if (channel > 6)
1abcccc3f14415 Václav Kubernát 2021-04-13  200                          *val = 
!!(fault & (1 << (channel - 6)));
1abcccc3f14415 Václav Kubernát 2021-04-13  201                  else
1abcccc3f14415 Václav Kubernát 2021-04-13  202                          *val = 
!!(fault & (1 << channel));
54187ff9d766b2 Guenter Roeck   2016-07-01  203                  return 0;
269f53ac2552b9 Václav Kubernát 2021-04-13  204          case hwmon_fan_enable:
269f53ac2552b9 Václav Kubernát 2021-04-13  205                  *val = 
!!(data->fan_config[channel] & MAX31790_FAN_CFG_TACH_INPUT_EN);
269f53ac2552b9 Václav Kubernát 2021-04-13  206                  return 0;
54187ff9d766b2 Guenter Roeck   2016-07-01  207          default:
54187ff9d766b2 Guenter Roeck   2016-07-01  208                  return 
-EOPNOTSUPP;
195a4b4298a795 Il Han          2015-08-30  209          }
195a4b4298a795 Il Han          2015-08-30  210  }
195a4b4298a795 Il Han          2015-08-30  211  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to