[net-next:master 2085/2098] drivers/net/netdevsim/dev.c:1680:7: error: variable 'ret' is used uninitialized whenever 'if' condition is false
From: kernel test robot <hidden>
Date: 2021-11-01 21:43:12
Also in:
netdev, oe-kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master head: d4a07dc5ac34528f292a4f328cf3c65aba312e1b commit: 1c401078bcf34e91e183b61b2d926972fc03b548 [2085/2098] netdevsim: move details of vf config to dev config: hexagon-buildonly-randconfig-r005-20211101 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 264d3b6d4e08401c5b50a85bd76e80b3461d77e6) 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://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=1c401078bcf34e91e183b61b2d926972fc03b548 git remote add net-next https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git git fetch --no-tags net-next master git checkout 1c401078bcf34e91e183b61b2d926972fc03b548 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <redacted> All errors (new ones prefixed by >>):
quoted
drivers/net/netdevsim/dev.c:1680:7: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (num_vfs) {
^~~~~~~
drivers/net/netdevsim/dev.c:1694:9: note: uninitialized use occurs here
return ret;
^~~
drivers/net/netdevsim/dev.c:1680:3: note: remove the 'if' if its condition is always true
if (num_vfs) {
^~~~~~~~~~~~~
drivers/net/netdevsim/dev.c:1679:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (nsim_esw_mode_is_switchdev(nsim_dev)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/netdevsim/dev.c:1694:9: note: uninitialized use occurs here
return ret;
^~~
drivers/net/netdevsim/dev.c:1679:2: note: remove the 'if' if its condition is always true
if (nsim_esw_mode_is_switchdev(nsim_dev)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/netdevsim/dev.c:1662:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
2 errors generated.
vim +1680 drivers/net/netdevsim/dev.c
1657
1658 int nsim_drv_configure_vfs(struct nsim_bus_dev *nsim_bus_dev,
1659 unsigned int num_vfs)
1660 {
1661 struct nsim_dev *nsim_dev = dev_get_drvdata(&nsim_bus_dev->dev);
1662 int ret;
1663
1664 mutex_lock(&nsim_dev->vfs_lock);
1665 if (nsim_bus_dev->num_vfs == num_vfs) {
1666 ret = 0;
1667 goto exit_unlock;
1668 }
1669 if (nsim_bus_dev->num_vfs && num_vfs) {
1670 ret = -EBUSY;
1671 goto exit_unlock;
1672 }
1673 if (nsim_bus_dev->max_vfs < num_vfs) {
1674 ret = -ENOMEM;
1675 goto exit_unlock;
1676 }
1677
1678 nsim_bus_dev_set_vfs(nsim_bus_dev, num_vfs);
1679 if (nsim_esw_mode_is_switchdev(nsim_dev)) {1680 if (num_vfs) { 1681 ret = nsim_esw_switchdev_enable(nsim_dev, NULL);
1682 if (ret) {
1683 nsim_bus_dev_set_vfs(nsim_bus_dev, 0);
1684 goto exit_unlock;
1685 }
1686 } else {
1687 nsim_esw_legacy_enable(nsim_dev, NULL);
1688 }
1689 }
1690
1691 exit_unlock:
1692 mutex_unlock(&nsim_dev->vfs_lock);
1693
1694 return ret;
1695 }
1696
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Attachments
- .config.gz [application/gzip] 33860 bytes