CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Vadim Pasternak <[email protected]>
CC: Jiri Pirko <[email protected]>

tree:   https://github.com/jpirko/linux_mlxsw jiri_devel_linecards
head:   2f768899ec7db92c6c3bf9528b87a8e997159a6f
commit: d8568c67d454465d37e13b0400c487138db6d8db [55/57] mlxsw: core_thermal: 
Add interfaces for line card initialization and de-initialization
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: i386-randconfig-c001 
(https://download.01.org/0day-ci/archive/20220114/[email protected]/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
244dd2913a43a200f5a6544d424cdc37b771028b)
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
        # 
https://github.com/jpirko/linux_mlxsw/commit/d8568c67d454465d37e13b0400c487138db6d8db
        git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
        git fetch --no-tags jpirko-mlxsw jiri_devel_linecards
        git checkout d8568c67d454465d37e13b0400c487138db6d8db
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 
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 >>)
   lib/ts_fsm.c:155:32: note: expanded from macro 'end_of_data'
   #define end_of_data() unlikely(block_idx >= block_len && !GET_NEXT_BLOCK())
                                  ^~~~~~~~~
   include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                             ^
   include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
                           ______r = __builtin_expect(!!(x), expect);      \
                                                         ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                                
        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   lib/ts_fsm.c:219:8: note: Left side of '&&' is false
                           if (end_of_data())
                               ^
   lib/ts_fsm.c:155:55: note: expanded from macro 'end_of_data'
   #define end_of_data() unlikely(block_idx >= block_len && !GET_NEXT_BLOCK())
                                                         ^
   lib/ts_fsm.c:219:8: note: 'block_idx' is < 'block_len'
                           if (end_of_data())
                               ^
   lib/ts_fsm.c:155:32: note: expanded from macro 'end_of_data'
   #define end_of_data() unlikely(block_idx >= block_len && !GET_NEXT_BLOCK())
                                  ^~~~~~~~~
   include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
   #  define unlikely(x)   (__branch_check__(x, 0, __builtin_constant_p(x)))
                                                                        ^
   include/linux/compiler.h:35:19: note: expanded from macro '__branch_check__'
                                                expect, is_constant);      \
                                                        ^~~~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                                
        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   lib/ts_fsm.c:219:8: note: Left side of '&&' is false
                           if (end_of_data())
                               ^
   lib/ts_fsm.c:155:55: note: expanded from macro 'end_of_data'
   #define end_of_data() unlikely(block_idx >= block_len && !GET_NEXT_BLOCK())
                                                         ^
   lib/ts_fsm.c:219:4: note: '?' condition is false
                           if (end_of_data())
                           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   lib/ts_fsm.c:219:4: note: Taking false branch
                           if (end_of_data())
                           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   lib/ts_fsm.c:222:24: note: Passing null pointer value via 1st parameter 't'
                           while (!match_token(next, data[block_idx])) {
                                               ^~~~
   lib/ts_fsm.c:222:12: note: Calling 'match_token'
                           while (!match_token(next, data[block_idx])) {
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/ts_fsm.c:128:2: note: Access to field 'type' results in a dereference of 
a null pointer (loaded from variable 't')
           if (t->type)
           ^
   include/linux/compiler.h:56:46: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                ^~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                      ^~~~
   1 warning generated.
   arch/x86/kernel/cpu/mce/core.c:315:4: warning: Value stored to 'apei_err' is 
never read [clang-analyzer-deadcode.DeadStores]
                           apei_err = apei_write_mce(final);
                           ^          ~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/cpu/mce/core.c:315:4: note: Value stored to 'apei_err' is 
never read
                           apei_err = apei_write_mce(final);
                           ^          ~~~~~~~~~~~~~~~~~~~~~
   2 warnings generated.
   drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:1126:2: warning: Value 
stored to 'linecards' is never read [clang-analyzer-deadcode.DeadStores]
           linecards = linecard->linecards;
           ^           ~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:1126:2: note: Value 
stored to 'linecards' is never read
           linecards = linecard->linecards;
           ^           ~~~~~~~~~~~~~~~~~~~
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
>> drivers/net/ethernet/mellanox/mlxsw/core_thermal.c:984:3: warning: Value 
>> stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
                   err = -ENOMEM;
                   ^     ~~~~~~~
   drivers/net/ethernet/mellanox/mlxsw/core_thermal.c:984:3: note: Value stored 
to 'err' is never read
                   err = -ENOMEM;
                   ^     ~~~~~~~
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   Suppressed 1 warnings (1 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.
   2 warnings generated.
   kernel/bpf/syscall.c:4127:2: warning: Value stored to 'err' is never read 
[clang-analyzer-deadcode.DeadStores]
           err = 0;
           ^     ~
   kernel/bpf/syscall.c:4127:2: note: Value stored to 'err' is never read
           err = 0;
           ^     ~
   Suppressed 1 warnings (1 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.
   kernel/bpf/verifier.c:1739:9: warning: 3rd function call argument is an 
uninitialized value [clang-analyzer-core.CallAndMessage]
           return bsearch(&desc, tab->descs, tab->nr_descs,
                  ^
   kernel/bpf/verifier.c:1848:6: note: Assuming 'tab' is null
           if (!tab) {
               ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                      ^~~~
   kernel/bpf/verifier.c:1848:2: note: '?' condition is false
           if (!tab) {
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                 ^
   kernel/bpf/verifier.c:1848:7: note: 'tab' is null
           if (!tab) {
                ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                                
        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   kernel/bpf/verifier.c:1848:2: note: '?' condition is true
           if (!tab) {
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   kernel/bpf/verifier.c:1848:2: note: Taking true branch
           if (!tab) {
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   kernel/bpf/verifier.c:1849:7: note: Assuming 'btf_vmlinux' is non-null
                   if (!btf_vmlinux) {
                       ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                      ^~~~
   kernel/bpf/verifier.c:1849:3: note: '?' condition is false
                   if (!btf_vmlinux) {
                   ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                 ^
   kernel/bpf/verifier.c:1849:8: note: 'btf_vmlinux' is non-null
                   if (!btf_vmlinux) {
                        ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : 
__trace_if_value(cond))
                                                                                
        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \

vim +/err +984 drivers/net/ethernet/mellanox/mlxsw/core_thermal.c

f14f4e621b1b4a Vadim Pasternak 2019-06-24   952  
d8568c67d45446 Vadim Pasternak 2021-05-12   953  static void
d8568c67d45446 Vadim Pasternak 2021-05-12   954  
mlxsw_thermal_got_active(struct mlxsw_core *mlxsw_core, u8 slot_index,
d8568c67d45446 Vadim Pasternak 2021-05-12   955                          const 
struct mlxsw_linecard *linecard, void *priv)
d8568c67d45446 Vadim Pasternak 2021-05-12   956  {
d8568c67d45446 Vadim Pasternak 2021-05-12   957         struct 
mlxsw_env_gearbox_sensors_map map;
d8568c67d45446 Vadim Pasternak 2021-05-12   958         struct mlxsw_thermal 
*thermal = priv;
d8568c67d45446 Vadim Pasternak 2021-05-12   959         struct 
mlxsw_thermal_area *lc;
d8568c67d45446 Vadim Pasternak 2021-05-12   960         int err;
d8568c67d45446 Vadim Pasternak 2021-05-12   961  
d8568c67d45446 Vadim Pasternak 2021-05-12   962         lc = 
kzalloc(sizeof(*lc), GFP_KERNEL);
d8568c67d45446 Vadim Pasternak 2021-05-12   963         if (!lc)
d8568c67d45446 Vadim Pasternak 2021-05-12   964                 return;
d8568c67d45446 Vadim Pasternak 2021-05-12   965  
d8568c67d45446 Vadim Pasternak 2021-05-12   966         lc->slot_index = 
slot_index;
d8568c67d45446 Vadim Pasternak 2021-05-12   967         lc->parent = thermal;
d8568c67d45446 Vadim Pasternak 2021-05-12   968         
thermal->linecards[slot_index - 1] = lc;
d8568c67d45446 Vadim Pasternak 2021-05-12   969         err = 
mlxsw_thermal_modules_init(thermal->bus_info->dev, thermal->core,
d8568c67d45446 Vadim Pasternak 2021-05-12   970                                 
         thermal, lc);
d8568c67d45446 Vadim Pasternak 2021-05-12   971         if (err)
d8568c67d45446 Vadim Pasternak 2021-05-12   972                 goto 
err_thermal_linecard_modules_init;
d8568c67d45446 Vadim Pasternak 2021-05-12   973  
d8568c67d45446 Vadim Pasternak 2021-05-12   974         err = 
mlxsw_env_sensor_map_create(thermal->core, thermal->bus_info,
d8568c67d45446 Vadim Pasternak 2021-05-12   975                                 
          linecard->slot_index, &map);
d8568c67d45446 Vadim Pasternak 2021-05-12   976         if (err)
d8568c67d45446 Vadim Pasternak 2021-05-12   977                 goto 
err_thermal_linecard_env_sensor_map_create;
d8568c67d45446 Vadim Pasternak 2021-05-12   978  
d8568c67d45446 Vadim Pasternak 2021-05-12   979         lc->gearbox_sensor_map 
= map.sensor_bit_map;
d8568c67d45446 Vadim Pasternak 2021-05-12   980         lc->tz_gearbox_num = 
map.sensor_count;
d8568c67d45446 Vadim Pasternak 2021-05-12   981         lc->tz_gearbox_arr = 
kcalloc(lc->tz_gearbox_num, sizeof(*lc->tz_gearbox_arr),
d8568c67d45446 Vadim Pasternak 2021-05-12   982                                 
     GFP_KERNEL);
d8568c67d45446 Vadim Pasternak 2021-05-12   983         if 
(!lc->tz_gearbox_arr) {
d8568c67d45446 Vadim Pasternak 2021-05-12  @984                 err = -ENOMEM;
d8568c67d45446 Vadim Pasternak 2021-05-12   985                 goto 
err_tz_gearbox_arr_alloc;
d8568c67d45446 Vadim Pasternak 2021-05-12   986         }
d8568c67d45446 Vadim Pasternak 2021-05-12   987  
d8568c67d45446 Vadim Pasternak 2021-05-12   988         err = 
mlxsw_thermal_gearboxes_init(thermal->bus_info->dev, thermal->core,
d8568c67d45446 Vadim Pasternak 2021-05-12   989                                 
           thermal, lc);
d8568c67d45446 Vadim Pasternak 2021-05-12   990         if (err)
d8568c67d45446 Vadim Pasternak 2021-05-12   991                 goto 
err_thermal_linecard_gearboxes_init;
d8568c67d45446 Vadim Pasternak 2021-05-12   992  
d8568c67d45446 Vadim Pasternak 2021-05-12   993         return;
d8568c67d45446 Vadim Pasternak 2021-05-12   994  
d8568c67d45446 Vadim Pasternak 2021-05-12   995  
err_thermal_linecard_gearboxes_init:
d8568c67d45446 Vadim Pasternak 2021-05-12   996         
kfree(lc->tz_gearbox_arr);
d8568c67d45446 Vadim Pasternak 2021-05-12   997  err_tz_gearbox_arr_alloc:
d8568c67d45446 Vadim Pasternak 2021-05-12   998         
mlxsw_env_sensor_map_destroy(thermal->bus_info,
d8568c67d45446 Vadim Pasternak 2021-05-12   999                                 
     lc->gearbox_sensor_map);
d8568c67d45446 Vadim Pasternak 2021-05-12  1000  
err_thermal_linecard_env_sensor_map_create:
d8568c67d45446 Vadim Pasternak 2021-05-12  1001         
mlxsw_thermal_modules_fini(thermal, lc);
d8568c67d45446 Vadim Pasternak 2021-05-12  1002  
err_thermal_linecard_modules_init:
d8568c67d45446 Vadim Pasternak 2021-05-12  1003         kfree(lc);
d8568c67d45446 Vadim Pasternak 2021-05-12  1004         
thermal->linecards[slot_index - 1] = NULL;
d8568c67d45446 Vadim Pasternak 2021-05-12  1005  }
d8568c67d45446 Vadim Pasternak 2021-05-12  1006  

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

Reply via email to