Re: [PATCH] platform/x86: dell-privacy: Add support for new privacy driver

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

 



Hi Perry,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.10-rc2]
[cannot apply to next-20201103]
[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/Perry-Yuan/platform-x86-dell-privacy-Add-support-for-new-privacy-driver/20201103-205721
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b7cbaf59f62f8ab8f157698f9e31642bff525bd0
config: x86_64-randconfig-m001-20201104 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

smatch warnings:
drivers/platform/x86/dell-wmi.c:414 dell_wmi_notify() warn: inconsistent indenting
drivers/platform/x86/dell-laptop.c:2207 dell_init() warn: inconsistent indenting
drivers/platform/x86/dell-laptop.c:2289 dell_exit() warn: inconsistent indenting
drivers/platform/x86/dell-laptop.c:2291 dell_exit() warn: curly braces intended?

vim +414 drivers/platform/x86/dell-wmi.c

83fc44c32ad8b8b Pali Rohár      2014-11-11  377  
bff589be59c5092 Andy Lutomirski 2015-11-25  378  static void dell_wmi_notify(struct wmi_device *wdev,
bff589be59c5092 Andy Lutomirski 2015-11-25  379  			    union acpi_object *obj)
0b3f6109f0c9ff9 Matthew Garrett 2009-01-09  380  {
00ebbeb39b70072 Andy Lutomirski 2017-08-01  381  	struct dell_wmi_priv *priv = dev_get_drvdata(&wdev->dev);
83fc44c32ad8b8b Pali Rohár      2014-11-11  382  	u16 *buffer_entry, *buffer_end;
bff589be59c5092 Andy Lutomirski 2015-11-25  383  	acpi_size buffer_size;
83fc44c32ad8b8b Pali Rohár      2014-11-11  384  	int len, i;
0b3f6109f0c9ff9 Matthew Garrett 2009-01-09  385  
83fc44c32ad8b8b Pali Rohár      2014-11-11  386  	if (obj->type != ACPI_TYPE_BUFFER) {
83fc44c32ad8b8b Pali Rohár      2014-11-11  387  		pr_warn("bad response type %x\n", obj->type);
5ea2559726b7862 Rezwanul Kabir  2009-11-02  388  		return;
5ea2559726b7862 Rezwanul Kabir  2009-11-02  389  	}
5ea2559726b7862 Rezwanul Kabir  2009-11-02  390  
83fc44c32ad8b8b Pali Rohár      2014-11-11  391  	pr_debug("Received WMI event (%*ph)\n",
83fc44c32ad8b8b Pali Rohár      2014-11-11  392  		obj->buffer.length, obj->buffer.pointer);
83fc44c32ad8b8b Pali Rohár      2014-11-11  393  
83fc44c32ad8b8b Pali Rohár      2014-11-11  394  	buffer_entry = (u16 *)obj->buffer.pointer;
83fc44c32ad8b8b Pali Rohár      2014-11-11  395  	buffer_size = obj->buffer.length/2;
83fc44c32ad8b8b Pali Rohár      2014-11-11  396  	buffer_end = buffer_entry + buffer_size;
83fc44c32ad8b8b Pali Rohár      2014-11-11  397  
481fe5be821c3d0 Pali Rohár      2016-01-04  398  	/*
481fe5be821c3d0 Pali Rohár      2016-01-04  399  	 * BIOS/ACPI on devices with WMI interface version 0 does not clear
481fe5be821c3d0 Pali Rohár      2016-01-04  400  	 * buffer before filling it. So next time when BIOS/ACPI send WMI event
481fe5be821c3d0 Pali Rohár      2016-01-04  401  	 * which is smaller as previous then it contains garbage in buffer from
481fe5be821c3d0 Pali Rohár      2016-01-04  402  	 * previous event.
481fe5be821c3d0 Pali Rohár      2016-01-04  403  	 *
481fe5be821c3d0 Pali Rohár      2016-01-04  404  	 * BIOS/ACPI on devices with WMI interface version 1 clears buffer and
481fe5be821c3d0 Pali Rohár      2016-01-04  405  	 * sometimes send more events in buffer at one call.
481fe5be821c3d0 Pali Rohár      2016-01-04  406  	 *
481fe5be821c3d0 Pali Rohár      2016-01-04  407  	 * So to prevent reading garbage from buffer we will process only first
481fe5be821c3d0 Pali Rohár      2016-01-04  408  	 * one event on devices with WMI interface version 0.
481fe5be821c3d0 Pali Rohár      2016-01-04  409  	 */
00ebbeb39b70072 Andy Lutomirski 2017-08-01  410  	if (priv->interface_version == 0 && buffer_entry < buffer_end)
481fe5be821c3d0 Pali Rohár      2016-01-04  411  		if (buffer_end > buffer_entry + buffer_entry[0] + 1)
481fe5be821c3d0 Pali Rohár      2016-01-04  412  			buffer_end = buffer_entry + buffer_entry[0] + 1;
481fe5be821c3d0 Pali Rohár      2016-01-04  413  
83fc44c32ad8b8b Pali Rohár      2014-11-11 @414      while (buffer_entry < buffer_end) {
83fc44c32ad8b8b Pali Rohár      2014-11-11  415  
83fc44c32ad8b8b Pali Rohár      2014-11-11  416          len = buffer_entry[0];
83fc44c32ad8b8b Pali Rohár      2014-11-11  417          if (len == 0)
83fc44c32ad8b8b Pali Rohár      2014-11-11  418              break;
83fc44c32ad8b8b Pali Rohár      2014-11-11  419  
83fc44c32ad8b8b Pali Rohár      2014-11-11  420          len++;
83fc44c32ad8b8b Pali Rohár      2014-11-11  421  
83fc44c32ad8b8b Pali Rohár      2014-11-11  422          if (buffer_entry + len > buffer_end) {
83fc44c32ad8b8b Pali Rohár      2014-11-11  423              pr_warn("Invalid length of WMI event\n");
83fc44c32ad8b8b Pali Rohár      2014-11-11  424              break;
0b3f6109f0c9ff9 Matthew Garrett 2009-01-09  425          }
83fc44c32ad8b8b Pali Rohár      2014-11-11  426  
83fc44c32ad8b8b Pali Rohár      2014-11-11  427          pr_debug("Process buffer (%*ph)\n", len*2, buffer_entry);
83fc44c32ad8b8b Pali Rohár      2014-11-11  428  
83fc44c32ad8b8b Pali Rohár      2014-11-11  429          switch (buffer_entry[1]) {
e075b3c898e4055 Pali Rohár      2016-06-15  430              case 0x0000: /* One key pressed or event occurred */
e075b3c898e4055 Pali Rohár      2016-06-15  431                  if (len > 2)
0c026c361be1734 Y Paritcher     2020-06-10  432                      dell_wmi_process_key(wdev, buffer_entry[1],
bff589be59c5092 Andy Lutomirski 2015-11-25  433                              buffer_entry[2]);
83fc44c32ad8b8b Pali Rohár      2014-11-11  434                  break;
e075b3c898e4055 Pali Rohár      2016-06-15  435              case 0x0010: /* Sequence of keys pressed */
e075b3c898e4055 Pali Rohár      2016-06-15  436              case 0x0011: /* Sequence of events occurred */
83fc44c32ad8b8b Pali Rohár      2014-11-11  437                  for (i = 2; i < len; ++i)
bff589be59c5092 Andy Lutomirski 2015-11-25  438                      dell_wmi_process_key(wdev, buffer_entry[1],
e075b3c898e4055 Pali Rohár      2016-06-15  439                              buffer_entry[i]);
83fc44c32ad8b8b Pali Rohár      2014-11-11  440                  break;
cee9f60d7ca58d8 perry_yuan      2020-11-03  441              case 0x0012:
cee9f60d7ca58d8 perry_yuan      2020-11-03  442  #if IS_ENABLED(CONFIG_DELL_PRIVACY)
cee9f60d7ca58d8 perry_yuan      2020-11-03  443                  if (dell_privacy_valid()) {
cee9f60d7ca58d8 perry_yuan      2020-11-03  444                      dell_privacy_process_event(buffer_entry[1], buffer_entry[3], 
cee9f60d7ca58d8 perry_yuan      2020-11-03  445                              buffer_entry[4]);
cee9f60d7ca58d8 perry_yuan      2020-11-03  446                  } else {
cee9f60d7ca58d8 perry_yuan      2020-11-03  447                      if (len > 2)
cee9f60d7ca58d8 perry_yuan      2020-11-03  448                          dell_wmi_process_key(wdev, buffer_entry[1], buffer_entry[2]);
cee9f60d7ca58d8 perry_yuan      2020-11-03  449                  }
cee9f60d7ca58d8 perry_yuan      2020-11-03  450  #else
cee9f60d7ca58d8 perry_yuan      2020-11-03  451                  /* Extended data is currently ignored */
cee9f60d7ca58d8 perry_yuan      2020-11-03  452                  if (len > 2)
cee9f60d7ca58d8 perry_yuan      2020-11-03  453                      dell_wmi_process_key(wdev, buffer_entry[1], buffer_entry[2]);
cee9f60d7ca58d8 perry_yuan      2020-11-03  454  #endif
cee9f60d7ca58d8 perry_yuan      2020-11-03  455                  break;
e075b3c898e4055 Pali Rohár      2016-06-15  456              default: /* Unknown event */
83fc44c32ad8b8b Pali Rohár      2014-11-11  457                  pr_info("Unknown WMI event type 0x%x\n",
83fc44c32ad8b8b Pali Rohár      2014-11-11  458                          (int)buffer_entry[1]);
83fc44c32ad8b8b Pali Rohár      2014-11-11  459                  break;
0b3f6109f0c9ff9 Matthew Garrett 2009-01-09  460          }
83fc44c32ad8b8b Pali Rohár      2014-11-11  461  
83fc44c32ad8b8b Pali Rohár      2014-11-11  462          buffer_entry += len;
83fc44c32ad8b8b Pali Rohár      2014-11-11  463  
83fc44c32ad8b8b Pali Rohár      2014-11-11  464      }
83fc44c32ad8b8b Pali Rohár      2014-11-11  465  

---
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 Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux