LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [mcgrof:20210818-add-disk-error-handling-v2 137/160] drivers/block/rsxx/dev.c:200:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false
@ 2021-08-18 22:49 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-18 22:49 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: clang-built-linux, kbuild-all, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4293 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git 20210818-add-disk-error-handling-v2
head:   0517c8bf82eb7da58caada94869afb0957f57c81
commit: 75577f3e8b2f2a343829cb35edbdf0f138fc9000 [137/160] block/rsxx: add error handling support for add_disk()
config: i386-randconfig-r022-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d2b574a4dea5b718e4386bf2e26af0126e5978ce)
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/mcgrof/linux.git/commit/?id=75577f3e8b2f2a343829cb35edbdf0f138fc9000
        git remote add mcgrof https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git
        git fetch --no-tags mcgrof 20210818-add-disk-error-handling-v2
        git checkout 75577f3e8b2f2a343829cb35edbdf0f138fc9000
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 

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/block/rsxx/dev.c:200:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (enable_blkdev) {
               ^~~~~~~~~~~~~
   drivers/block/rsxx/dev.c:212:6: note: uninitialized use occurs here
           if (err)
               ^~~
   drivers/block/rsxx/dev.c:200:2: note: remove the 'if' if its condition is always true
           if (enable_blkdev) {
           ^~~~~~~~~~~~~~~~~~~
   drivers/block/rsxx/dev.c:195:9: note: initialize the variable 'err' to silence this warning
           int err;
                  ^
                   = 0
   1 warning generated.


vim +200 drivers/block/rsxx/dev.c

8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  192  
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  193  int rsxx_attach_dev(struct rsxx_cardinfo *card)
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  194  {
75577f3e8b2f2a Luis Chamberlain         2021-07-13  195  	int err;
75577f3e8b2f2a Luis Chamberlain         2021-07-13  196  
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  197  	mutex_lock(&card->dev_lock);
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  198  
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  199  	/* The block device requires the stripe size from the config. */
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05 @200  	if (enable_blkdev) {
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  201  		if (card->config_valid)
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  202  			set_capacity(card->gendisk, card->size8 >> 9);
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  203  		else
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  204  			set_capacity(card->gendisk, 0);
75577f3e8b2f2a Luis Chamberlain         2021-07-13  205  		err = device_add_disk(CARD_TO_DEV(card), card->gendisk, NULL);
75577f3e8b2f2a Luis Chamberlain         2021-07-13  206  		if (err == 0)
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  207  			card->bdev_attached = 1;
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  208  	}
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  209  
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  210  	mutex_unlock(&card->dev_lock);
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  211  
75577f3e8b2f2a Luis Chamberlain         2021-07-13  212  	if (err)
75577f3e8b2f2a Luis Chamberlain         2021-07-13  213  		blk_cleanup_disk(card->gendisk);
75577f3e8b2f2a Luis Chamberlain         2021-07-13  214  
75577f3e8b2f2a Luis Chamberlain         2021-07-13  215  	return err;
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  216  }
8722ff8cdbfac9 josh.h.morris@us.ibm.com 2013-02-05  217  

:::::: The code at line 200 was first introduced by commit
:::::: 8722ff8cdbfac9c1b20e67bb067b455c48cb8e93 block: IBM RamSan 70/80 device driver

:::::: TO: josh.h.morris@us.ibm.com <josh.h.morris@us.ibm.com>
:::::: CC: Jens Axboe <axboe@kernel.dk>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40736 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-18 22:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 22:49 [mcgrof:20210818-add-disk-error-handling-v2 137/160] drivers/block/rsxx/dev.c:200:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).