[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202108172121.9bwexDEJ-lkp@intel.com>
Date: Tue, 17 Aug 2021 21:47:26 +0800
From: kernel test robot <lkp@...el.com>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: [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
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@...el.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
Download attachment ".config.gz" of type "application/gzip" (38867 bytes)
Powered by blists - more mailing lists