LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [mcgrof:20210816-add-disk-error-handling 41/64] drivers/block/floppy.c:4532:7: warning: variable 'err' is used uninitialized whenever 'if' condition is false
@ 2021-08-17 13:47 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-17 13:47 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: clang-built-linux, kbuild-all, linux-kernel

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git 20210816-add-disk-error-handling
head:   e1e79332ea1bba0e751529b114ef9d301bf962a5
commit: 4734b368f95c0126b06135115f9413cc00777e1b [41/64] block: make __register_blkdev() return an error
config: i386-randconfig-a004-20210817 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2c6448cdc2f68f8c28fd0bd9404182b81306e6e6)
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=4734b368f95c0126b06135115f9413cc00777e1b
        git remote add mcgrof https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git
        git fetch --no-tags mcgrof 20210816-add-disk-error-handling
        git checkout 4734b368f95c0126b06135115f9413cc00777e1b
        # 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/floppy.c:4532:7: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                   if (floppy_alloc_disk(drive, type) == 0) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/block/floppy.c:4540:9: note: uninitialized use occurs here
           return err;
                  ^~~
   drivers/block/floppy.c:4532:3: note: remove the 'if' if its condition is always true
                   if (floppy_alloc_disk(drive, type) == 0) {
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/block/floppy.c:4531:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (!disks[drive][type]) {
               ^~~~~~~~~~~~~~~~~~~
   drivers/block/floppy.c:4540:9: note: uninitialized use occurs here
           return err;
                  ^~~
   drivers/block/floppy.c:4531:2: note: remove the 'if' if its condition is always true
           if (!disks[drive][type]) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/block/floppy.c:4524:9: note: initialize the variable 'err' to silence this warning
           int err;
                  ^
                   = 0
   2 warnings generated.


vim +4532 drivers/block/floppy.c

  4519	
  4520	static int floppy_probe(dev_t dev)
  4521	{
  4522		unsigned int drive = (MINOR(dev) & 3) | ((MINOR(dev) & 0x80) >> 5);
  4523		unsigned int type = (MINOR(dev) >> 2) & 0x1f;
  4524		int err;
  4525	
  4526		if (drive >= N_DRIVE || !floppy_available(drive) ||
  4527		    type >= ARRAY_SIZE(floppy_type))
  4528			return -EINVAL;
  4529	
  4530		mutex_lock(&floppy_probe_lock);
  4531		if (!disks[drive][type]) {
> 4532			if (floppy_alloc_disk(drive, type) == 0) {
  4533				err = add_disk(disks[drive][type]);
  4534				if (err)
  4535					blk_cleanup_disk(disks[drive][type]);
  4536			}
  4537		}
  4538		mutex_unlock(&floppy_probe_lock);
  4539	
  4540		return err;
  4541	}
  4542	

---
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: 38867 bytes --]

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

only message in thread, other threads:[~2021-08-17 13:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 13:47 [mcgrof:20210816-add-disk-error-handling 41/64] drivers/block/floppy.c:4532:7: 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).