Hi Moritz,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.0-rc1 next-20190108]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:    
https://github.com/0day-ci/linux/commits/Moritz-Fischer/platform-chrome-Add-cros_ec_readmem-helpers-for-I2C-SPI-based-ECs/20190108-184758
config: x86_64-randconfig-x005-201901 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/list.h:9:0,
                    from include/linux/kobject.h:19,
                    from include/linux/cdev.h:5,
                    from include/linux/mfd/cros_ec.h:19,
                    from drivers/platform/chrome/cros_ec_proto.c:17:
   drivers/platform/chrome/cros_ec_proto.c: In function 'cros_ec_readmem':
   include/linux/kernel.h:846:29: warning: comparison of distinct pointer types 
lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:860:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:870:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:886:19: note: in expansion of macro '__careful_cmp'
    #define max(x, y) __careful_cmp(x, y, >)
                      ^~~~~~~~~~~~~
>> drivers/platform/chrome/cros_ec_proto.c:650:31: note: in expansion of macro 
>> 'max'
     msg = kzalloc(sizeof(*msg) + max(sizeof(*params), bytes), GFP_KERNEL);
                                  ^~~

vim +/max +650 drivers/platform/chrome/cros_ec_proto.c

   639  
   640  int cros_ec_readmem(struct cros_ec_device *ec, unsigned int offset,
   641                      unsigned int bytes, void *dest)
   642  {
   643          int ret;
   644          struct ec_params_read_memmap *params;
   645          struct cros_ec_command *msg;
   646  
   647          if (offset >= EC_MEMMAP_SIZE - bytes)
   648                  return -EINVAL;
   649  
 > 650          msg = kzalloc(sizeof(*msg) + max(sizeof(*params), bytes), 
 > GFP_KERNEL);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to