Linux CXL
 help / color / mirror / Atom feed
* [cxl:for-6.3/cxl-ram-region 14/18] drivers/cxl/core/region.c:1479:7: warning: variable 'rc' set but not used
@ 2023-01-28  4:46 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-01-28  4:46 UTC (permalink / raw)
  To: Dan Williams
  Cc: llvm, oe-kbuild-all, Alison Schofield, Vishal Verma, Ira Weiny,
	Ben Widawsky, Dan Williams, linux-cxl

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git for-6.3/cxl-ram-region
head:   a7cf664d7e997ac36b0f466af2e2be33464ab598
commit: d5c71004c2cb69354ab7f1bb9b0a33ae9f7edf9d [14/18] cxl/region: Refactor attach_target() for autodiscovery
config: i386-randconfig-a012-20230123 (https://download.01.org/0day-ci/archive/20230128/202301281217.NvoiwL4w-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/cxl/cxl.git/commit/?id=d5c71004c2cb69354ab7f1bb9b0a33ae9f7edf9d
        git remote add cxl https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git
        git fetch --no-tags cxl for-6.3/cxl-ram-region
        git checkout d5c71004c2cb69354ab7f1bb9b0a33ae9f7edf9d
        # 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=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/cxl/core/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/cxl/core/region.c:1479:7: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
                   int rc;
                       ^
>> drivers/cxl/core/region.c:1482:7: warning: variable 'rc' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                   if (!dev)
                       ^~~~
   drivers/cxl/core/region.c:1496:6: note: uninitialized use occurs here
           if (rc < 0)
               ^~
   drivers/cxl/core/region.c:1482:3: note: remove the 'if' if its condition is always true
                   if (!dev)
                   ^~~~~~~~~
   drivers/cxl/core/region.c:1473:8: note: initialize the variable 'rc' to silence this warning
           int rc;
                 ^
                  = 0
   2 warnings generated.


vim +/rc +1479 drivers/cxl/core/region.c

  1469	
  1470	static size_t store_targetN(struct cxl_region *cxlr, const char *buf, int pos,
  1471				    size_t len)
  1472	{
  1473		int rc;
  1474	
  1475		if (sysfs_streq(buf, "\n"))
  1476			rc = detach_target(cxlr, pos);
  1477		else {
  1478			struct device *dev;
> 1479			int rc;
  1480	
  1481			dev = bus_find_device_by_name(&cxl_bus_type, NULL, buf);
> 1482			if (!dev)
  1483				return -ENODEV;
  1484	
  1485			if (!is_endpoint_decoder(dev)) {
  1486				rc = -EINVAL;
  1487				goto out;
  1488			}
  1489	
  1490			rc = attach_target(cxlr, to_cxl_endpoint_decoder(dev), pos,
  1491					   TASK_INTERRUPTIBLE);
  1492	out:
  1493			put_device(dev);
  1494		}
  1495	
  1496		if (rc < 0)
  1497			return rc;
  1498		return len;
  1499	}
  1500	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

only message in thread, other threads:[~2023-01-28  4:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-28  4:46 [cxl:for-6.3/cxl-ram-region 14/18] drivers/cxl/core/region.c:1479:7: warning: variable 'rc' set but not used 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