CC: [email protected]
CC: [email protected]
CC: Linux Memory Management List <[email protected]>
TO: Christophe Branchereau <[email protected]>
CC: Jonathan Cameron <[email protected]>
CC: Paul Cercueil <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   b9011c7e671dbbf59bb753283ddfd03f0c9eb865
commit: b9e9bdd425a3c99e15f5dfd465bef936130b7491 [4086/8423] iio/adc: ingenic: 
add JZ4760 support to the sadc driver
:::::: branch date: 25 hours ago
:::::: commit date: 2 weeks ago
config: mips-randconfig-c004-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=b9e9bdd425a3c99e15f5dfd465bef936130b7491
        git remote add linux-next 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout b9e9bdd425a3c99e15f5dfd465bef936130b7491
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 
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 >>)
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   4 warnings generated.
   include/linux/list.h:808:10: warning: Access to field 'pprev' results in a 
dereference of a null pointer (loaded from variable 'h') 
[clang-analyzer-core.NullDereference]
           return !h->pprev;
                   ^
   kernel/ucount.c:244:23: note: Assuming pointer value is null
           for (iter = ucounts; iter; iter = iter->ns->ucounts) {
                                ^~~~
   kernel/ucount.c:244:2: note: Loop condition is false. Execution continues on 
line 248
           for (iter = ucounts; iter; iter = iter->ns->ucounts) {
           ^
   kernel/ucount.c:248:14: note: Passing null pointer value via 1st parameter 
'ucounts'
           put_ucounts(ucounts);
                       ^~~~~~~
   kernel/ucount.c:248:2: note: Calling 'put_ucounts'
           put_ucounts(ucounts);
           ^~~~~~~~~~~~~~~~~~~~
   kernel/ucount.c:196:6: note: Calling 'atomic_dec_and_test'
           if (atomic_dec_and_test(&ucounts->count)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/atomic-instrumented.h:543:9: note: Calling 
'arch_atomic_dec_and_test'
           return arch_atomic_dec_and_test(v);
                  ^
   include/linux/atomic-arch-fallback.h:1107:34: note: expanded from macro 
'arch_atomic_dec_and_test'
   #define arch_atomic_dec_and_test arch_atomic_dec_and_test
                                    ^
   include/linux/atomic-arch-fallback.h:1105:9: note: Assuming the condition is 
true
           return arch_atomic_dec_return(v) == 0;
                  ^
   include/linux/atomic-arch-fallback.h:529:32: note: expanded from macro 
'arch_atomic_dec_return'
   #define arch_atomic_dec_return arch_atomic_dec_return
                                  ^
   include/linux/atomic-arch-fallback.h:1105:2: note: Returning the value 1, 
which participates in a condition later
           return arch_atomic_dec_return(v) == 0;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/atomic-instrumented.h:543:9: note: Returning from 
'arch_atomic_dec_and_test'
           return arch_atomic_dec_and_test(v);
                  ^
   include/linux/atomic-arch-fallback.h:1107:34: note: expanded from macro 
'arch_atomic_dec_and_test'
   #define arch_atomic_dec_and_test arch_atomic_dec_and_test
                                    ^
   include/asm-generic/atomic-instrumented.h:543:2: note: Returning the value 
1, which participates in a condition later
           return arch_atomic_dec_and_test(v);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/ucount.c:196:6: note: Returning from 'atomic_dec_and_test'
           if (atomic_dec_and_test(&ucounts->count)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/ucount.c:196:2: note: Taking true branch
           if (atomic_dec_and_test(&ucounts->count)) {
           ^
   kernel/ucount.c:197:3: note: Loop condition is false.  Exiting loop
                   spin_lock_irqsave(&ucounts_lock, flags);
                   ^
   include/linux/spinlock.h:384:2: note: expanded from macro 'spin_lock_irqsave'
           raw_spin_lock_irqsave(spinlock_check(lock), flags);     \
           ^
   include/linux/spinlock.h:250:2: note: expanded from macro 
'raw_spin_lock_irqsave'
           do {                                            \
           ^
   kernel/ucount.c:197:3: note: Loop condition is false.  Exiting loop
                   spin_lock_irqsave(&ucounts_lock, flags);
                   ^
   include/linux/spinlock.h:382:43: note: expanded from macro 
'spin_lock_irqsave'
   #define spin_lock_irqsave(lock, flags)                          \
                                                                   ^
   kernel/ucount.c:198:18: note: Passing null pointer value via 1st parameter 
'n'
                   hlist_del_init(&ucounts->node);
                                  ^~~~~~~~~~~~~~
   kernel/ucount.c:198:3: note: Calling 'hlist_del_init'
                   hlist_del_init(&ucounts->node);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:865:22: note: Passing null pointer value via 1st 
parameter 'h'
           if (!hlist_unhashed(n)) {
                               ^
   include/linux/list.h:865:7: note: Calling 'hlist_unhashed'
           if (!hlist_unhashed(n)) {
                ^~~~~~~~~~~~~~~~~
   include/linux/list.h:808:10: note: Access to field 'pprev' results in a 
dereference of a null pointer (loaded from variable 'h')
           return !h->pprev;
                   ^
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   4 warnings generated.
   drivers/iio/adc/bcm_iproc_adc.c:120:17: warning: Value stored to 'dev' 
during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct device *dev = &indio_dev->dev;
                          ^~~   ~~~~~~~~~~~~~~~
   drivers/iio/adc/bcm_iproc_adc.c:120:17: note: Value stored to 'dev' during 
its initialization is never read
           struct device *dev = &indio_dev->dev;
                          ^~~   ~~~~~~~~~~~~~~~
   Suppressed 3 warnings (3 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.
   4 warnings generated.
>> drivers/iio/adc/ingenic-adc.c:657:3: warning: 3rd function call argument is 
>> an uninitialized value [clang-analyzer-core.CallAndMessage]
                   ingenic_adc_set_config(adc, JZ_ADC_REG_CFG_AUX_MD, cmd);
                   ^
   drivers/iio/adc/ingenic-adc.c:691:2: note: Control jumps to 'case 
IIO_CHAN_INFO_RAW:'  at line 692
           switch (m) {
           ^
   drivers/iio/adc/ingenic-adc.c:693:10: note: Calling 
'ingenic_adc_read_chan_info_raw'
                   return ingenic_adc_read_chan_info_raw(iio_dev, chan, val);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/ingenic-adc.c:632:6: note: 'cmd' declared without an initial 
value
           int cmd, ret, engine = (chan->channel == INGENIC_ADC_BATTERY);
               ^~~
   drivers/iio/adc/ingenic-adc.c:632:26: note: Assuming field 'channel' is not 
equal to INGENIC_ADC_BATTERY
           int cmd, ret, engine = (chan->channel == INGENIC_ADC_BATTERY);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/ingenic-adc.c:636:6: note: Assuming 'ret' is 0
           if (ret) {
               ^~~
   drivers/iio/adc/ingenic-adc.c:636:2: note: Taking false branch
           if (ret) {
           ^
   drivers/iio/adc/ingenic-adc.c:644:6: note: Assuming field 'has_aux_md' is 
not equal to 0
           if (adc->soc_data->has_aux_md && engine == 0) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/ingenic-adc.c:644:6: note: Left side of '&&' is true
   drivers/iio/adc/ingenic-adc.c:644:35: note: 'engine' is equal to 0
           if (adc->soc_data->has_aux_md && engine == 0) {
                                            ^~~~~~
   drivers/iio/adc/ingenic-adc.c:644:2: note: Taking true branch
           if (adc->soc_data->has_aux_md && engine == 0) {
           ^
   drivers/iio/adc/ingenic-adc.c:645:3: note: 'Default' branch taken. Execution 
continues on line 657
                   switch (chan->channel) {
                   ^
   drivers/iio/adc/ingenic-adc.c:657:3: note: 3rd function call argument is an 
uninitialized value
                   ingenic_adc_set_config(adc, JZ_ADC_REG_CFG_AUX_MD, cmd);
                   ^                                                  ~~~
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   5 warnings generated.
   drivers/gpio/gpio-adnp.c:385:28: warning: The result of the left shift is 
undefined due to shifting by '4294967292', which is greater or equal to the 
width of type 'int' [clang-analyzer-core.UndefinedBinaryOperatorResult]
           unsigned int num_regs = 1 << adnp->reg_shift, i;
                                     ^
   drivers/gpio/gpio-adnp.c:498:6: note: 'err' is >= 0
           if (err < 0)
               ^~~
   drivers/gpio/gpio-adnp.c:498:2: note: Taking false branch
           if (err < 0)
           ^
   drivers/gpio/gpio-adnp.c:502:6: note: Assuming field 'irq' is not equal to 0
           if (!client->irq)
               ^~~~~~~~~~~~
   drivers/gpio/gpio-adnp.c:502:2: note: Taking false branch
           if (!client->irq)
           ^
   drivers/gpio/gpio-adnp.c:506:6: note: Assuming 'adnp' is non-null
           if (!adnp)
               ^~~~~
   drivers/gpio/gpio-adnp.c:506:2: note: Taking false branch
           if (!adnp)
           ^
   drivers/gpio/gpio-adnp.c:509:2: note: Loop condition is false.  Exiting loop
           mutex_init(&adnp->i2c_lock);
           ^
   include/linux/mutex.h:113:32: note: expanded from macro 'mutex_init'
   #define mutex_init(mutex)                                               \
                                                                           ^
   drivers/gpio/gpio-adnp.c:512:8: note: Calling 'adnp_gpio_setup'
           err = adnp_gpio_setup(adnp, num_gpios,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpio/gpio-adnp.c:446:2: note: The value 4294967292 is assigned to 
field 'reg_shift'
           adnp->reg_shift = get_count_order(num_gpios) - 3;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpio/gpio-adnp.c:454:2: note: Taking true branch
           if (IS_ENABLED(CONFIG_DEBUG_FS))
           ^
   drivers/gpio/gpio-adnp.c:464:6: note: 'is_irq_controller' is true
           if (is_irq_controller) {
               ^~~~~~~~~~~~~~~~~
   drivers/gpio/gpio-adnp.c:464:2: note: Taking true branch

vim +657 drivers/iio/adc/ingenic-adc.c

1a78daea107ddb Artur Rojek            2019-02-04  627  
1a99dc467943c0 Artur Rojek            2020-07-19  628  static int 
ingenic_adc_read_chan_info_raw(struct iio_dev *iio_dev,
1a78daea107ddb Artur Rojek            2019-02-04  629                           
          struct iio_chan_spec const *chan,
a515d648850546 Artur Rojek            2019-07-27  630                           
          int *val)
1a78daea107ddb Artur Rojek            2019-02-04  631  {
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  632   int cmd, ret, engine = 
(chan->channel == INGENIC_ADC_BATTERY);
1a99dc467943c0 Artur Rojek            2020-07-19  633   struct ingenic_adc *adc 
= iio_priv(iio_dev);
1a99dc467943c0 Artur Rojek            2020-07-19  634  
1a99dc467943c0 Artur Rojek            2020-07-19  635   ret = 
clk_enable(adc->clk);
1a99dc467943c0 Artur Rojek            2020-07-19  636   if (ret) {
1a99dc467943c0 Artur Rojek            2020-07-19  637           
dev_err(iio_dev->dev.parent, "Failed to enable clock: %d\n",
1a99dc467943c0 Artur Rojek            2020-07-19  638                   ret);
1a99dc467943c0 Artur Rojek            2020-07-19  639           return ret;
1a99dc467943c0 Artur Rojek            2020-07-19  640   }
1a78daea107ddb Artur Rojek            2019-02-04  641  
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  642   /* We cannot sample the 
aux channels in parallel. */
a515d648850546 Artur Rojek            2019-07-27  643   
mutex_lock(&adc->aux_lock);
9c5eb724f96f8d Christophe Branchereau 2021-07-26  644   if 
(adc->soc_data->has_aux_md && engine == 0) {
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  645           switch 
(chan->channel) {
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  646           case 
INGENIC_ADC_AUX0:
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  647                   cmd = 0;
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  648                   break;
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  649           case 
INGENIC_ADC_AUX:
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  650                   cmd = 1;
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  651                   break;
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  652           case 
INGENIC_ADC_AUX2:
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  653                   cmd = 2;
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  654                   break;
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  655           }
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  656  
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26 @657           
ingenic_adc_set_config(adc, JZ_ADC_REG_CFG_AUX_MD, cmd);
1a78daea107ddb Artur Rojek            2019-02-04  658   }
1a78daea107ddb Artur Rojek            2019-02-04  659  
a515d648850546 Artur Rojek            2019-07-27  660   ret = 
ingenic_adc_capture(adc, engine);
a515d648850546 Artur Rojek            2019-07-27  661   if (ret)
a515d648850546 Artur Rojek            2019-07-27  662           goto out;
a515d648850546 Artur Rojek            2019-07-27  663  
1a78daea107ddb Artur Rojek            2019-02-04  664   switch (chan->channel) {
b9e9bdd425a3c9 Christophe Branchereau 2021-07-26  665   case INGENIC_ADC_AUX0:
1a78daea107ddb Artur Rojek            2019-02-04  666   case INGENIC_ADC_AUX:
a515d648850546 Artur Rojek            2019-07-27  667   case INGENIC_ADC_AUX2:
1a78daea107ddb Artur Rojek            2019-02-04  668           *val = 
readw(adc->base + JZ_ADC_REG_ADSDAT);
1a78daea107ddb Artur Rojek            2019-02-04  669           break;
1a78daea107ddb Artur Rojek            2019-02-04  670   case 
INGENIC_ADC_BATTERY:
1a78daea107ddb Artur Rojek            2019-02-04  671           *val = 
readw(adc->base + JZ_ADC_REG_ADBDAT);
1a78daea107ddb Artur Rojek            2019-02-04  672           break;
1a78daea107ddb Artur Rojek            2019-02-04  673   }
1a78daea107ddb Artur Rojek            2019-02-04  674  
a515d648850546 Artur Rojek            2019-07-27  675   ret = IIO_VAL_INT;
a515d648850546 Artur Rojek            2019-07-27  676  out:
a515d648850546 Artur Rojek            2019-07-27  677   
mutex_unlock(&adc->aux_lock);
1a99dc467943c0 Artur Rojek            2020-07-19  678   clk_disable(adc->clk);
1a78daea107ddb Artur Rojek            2019-02-04  679  
a515d648850546 Artur Rojek            2019-07-27  680   return ret;
a515d648850546 Artur Rojek            2019-07-27  681  }
a515d648850546 Artur Rojek            2019-07-27  682  

---
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