Re: [PATCH] hwmon: max31790: support to config PWM as TACH

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

 



Hi Delphine,

kernel test robot noticed the following build warnings:

[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on linus/master v6.5 next-20230908]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Delphine-CC-Chiu/hwmon-max31790-support-to-config-PWM-as-TACH/20230906-165344
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link:    https://lore.kernel.org/r/20230906084837.3043030-3-Delphine_CC_Chiu%40wiwynn.com
patch subject: [PATCH] hwmon: max31790: support to config PWM as TACH
config: x86_64-randconfig-161-20230907 (https://download.01.org/0day-ci/archive/20230909/202309090228.2bSFmAO8-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230909/202309090228.2bSFmAO8-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309090228.2bSFmAO8-lkp@xxxxxxxxx/

smatch warnings:
drivers/hwmon/max31790.c:511 max31790_config_pwm_as_tach() warn: unsigned 'fan_config' is never less than zero.

vim +/fan_config +511 drivers/hwmon/max31790.c

   482	
   483	static int max31790_config_pwm_as_tach(struct device *dev,
   484					       struct i2c_client *client)
   485	{
   486		struct device_node *np = dev->of_node;
   487		int i, ret = 0, size, channel;
   488		u8 pwm_index[NR_CHANNEL] = { 0 };
   489		u8 fan_config;
   490	
   491		size = of_property_count_u8_elems(np, "pwm-as-tach");
   492	
   493		if ((size > 0) && (size <= NR_CHANNEL)) {
   494			ret = of_property_read_u8_array(np, "pwm-as-tach", pwm_index,
   495							size);
   496			if (ret) {
   497				dev_err(dev,
   498					"Property 'pwm-as-tach' cannot be read.\n");
   499				return ret;
   500			}
   501	
   502			for (i = 0; i < size; i++) {
   503				if ((pwm_index[i] == 0) ||
   504				    (pwm_index[i] > NR_CHANNEL)) {
   505					continue;
   506				}
   507	
   508				channel = pwm_index[i] - 1;
   509				fan_config = i2c_smbus_read_byte_data(
   510					client, MAX31790_REG_FAN_CONFIG(channel));
 > 511				if (fan_config < 0) {
   512					dev_err(dev,
   513						"Read fan config for channel %d failed.\n",
   514						channel);
   515					return fan_config;
   516				}
   517	
   518				fan_config |= (MAX31790_FAN_CFG_CTRL_MON |
   519					       MAX31790_FAN_CFG_TACH_INPUT);
   520				i2c_smbus_write_byte_data(
   521					client, MAX31790_REG_FAN_CONFIG(channel),
   522					fan_config);
   523			}
   524		}
   525	
   526		return 0;
   527	}
   528	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux