:::::: 
:::::: Manual check reason: "low confidence static check warning: 
drivers/input/misc/iqs7222.c:1404:7: warning: Branch condition evaluates to a 
garbage value [clang-analyzer-core.uninitialized.Branch]"
:::::: 

CC: [email protected]
CC: [email protected]
BCC: [email protected]
CC: [email protected]
TO: Jeff LaBundy <[email protected]>
CC: Dmitry Torokhov <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   700170bf6b4d773e328fa54ebb70ba444007c702
commit: e505edaedcb9e7d16eefddc62d2189afaea0febc Input: add support for Azoteq 
IQS7222A/B/C
date:   8 weeks ago
:::::: branch date: 10 hours ago
:::::: commit date: 8 weeks ago
config: arm-randconfig-c002-20220531 
(https://download.01.org/0day-ci/archive/20220601/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
c825abd6b0198fb088d9752f556a70705bc99dfd)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e505edaedcb9e7d16eefddc62d2189afaea0febc
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout e505edaedcb9e7d16eefddc62d2189afaea0febc
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 
clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
           fbuf = list_first_entry_or_null(&sdr->queued_bufs, struct
                  ^
   include/linux/list.h:554:28: note: expanded from macro 
'list_first_entry_or_null'
           struct list_head *pos__ = READ_ONCE(head__->next); \
                                     ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 
'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long 
long),  \
                              ^
   include/linux/compiler_types.h:314:28: note: expanded from macro 
'__native_word'
            sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
                                     ^
   drivers/media/platform/rcar_drif.c:466:9: note: Taking false branch
           fbuf = list_first_entry_or_null(&sdr->queued_bufs, struct
                  ^
   include/linux/list.h:554:28: note: expanded from macro 
'list_first_entry_or_null'
           struct list_head *pos__ = READ_ONCE(head__->next); \
                                     ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:2: note: expanded from macro 
'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long 
long),  \
           ^
   include/linux/compiler_types.h:346:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:334:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:326:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/media/platform/rcar_drif.c:466:9: note: Loop condition is false.  
Exiting loop
           fbuf = list_first_entry_or_null(&sdr->queued_bufs, struct
                  ^
   include/linux/list.h:554:28: note: expanded from macro 
'list_first_entry_or_null'
           struct list_head *pos__ = READ_ONCE(head__->next); \
                                     ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:2: note: expanded from macro 
'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long 
long),  \
           ^
   include/linux/compiler_types.h:346:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:334:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:318:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   drivers/media/platform/rcar_drif.c:466:9: note: Assuming 'pos__' is not 
equal to 'head__', which participates in a condition later
           fbuf = list_first_entry_or_null(&sdr->queued_bufs, struct
                  ^
   include/linux/list.h:555:2: note: expanded from macro 
'list_first_entry_or_null'
           pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
           ^~~~~~~~~~~~~~~
   drivers/media/platform/rcar_drif.c:466:9: note: '?' condition is true
           fbuf = list_first_entry_or_null(&sdr->queued_bufs, struct
                  ^
   include/linux/list.h:555:2: note: expanded from macro 
'list_first_entry_or_null'
           pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
           ^
   drivers/media/platform/rcar_drif.c:468:6: note: Assuming 'fbuf' is non-null, 
which participates in a condition later
           if (!fbuf) {
               ^~~~~
   drivers/media/platform/rcar_drif.c:468:2: note: Taking false branch
           if (!fbuf) {
           ^
   drivers/media/platform/rcar_drif.c:480:2: note: Returning pointer (loaded 
from 'fbuf'), which participates in a condition later
           return fbuf;
           ^~~~~~~~~~~
   drivers/media/platform/rcar_drif.c:579:9: note: Returning from 
'rcar_drif_get_fbuf'
           fbuf = rcar_drif_get_fbuf(sdr);
                  ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/rcar_drif.c:580:7: note: 'fbuf' is non-null
           if (!fbuf)
                ^~~~
   drivers/media/platform/rcar_drif.c:580:2: note: Taking false branch
           if (!fbuf)
           ^
   drivers/media/platform/rcar_drif.c:583:2: note: Loop condition is true.  
Entering loop body
           for (i = 0; i < RCAR_DRIF_MAX_CHANNEL; i++)
           ^
   drivers/media/platform/rcar_drif.c:583:41: note: The value 1 is assigned to 
'i'
           for (i = 0; i < RCAR_DRIF_MAX_CHANNEL; i++)
                                                  ^~~
   drivers/media/platform/rcar_drif.c:583:2: note: Loop condition is true.  
Entering loop body
           for (i = 0; i < RCAR_DRIF_MAX_CHANNEL; i++)
           ^
   drivers/media/platform/rcar_drif.c:585:31: note: Access to field 'addr' 
results in a dereference of an undefined pointer value
                          i * sdr->hwbuf_size, buf[i]->addr, sdr->hwbuf_size);
                                               ^~~~~~~~~~~~
   Suppressed 1 warnings (1 with check filters).
   2 warnings generated.
>> drivers/input/misc/iqs7222.c:1404:7: warning: Branch condition evaluates to 
>> a garbage value [clang-analyzer-core.uninitialized.Branch]
                   if (error)
                       ^
   drivers/input/misc/iqs7222.c:2345:6: note: Assuming 'iqs7222' is non-null
           if (!iqs7222)
               ^~~~~~~~
   drivers/input/misc/iqs7222.c:2345:2: note: Taking false branch
           if (!iqs7222)
           ^
   drivers/input/misc/iqs7222.c:2352:6: note: Assuming field 'keypad' is 
non-null
           if (!iqs7222->keypad)
               ^~~~~~~~~~~~~~~~
   drivers/input/misc/iqs7222.c:2352:2: note: Taking false branch
           if (!iqs7222->keypad)
           ^
   drivers/input/misc/iqs7222.c:2364:2: note: Taking false branch
           if (IS_ERR(iqs7222->irq_gpio)) {
           ^
   drivers/input/misc/iqs7222.c:2373:2: note: Taking false branch
           if (IS_ERR(iqs7222->reset_gpio)) {
           ^
   drivers/input/misc/iqs7222.c:2381:6: note: 'error' is 0
           if (error)
               ^~~~~
   drivers/input/misc/iqs7222.c:2381:2: note: Taking false branch
           if (error)
           ^
   drivers/input/misc/iqs7222.c:2385:6: note: 'error' is 0
           if (error)
               ^~~~~
   drivers/input/misc/iqs7222.c:2385:2: note: Taking false branch
           if (error)
           ^
   drivers/input/misc/iqs7222.c:2388:10: note: Calling 'iqs7222_dev_init'
           error = iqs7222_dev_init(iqs7222, READ);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/input/misc/iqs7222.c:1334:6: note: 'error' declared without an 
initial value
           int error, i, j, k;
               ^~~~~
   drivers/input/misc/iqs7222.c:1341:6: note: Assuming 'comms_offset' is 0
           if (comms_offset) {
               ^~~~~~~~~~~~
   drivers/input/misc/iqs7222.c:1341:2: note: Taking false branch
           if (comms_offset) {
           ^
   drivers/input/misc/iqs7222.c:1357:2: note: Loop condition is true.  Entering 
loop body
           for (i = 0; i < IQS7222_NUM_REG_GRPS; i++) {
           ^
   drivers/input/misc/iqs7222.c:1364:7: note: Assuming 'num_col' is 0
                   if (!num_col)
                       ^~~~~~~~
   drivers/input/misc/iqs7222.c:1364:3: note: Taking true branch
                   if (!num_col)
                   ^
   drivers/input/misc/iqs7222.c:1365:4: note:  Execution continues on line 1357
                           continue;
                           ^
   drivers/input/misc/iqs7222.c:1357:2: note: Loop condition is true.  Entering 
loop body
           for (i = 0; i < IQS7222_NUM_REG_GRPS; i++) {
           ^
   drivers/input/misc/iqs7222.c:1364:7: note: Assuming 'num_col' is not equal 
to 0
                   if (!num_col)
                       ^~~~~~~~
   drivers/input/misc/iqs7222.c:1364:3: note: Taking false branch
                   if (!num_col)
                   ^
   drivers/input/misc/iqs7222.c:1367:9: note: Calling 'iqs7222_setup'
                   val = iqs7222_setup(iqs7222, i, 0);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/input/misc/iqs7222.c:1015:2: note: Control jumps to 'case 
IQS7222_REG_GRP_CYCLE:'  at line 1016
           switch (reg_grp) {
           ^
   drivers/input/misc/iqs7222.c:1017:3: note: Returning pointer, which 
participates in a condition later
                   return iqs7222->cycle_setup[row];
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/input/misc/iqs7222.c:1367:9: note: Returning from 'iqs7222_setup'
                   val = iqs7222_setup(iqs7222, i, 0);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/input/misc/iqs7222.c:1368:8: note: 'val' is non-null
                   if (!val)
                        ^~~
   drivers/input/misc/iqs7222.c:1368:3: note: Taking false branch
                   if (!val)
                   ^
   drivers/input/misc/iqs7222.c:1371:13: note: Calling 'kcalloc'
                   val_buf = kcalloc(num_col, sizeof(__le16), GFP_KERNEL);
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:652:9: note: Calling 'kmalloc_array'
           return kmalloc_array(n, size, flags | __GFP_ZERO);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:617:2: note: Taking false branch
           if (unlikely(check_mul_overflow(n, size, &bytes)))
           ^
   include/linux/slab.h:619:30: note: Left side of '&&' is false
           if (__builtin_constant_p(n) && __builtin_constant_p(size))
                                       ^
   include/linux/slab.h:621:2: note: Returning pointer, which participates in a 
condition later
           return __kmalloc(bytes, flags);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/slab.h:652:9: note: Returning from 'kmalloc_array'
           return kmalloc_array(n, size, flags | __GFP_ZERO);

vim +1404 drivers/input/misc/iqs7222.c

e505edaedcb9e7 Jeff LaBundy 2022-04-08  1329  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1330  static int 
iqs7222_dev_init(struct iqs7222_private *iqs7222, int dir)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1331  {
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1332    const struct iqs7222_dev_desc 
*dev_desc = iqs7222->dev_desc;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1333    int comms_offset = 
dev_desc->comms_offset;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1334    int error, i, j, k;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1335  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1336    /*
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1337     * Take advantage of the 
stop-bit disable function, if available, to
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1338     * save the trouble of having 
to reopen a communication window after
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1339     * each burst read or write.
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1340     */
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1341    if (comms_offset) {
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1342            u16 comms_setup;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1343  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1344            error = 
iqs7222_read_word(iqs7222,
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1345                                    
  IQS7222_SYS_SETUP + comms_offset,
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1346                                    
  &comms_setup);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1347            if (error)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1348                    return error;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1349  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1350            error = 
iqs7222_write_word(iqs7222,
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1351                                    
   IQS7222_SYS_SETUP + comms_offset,
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1352                                    
   comms_setup | IQS7222_COMMS_HOLD);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1353            if (error)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1354                    return error;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1355    }
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1356  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1357    for (i = 0; i < 
IQS7222_NUM_REG_GRPS; i++) {
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1358            int num_row = 
dev_desc->reg_grps[i].num_row;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1359            int num_col = 
dev_desc->reg_grps[i].num_col;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1360            u16 reg = 
dev_desc->reg_grps[i].base;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1361            __le16 *val_buf;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1362            u16 *val;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1363  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1364            if (!num_col)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1365                    continue;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1366  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1367            val = 
iqs7222_setup(iqs7222, i, 0);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1368            if (!val)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1369                    continue;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1370  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1371            val_buf = 
kcalloc(num_col, sizeof(__le16), GFP_KERNEL);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1372            if (!val_buf)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1373                    return -ENOMEM;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1374  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1375            for (j = 0; j < 
num_row; j++) {
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1376                    switch (dir) {
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1377                    case READ:
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1378                            error = 
iqs7222_read_burst(iqs7222, reg,
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1379                                    
                   val_buf, num_col);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1380                            for (k 
= 0; k < num_col; k++)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1381                                    
val[k] = le16_to_cpu(val_buf[k]);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1382                            break;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1383  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1384                    case WRITE:
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1385                            for (k 
= 0; k < num_col; k++)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1386                                    
val_buf[k] = cpu_to_le16(val[k]);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1387                            error = 
iqs7222_write_burst(iqs7222, reg,
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1388                                    
                    val_buf, num_col);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1389                            break;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1390  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1391                    default:
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1392                            error = 
-EINVAL;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1393                    }
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1394  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1395                    if (error)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1396                            break;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1397  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1398                    reg += 
IQS7222_REG_OFFSET;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1399                    val += 
iqs7222_max_cols[i];
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1400            }
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1401  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1402            kfree(val_buf);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1403  
e505edaedcb9e7 Jeff LaBundy 2022-04-08 @1404            if (error)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1405                    return error;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1406    }
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1407  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1408    if (comms_offset) {
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1409            u16 comms_setup;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1410  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1411            error = 
iqs7222_read_word(iqs7222,
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1412                                    
  IQS7222_SYS_SETUP + comms_offset,
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1413                                    
  &comms_setup);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1414            if (error)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1415                    return error;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1416  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1417            error = 
iqs7222_write_word(iqs7222,
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1418                                    
   IQS7222_SYS_SETUP + comms_offset,
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1419                                    
   comms_setup & ~IQS7222_COMMS_HOLD);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1420            if (error)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1421                    return error;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1422    }
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1423  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1424    if (dir == READ)
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1425            return 0;
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1426  
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1427    return 
iqs7222_ati_trigger(iqs7222);
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1428  }
e505edaedcb9e7 Jeff LaBundy 2022-04-08  1429  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to