* [jpirko-mlxsw:linecards 45/98] drivers/platform/mellanox/mlxreg-lc.c:568:2: warning: variable 'err' is used uninitialized whenever switch default is taken
@ 2021-05-13 7:04 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-05-13 7:04 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4129 bytes --]
tree: https://github.com/jpirko/linux_mlxsw linecards
head: 0513ef364b3f13e981a6404bbb199bc614d796b0
commit: 272ecb7cd19b08c0961aba0e6e5f0e54e13110fd [45/98] platform/mellanox: mlxreg-lc: Add initial support for Mellanox line card devices
config: x86_64-randconfig-r002-20210513 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a0fed635fe1701470062495a6ffee1c608f3f1bc)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/jpirko/linux_mlxsw/commit/272ecb7cd19b08c0961aba0e6e5f0e54e13110fd
git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
git fetch --no-tags jpirko-mlxsw linecards
git checkout 272ecb7cd19b08c0961aba0e6e5f0e54e13110fd
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/platform/mellanox/mlxreg-lc.c:568:2: warning: variable 'err' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
drivers/platform/mellanox/mlxreg-lc.c:572:9: note: uninitialized use occurs here
return err;
^~~
>> drivers/platform/mellanox/mlxreg-lc.c:544:7: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (action)
^~~~~~
drivers/platform/mellanox/mlxreg-lc.c:572:9: note: uninitialized use occurs here
return err;
^~~
drivers/platform/mellanox/mlxreg-lc.c:544:3: note: remove the 'if' if its condition is always true
if (action)
^~~~~~~~~~~
drivers/platform/mellanox/mlxreg-lc.c:537:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
2 warnings generated.
vim +/err +568 drivers/platform/mellanox/mlxreg-lc.c
529
530 /*
531 * Callback is to be called from mlxreg-hotplug driver to notify about line card about received
532 * event.
533 */
534 static int mlxreg_lc_event_handler(void *handle, enum mlxreg_hotplug_kind kind, u8 action)
535 {
536 struct mlxreg_lc *mlxreg_lc = handle;
537 int err;
538
539 switch (kind) {
540 case MLXREG_HOTPLUG_LC_VERIFIED:
541 err = mlxreg_lc_power_on_off(mlxreg_lc, action);
542 break;
543 case MLXREG_HOTPLUG_LC_POWERED:
> 544 if (action)
545 err = mlxreg_lc_create_static_devices(mlxreg_lc, mlxreg_lc->aux_devs,
546 mlxreg_lc->main_devs_num);
547 else
548 mlxreg_lc_destroy_static_devices(mlxreg_lc, mlxreg_lc->aux_devs,
549 mlxreg_lc->main_devs_num);
550 break;
551 case MLXREG_HOTPLUG_LC_SYNCED:
552 if (action)
553 mlxreg_lc->state |= MLXREG_LC_SYNCED;
554 else
555 mlxreg_lc->state &= ~MLXREG_LC_SYNCED;
556 err = mlxreg_lc_enable_disable(mlxreg_lc, mlxreg_lc->state == MLXREG_LC_ENABLE);
557 break;
558 case MLXREG_HOTPLUG_LC_READY:
559 if (action)
560 mlxreg_lc->state |= MLXREG_LC_READY;
561 else
562 mlxreg_lc->state &= ~MLXREG_LC_READY;
563 err = mlxreg_lc_enable_disable(mlxreg_lc, mlxreg_lc->state == MLXREG_LC_ENABLE);
564 break;
565 case MLXREG_HOTPLUG_LC_THERMAL:
566 err = mlxreg_lc_power_on_off(mlxreg_lc, !action);
567 break;
> 568 default:
569 break;
570 }
571
572 return err;
573 }
574
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27376 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-13 7:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 7:04 [jpirko-mlxsw:linecards 45/98] drivers/platform/mellanox/mlxreg-lc.c:568:2: warning: variable 'err' is used uninitialized whenever switch default is taken kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.