Re: [PATCH V4] hwmon: add fan/pwm driver for corsair h100i platinum

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

 



Hi jaap,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on hwmon/hwmon-next]
[also build test WARNING on v5.8 next-20200814]
[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/jaap-aarts/hwmon-add-fan-pwm-driver-for-corsair-h100i-platinum/20200816-085929
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
config: nios2-randconfig-c003-20200816 (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2 

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/corsair_hydro_i_pro.c: In function 'hwmon_init':
>> drivers/hwmon/corsair_hydro_i_pro.c:529:17: warning: variable 'hwmon_dev' set but not used [-Wunused-but-set-variable]
     529 |  struct device *hwmon_dev;
         |                 ^~~~~~~~~
   drivers/hwmon/corsair_hydro_i_pro.c: In function 'init_device':
>> drivers/hwmon/corsair_hydro_i_pro.c:584:3: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
     584 |   ;
         |   ^

vim +/hwmon_dev +529 drivers/hwmon/corsair_hydro_i_pro.c

   525	
   526	static void hwmon_init(struct hydro_i_pro_device *hdev)
   527	{
   528		u8 fan_id;
 > 529		struct device *hwmon_dev;
   530		struct hwmon_fan_data *fan;
   531		struct hwmon_data *data = devm_kzalloc(
   532			&hdev->udev->dev, sizeof(struct hwmon_data), GFP_KERNEL);
   533		struct hwmon_chip_info *hwmon_info = devm_kzalloc(
   534			&hdev->udev->dev, sizeof(struct hwmon_chip_info), GFP_KERNEL);
   535	
   536		/* You did something bad!! Either adjust  max_fan_count or the fancount for the config!*/
   537		WARN_ON(hdev->config->fancount >= max_pwm_channel_count);
   538		data->channel_count = hdev->config->fancount;
   539	
   540		/* For each fan create a data channel a fan config entry and a pwm config entry */
   541		for (fan_id = 0; fan_id < data->channel_count; fan_id++) {
   542			fan = devm_kzalloc(&hdev->udev->dev,
   543					   sizeof(struct hwmon_fan_data), GFP_KERNEL);
   544			fan->fan_channel = fan_id;
   545			fan->mode = 0;
   546			data->channel_data[fan_id] = fan;
   547		}
   548	
   549		hwmon_info->ops = &i_pro_ops;
   550		hwmon_info->info = hdev->config->hwmon_info;
   551	
   552		data->hdev = hdev;
   553		hwmon_dev = devm_hwmon_device_register_with_info(
   554			&hdev->udev->dev, hdev->config->name, data, hwmon_info, NULL);
   555		dev_info(&hdev->udev->dev, "setup hwmon for %s\n", hdev->config->name);
   556	}
   557	
   558	const int USB_VENDOR_ID_CORSAIR = 0x1b1c;
   559	const int USB_PRODUCT_ID_H100I_PRO = 0x0c15;
   560	/*
   561	 * Devices that work with this driver.
   562	 * More devices should work, however none have been tested.
   563	 */
   564	static const struct usb_device_id astk_table[] = {
   565		{ USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_PRODUCT_ID_H100I_PRO),
   566		  .driver_info = (kernel_ulong_t)&config_table[0] },
   567		{},
   568	};
   569	
   570	MODULE_DEVICE_TABLE(usb, astk_table);
   571	
   572	static int init_device(struct usb_device *udev)
   573	{
   574		int retval;
   575	
   576		/*
   577		 * This is needed because when running windows in a vm with proprietary driver
   578		 * and you switch to this driver, the device will not respond unless you run this.
   579		 */
   580		retval = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x40,
   581					 0xffff, 0x0000, 0, 0, 0);
   582		/*this always returns error*/
   583		if (retval)
 > 584			;
   585	
   586		retval = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x02, 0x40,
   587					 0x0002, 0x0000, 0, 0, 0);
   588		return retval;
   589	}
   590	

---
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 Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux