All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.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
Date: Tue, 17 Aug 2021 21:47:26 +0800	[thread overview]
Message-ID: <202108172121.9bwexDEJ-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3432 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(a)lists.01.org

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

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
	linux-kernel@vger.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
Date: Tue, 17 Aug 2021 21:47:26 +0800	[thread overview]
Message-ID: <202108172121.9bwexDEJ-lkp@intel.com> (raw)

[-- 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 --]

             reply	other threads:[~2021-08-17 13:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 13:47 kernel test robot [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202108172121.9bwexDEJ-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.