Re: [PATCH v3] HID: hid-goodix: Add Goodix HID-over-SPI driver

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

 



Hi Dan,

Thank you. Dmitry has pointed this out.

Charles.

On Mon, Jun 10, 2024 at 12:39:54PM +0300, Dan Carpenter wrote:
> Hi Charles,
> 
> kernel test robot noticed the following build warnings:
> 
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Charles-Wang/HID-hid-goodix-Add-Goodix-HID-over-SPI-driver/20240607-214042
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
> patch link:    https://lore.kernel.org/r/20240607133709.3518-1-charles.goodix%40gmail.com
> patch subject: [PATCH v3] HID: hid-goodix: Add Goodix HID-over-SPI driver
> config: sparc64-randconfig-r071-20240609 (https://download.01.org/0day-ci/archive/20240610/202406101633.1RJnij1Y-lkp@xxxxxxxxx/config)
> compiler: sparc64-linux-gcc (GCC) 13.2.0
> 
> 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>
> | Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> | Closes: https://lore.kernel.org/r/202406101633.1RJnij1Y-lkp@xxxxxxxxx/
> 
> smatch warnings:
> drivers/hid/hid-goodix-spi.c:217 goodix_hid_parse() error: uninitialized symbol 'rdesc'.
> 
> vim +/rdesc +217 drivers/hid/hid-goodix-spi.c
> 
> bb11c3a1740813 Charles Wang 2024-06-07  214  static int goodix_hid_parse(struct hid_device *hid)
> bb11c3a1740813 Charles Wang 2024-06-07  215  {
> bb11c3a1740813 Charles Wang 2024-06-07  216  	struct goodix_ts_data *ts = hid->driver_data;
> bb11c3a1740813 Charles Wang 2024-06-07 @217  	u8 *rdesc __free(kfree);
> bb11c3a1740813 Charles Wang 2024-06-07  218  	u16 rsize;
> bb11c3a1740813 Charles Wang 2024-06-07  219  	int error;
> bb11c3a1740813 Charles Wang 2024-06-07  220  
> bb11c3a1740813 Charles Wang 2024-06-07  221  	rsize = le16_to_cpu(ts->hid_desc.report_desc_lenght);
> bb11c3a1740813 Charles Wang 2024-06-07  222  	if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) {
> bb11c3a1740813 Charles Wang 2024-06-07  223  		dev_err(ts->dev, "invalid report desc size %d", rsize);
> bb11c3a1740813 Charles Wang 2024-06-07  224  		return -EINVAL;
>                                                         ^^^^^^^^^^^^^^^
> rdesc isn't initialized here.  It should be declared as:
> 
> 	u8 *rdesc __free(kfree) = NULL;
> 
> bb11c3a1740813 Charles Wang 2024-06-07  225  	}
> bb11c3a1740813 Charles Wang 2024-06-07  226  
> bb11c3a1740813 Charles Wang 2024-06-07  227  	rdesc = kzalloc(rsize, GFP_KERNEL);
> 
> Or it could be declared here instead.
> 
> 	u8 *rdesc __free(kfree) = kzalloc(rsize, GFP_KERNEL);
> 
> bb11c3a1740813 Charles Wang 2024-06-07  228  	if (!rdesc)
> bb11c3a1740813 Charles Wang 2024-06-07  229  		return -ENOMEM;
> bb11c3a1740813 Charles Wang 2024-06-07  230  
> bb11c3a1740813 Charles Wang 2024-06-07  231  	error = goodix_spi_read(ts, GOODIX_HID_REPORT_DESC_ADDR, rdesc, rsize);
> bb11c3a1740813 Charles Wang 2024-06-07  232  	if (error) {
> bb11c3a1740813 Charles Wang 2024-06-07  233  		dev_err(ts->dev, "failed get report desc, %d", error);
> bb11c3a1740813 Charles Wang 2024-06-07  234  		return error;
> bb11c3a1740813 Charles Wang 2024-06-07  235  	}
> bb11c3a1740813 Charles Wang 2024-06-07  236  
> bb11c3a1740813 Charles Wang 2024-06-07  237  	error = hid_parse_report(hid, rdesc, rsize);
> bb11c3a1740813 Charles Wang 2024-06-07  238  	if (error)
> bb11c3a1740813 Charles Wang 2024-06-07  239  		dev_err(ts->dev, "failed parse report, %d", error);
> bb11c3a1740813 Charles Wang 2024-06-07  240  
> bb11c3a1740813 Charles Wang 2024-06-07  241  	return error;
> bb11c3a1740813 Charles Wang 2024-06-07  242  }
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
> 




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux