CC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Miquel Raynal <[email protected]>
TO: Jonathan Cameron <[email protected]>
TO: "Lars-Peter Clausen" <[email protected]>
TO: [email protected]
TO: [email protected]
CC: Thomas Petazzoni <[email protected]>
CC: Nuno Sa <[email protected]>
CC: Miquel Raynal <[email protected]>

Hi Miquel,

I love your patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on v5.14 next-20210910]
[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/Miquel-Raynal/Bring-external-triggers-support-to-MAX1027-like-ADCs/20210903-052051
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
:::::: branch date: 10 days ago
:::::: commit date: 10 days ago
config: riscv-randconfig-c006-20210912 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
261cbe98c38f8c1ee1a482fe76511110e790f58a)
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
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # 
https://github.com/0day-ci/linux/commit/c7eb401f67f651ff6cbc2f926431dddd5c725c1a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Miquel-Raynal/Bring-external-triggers-support-to-MAX1027-like-ADCs/20210903-052051
        git checkout c7eb401f67f651ff6cbc2f926431dddd5c725c1a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 
clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
                   if (ap) {
                       ^~
   drivers/ata/libahci.c:1933:3: note: Taking true branch
                   if (ap) {
                   ^
   drivers/ata/libahci.c:1934:4: note: Calling 'ahci_port_intr'
                           ahci_port_intr(ap);
                           ^~~~~~~~~~~~~~~~~~
   drivers/ata/libahci.c:1896:11: note: Loop condition is false.  Exiting loop
           status = readl(port_mmio + PORT_IRQ_STAT);
                    ^
   arch/riscv/include/asm/mmio.h:140:30: note: expanded from macro 'readl'
   #define readl(c)        ({ u32 __v; __io_br(); __v = readl_cpu(c); 
__io_ar(__v); __v; })
                                       ^
   arch/riscv/include/asm/mmio.h:133:19: note: expanded from macro '__io_br'
   #define __io_br()       do {} while (0)
                           ^
   drivers/ata/libahci.c:1899:2: note: Calling 'ahci_handle_port_interrupt'
           ahci_handle_port_interrupt(ap, port_mmio, status);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/ata/libahci.c:1813:19: note: Assuming the condition is true
           int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/ata/libahci.c:1818:2: note: Taking false branch
           if (unlikely(resetting))
           ^
   drivers/ata/libahci.c:1821:6: note: Assuming the condition is false
           if (sata_lpm_ignore_phy_events(&ap->link)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/ata/libahci.c:1821:2: note: Taking false branch
           if (sata_lpm_ignore_phy_events(&ap->link)) {
           ^
   drivers/ata/libahci.c:1826:6: note: Assuming the condition is false
           if (unlikely(status & PORT_IRQ_ERROR)) {
               ^
   include/linux/compiler.h:78:40: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                             ^~~~
   drivers/ata/libahci.c:1826:2: note: Taking true branch
           if (unlikely(status & PORT_IRQ_ERROR)) {
           ^
   drivers/ata/libahci.c:1827:3: note: Calling 'ahci_error_intr'
                   ahci_error_intr(ap, status);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/ata/libahci.c:1705:2: note: 'serror' declared without an initial 
value
           u32 serror;
           ^~~~~~~~~~
   drivers/ata/libahci.c:1708:6: note: Assuming field 'fbs_enabled' is false
           if (pp->fbs_enabled) {
               ^~~~~~~~~~~~~~~
   drivers/ata/libahci.c:1708:2: note: Taking false branch
           if (pp->fbs_enabled) {
           ^
   drivers/ata/libahci.c:1719:3: note: Loop condition is false. Execution 
continues on line 1723
                   ata_for_each_link(link, ap, EDGE)
                   ^
   include/linux/libata.h:1678:2: note: expanded from macro 'ata_for_each_link'
           for ((link) = ata_link_next(NULL, (ap), ATA_LITER_##mode); (link); \
           ^
   drivers/ata/libahci.c:1723:7: note: 'link' is null
           if (!link)
                ^~~~
   drivers/ata/libahci.c:1723:2: note: Taking true branch
           if (!link)
           ^
   drivers/ata/libahci.c:1734:2: note: Calling 'ahci_scr_read'
           ahci_scr_read(&ap->link, SCR_ERROR, &serror);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/ata/libahci.c:603:6: note: Assuming 'offset' is 0
           if (offset) {
               ^~~~~~
   drivers/ata/libahci.c:603:2: note: Taking false branch
           if (offset) {
           ^
   drivers/ata/libahci.c:607:2: note: Returning without writing to '*val'
           return -EINVAL;
           ^
   drivers/ata/libahci.c:1734:2: note: Returning from 'ahci_scr_read'
           ahci_scr_read(&ap->link, SCR_ERROR, &serror);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/ata/libahci.c:1735:2: note: 3rd function call argument is an 
uninitialized value
           ahci_scr_write(&ap->link, SCR_ERROR, serror);
           ^                                    ~~~~~~
   Suppressed 10 warnings (10 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   9 warnings generated.
   drivers/iio/adc/max1027.c:251:8: warning: Excessive padding in 'struct 
max1027_state' (83 padding bytes, where 19 is optimal). 
   Optimal fields order: 
   reg, 
   info, 
   spi, 
   trig, 
   buffer, 
   lock, 
   consider reordering the fields or adding explicit padding members 
[clang-analyzer-optin.performance.Padding]
   struct max1027_state {
   ~~~~~~~^~~~~~~~~~~~~~~
   drivers/iio/adc/max1027.c:251:8: note: Excessive padding in 'struct 
max1027_state' (83 padding bytes, where 19 is optimal). Optimal fields order: 
reg, info, spi, trig, buffer, lock, consider reordering the fields or adding 
explicit padding members
   struct max1027_state {
   ~~~~~~~^~~~~~~~~~~~~~~
>> drivers/iio/adc/max1027.c:398:14: warning: The result of the left shift is 
>> undefined because the left operand is negative 
>> [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   st->reg |= MAX1027_CHAN(fls(*indio_dev->active_scan_mask) - 
2);
                              ^
   drivers/iio/adc/max1027.c:38:32: note: expanded from macro 'MAX1027_CHAN'
   #define MAX1027_CHAN(n)   ((n) << 3)
                              ~~~ ^
   drivers/iio/adc/max1027.c:385:6: note: Assuming 'state' is true
           if (state) {
               ^~~~~
   drivers/iio/adc/max1027.c:385:2: note: Taking true branch
           if (state) {
           ^
   drivers/iio/adc/max1027.c:390:7: note: Assuming 'ret' is >= 0
                   if (ret < 0)
                       ^~~~~~~
   drivers/iio/adc/max1027.c:390:3: note: Taking false branch
                   if (ret < 0)
                   ^
   drivers/iio/adc/max1027.c:398:14: note: The result of the left shift is 
undefined because the left operand is negative
                   st->reg |= MAX1027_CHAN(fls(*indio_dev->active_scan_mask) - 
2);
                              ^
   drivers/iio/adc/max1027.c:38:32: note: expanded from macro 'MAX1027_CHAN'
   #define MAX1027_CHAN(n)   ((n) << 3)
                              ~~~ ^
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   10 warnings generated.
   drivers/iio/adc/max11100.c:31:8: warning: Excessive padding in 'struct 
max11100_state' (117 padding bytes, where 53 is optimal). 
   Optimal fields order: 
   buffer, 
   vref_reg, 
   spi, 
   consider reordering the fields or adding explicit padding members 
[clang-analyzer-optin.performance.Padding]
   struct max11100_state {
   ~~~~~~~^~~~~~~~~~~~~~~~
   drivers/iio/adc/max11100.c:31:8: note: Excessive padding in 'struct 
max11100_state' (117 padding bytes, where 53 is optimal). Optimal fields order: 
buffer, vref_reg, spi, consider reordering the fields or adding explicit 
padding members
   struct max11100_state {
   ~~~~~~~^~~~~~~~~~~~~~~~
   Suppressed 9 warnings (9 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   10 warnings generated.
   drivers/iio/adc/max1241.c:22:8: warning: Excessive padding in 'struct 
max1241' (82 padding bytes, where 18 is optimal). 
   Optimal fields order: 
   data, 
   spi, 
   vdd, 
   vref, 
   shutdown, 
   lock, 
   consider reordering the fields or adding explicit padding members 
[clang-analyzer-optin.performance.Padding]
   struct max1241 {
   ~~~~~~~^~~~~~~~~
   drivers/iio/adc/max1241.c:22:8: note: Excessive padding in 'struct max1241' 
(82 padding bytes, where 18 is optimal). Optimal fields order: data, spi, vdd, 
vref, shutdown, lock, consider reordering the fields or adding explicit padding 
members
   struct max1241 {
   ~~~~~~~^~~~~~~~~
   Suppressed 9 warnings (9 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   8 warnings generated.
   Suppressed 8 warnings (8 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   9 warnings generated.
   Suppressed 9 warnings (9 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   8 warnings generated.
   Suppressed 8 warnings (8 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   8 warnings generated.
   Suppressed 8 warnings (8 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   8 warnings generated.
   Suppressed 8 warnings (8 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   8 warnings generated.
   Suppressed 8 warnings (8 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   9 warnings generated.
   drivers/hwmon/lm63.c:1017:17: warning: Value stored to 'dev' during its 
initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = &client->dev;
                          ^~~   ~~~~~~~~~~~~
   drivers/hwmon/lm63.c:1017:17: note: Value stored to 'dev' during its 
initialization is never read
           struct device *dev = &client->dev;
                          ^~~   ~~~~~~~~~~~~
   Suppressed 8 warnings (8 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   9 warnings generated.
   drivers/hwmon/lm73.c:76:62: warning: The result of the left shift is 
undefined because the left operand is negative 
[clang-analyzer-core.UndefinedBinaryOperatorResult]
           value = clamp_val(temp / 250, LM73_TEMP_MIN, LM73_TEMP_MAX) << 5;
                                                                       ^
   drivers/hwmon/lm73.c:65:41: note: Left side of '&&' is false
           struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
                                                  ^
   include/linux/hwmon-sysfs.h:17:2: note: expanded from macro 
'to_sensor_dev_attr'
           container_of(_dev_attr, struct sensor_device_attribute, dev_attr)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'

vim +398 drivers/iio/adc/max1027.c

fc167f62483325 Philippe Reynes 2014-06-14  378  
fc167f62483325 Philippe Reynes 2014-06-14  379  static int 
max1027_set_trigger_state(struct iio_trigger *trig, bool state)
fc167f62483325 Philippe Reynes 2014-06-14  380  {
fc167f62483325 Philippe Reynes 2014-06-14  381          struct iio_dev 
*indio_dev = iio_trigger_get_drvdata(trig);
fc167f62483325 Philippe Reynes 2014-06-14  382          struct max1027_state 
*st = iio_priv(indio_dev);
fc167f62483325 Philippe Reynes 2014-06-14  383          int ret;
fc167f62483325 Philippe Reynes 2014-06-14  384  
fc167f62483325 Philippe Reynes 2014-06-14  385          if (state) {
fc167f62483325 Philippe Reynes 2014-06-14  386                  /* Start 
acquisition on cnvst */
fc167f62483325 Philippe Reynes 2014-06-14  387                  st->reg = 
MAX1027_SETUP_REG | MAX1027_CKS_MODE0 |
fc167f62483325 Philippe Reynes 2014-06-14  388                            
MAX1027_REF_MODE2;
fc167f62483325 Philippe Reynes 2014-06-14  389                  ret = 
spi_write(st->spi, &st->reg, 1);
fc167f62483325 Philippe Reynes 2014-06-14  390                  if (ret < 0)
fc167f62483325 Philippe Reynes 2014-06-14  391                          return 
ret;
fc167f62483325 Philippe Reynes 2014-06-14  392  
c7eb401f67f651 Miquel Raynal   2021-09-02  393                  /*
c7eb401f67f651 Miquel Raynal   2021-09-02  394                   * Scan from 
chan 0 to the highest requested channel.
c7eb401f67f651 Miquel Raynal   2021-09-02  395                   * Include 
temperature on demand.
c7eb401f67f651 Miquel Raynal   2021-09-02  396                   */
c7eb401f67f651 Miquel Raynal   2021-09-02  397                  st->reg = 
MAX1027_CONV_REG | MAX1027_SCAN_0_N;
c7eb401f67f651 Miquel Raynal   2021-09-02 @398                  st->reg |= 
MAX1027_CHAN(fls(*indio_dev->active_scan_mask) - 2);
c7eb401f67f651 Miquel Raynal   2021-09-02  399                  if 
(*indio_dev->active_scan_mask & MAX1X27_SCAN_MASK_TEMP)
c7eb401f67f651 Miquel Raynal   2021-09-02  400                          st->reg 
|= MAX1027_TEMP;
c7eb401f67f651 Miquel Raynal   2021-09-02  401  
fc167f62483325 Philippe Reynes 2014-06-14  402                  ret = 
spi_write(st->spi, &st->reg, 1);
fc167f62483325 Philippe Reynes 2014-06-14  403                  if (ret < 0)
fc167f62483325 Philippe Reynes 2014-06-14  404                          return 
ret;
fc167f62483325 Philippe Reynes 2014-06-14  405          } else {
fc167f62483325 Philippe Reynes 2014-06-14  406                  /* Start 
acquisition on conversion register write */
fc167f62483325 Philippe Reynes 2014-06-14  407                  st->reg = 
MAX1027_SETUP_REG | MAX1027_CKS_MODE2 |
fc167f62483325 Philippe Reynes 2014-06-14  408                            
MAX1027_REF_MODE2;
fc167f62483325 Philippe Reynes 2014-06-14  409                  ret = 
spi_write(st->spi, &st->reg, 1);
fc167f62483325 Philippe Reynes 2014-06-14  410                  if (ret < 0)
fc167f62483325 Philippe Reynes 2014-06-14  411                          return 
ret;
fc167f62483325 Philippe Reynes 2014-06-14  412          }
fc167f62483325 Philippe Reynes 2014-06-14  413  
fc167f62483325 Philippe Reynes 2014-06-14  414          return 0;
fc167f62483325 Philippe Reynes 2014-06-14  415  }
fc167f62483325 Philippe Reynes 2014-06-14  416  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to