[ammarfaizi2-block:axboe/linux-block/for-5.19/io_uring-passthrough 19/20] drivers/nvme/host/ioctl.c:690:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false

From: kernel test robot
Date: Fri May 06 2022 - 01:23:58 EST


tree: https://github.com/ammarfaizi2/linux-block axboe/linux-block/for-5.19/io_uring-passthrough
head: 6f7c47f1c2768790e557c301ddf75498f36f12b2
commit: 86116c2f6fee81a0be72a71cc2f1f7c087df8efa [19/20] nvme: wire-up uring-cmd support for io-passthru on char-device.
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20220506/202205061324.Uf7nd6hz-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e004fb787698440a387750db7f8028e7cb14cfc)
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/ammarfaizi2/linux-block/commit/86116c2f6fee81a0be72a71cc2f1f7c087df8efa
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block axboe/linux-block/for-5.19/io_uring-passthrough
git checkout 86116c2f6fee81a0be72a71cc2f1f7c087df8efa
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/nvme/host/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/nvme/host/ioctl.c:690:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (ns)
^~
drivers/nvme/host/ioctl.c:693:9: note: uninitialized use occurs here
return ret;
^~~
drivers/nvme/host/ioctl.c:690:2: note: remove the 'if' if its condition is always true
if (ns)
^~~~~~~
drivers/nvme/host/ioctl.c:688:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.


vim +690 drivers/nvme/host/ioctl.c

680
681 int nvme_ns_head_chr_uring_cmd(struct io_uring_cmd *ioucmd,
682 unsigned int issue_flags)
683 {
684 struct cdev *cdev = file_inode(ioucmd->file)->i_cdev;
685 struct nvme_ns_head *head = container_of(cdev, struct nvme_ns_head, cdev);
686 int srcu_idx = srcu_read_lock(&head->srcu);
687 struct nvme_ns *ns = nvme_find_path(head);
688 int ret;
689
> 690 if (ns)
691 ret = nvme_ns_uring_cmd(ns, ioucmd, issue_flags);
692 srcu_read_unlock(&head->srcu, srcu_idx);
693 return ret;
694 }
695 #endif /* CONFIG_NVME_MULTIPATH */
696

--
0-DAY CI Kernel Test Service
https://01.org/lkp