* [cxl:for-6.3/cxl-ram-region 17/18] drivers/cxl/core/region.c:2404:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true
@ 2023-01-28 5:28 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-01-28 5:28 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: 3c6c8594f9a2bcb4af19bc8de669ed43834b8d7f [17/18] cxl/region: Add region autodiscovery
config: i386-randconfig-a012-20230123 (https://download.01.org/0day-ci/archive/20230128/202301281313.kVrIreUj-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=3c6c8594f9a2bcb4af19bc8de669ed43834b8d7f
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 3c6c8594f9a2bcb4af19bc8de669ed43834b8d7f
# 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:1772:7: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
int rc;
^
drivers/cxl/core/region.c:1775:7: warning: variable 'rc' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (!dev)
^~~~
drivers/cxl/core/region.c:1789:6: note: uninitialized use occurs here
if (rc < 0)
^~
drivers/cxl/core/region.c:1775:3: note: remove the 'if' if its condition is always true
if (!dev)
^~~~~~~~~
drivers/cxl/core/region.c:1766:8: note: initialize the variable 'rc' to silence this warning
int rc;
^
= 0
>> drivers/cxl/core/region.c:2404:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (p->state >= CXL_CONFIG_INTERLEAVE_ACTIVE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/cxl/core/region.c:2461:17: note: uninitialized use occurs here
return ERR_PTR(rc);
^~
drivers/cxl/core/region.c:2404:2: note: remove the 'if' if its condition is always false
if (p->state >= CXL_CONFIG_INTERLEAVE_ACTIVE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/cxl/core/region.c:2387:8: note: initialize the variable 'rc' to silence this warning
int rc;
^
= 0
3 warnings generated.
vim +2404 drivers/cxl/core/region.c
2376
2377 /* Establish an empty region covering the given HPA range */
2378 static struct cxl_region *construct_region(struct cxl_root_decoder *cxlrd,
2379 struct cxl_endpoint_decoder *cxled)
2380 {
2381 struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
2382 struct cxl_port *port = cxlrd_to_port(cxlrd);
2383 struct range *hpa = &cxled->cxld.hpa_range;
2384 struct cxl_region_params *p;
2385 struct cxl_region *cxlr;
2386 struct resource *res;
2387 int rc;
2388
2389 do {
2390 cxlr = __create_region(cxlrd, cxled->mode,
2391 atomic_read(&cxlrd->region_id));
2392 } while (IS_ERR(cxlr) && PTR_ERR(cxlr) == -EBUSY);
2393
2394 if (IS_ERR(cxlr)) {
2395 dev_err(cxlmd->dev.parent,
2396 "%s:%s: %s failed assign region: %ld\n",
2397 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev),
2398 __func__, PTR_ERR(cxlr));
2399 return cxlr;
2400 }
2401
2402 down_write(&cxl_region_rwsem);
2403 p = &cxlr->params;
> 2404 if (p->state >= CXL_CONFIG_INTERLEAVE_ACTIVE) {
2405 dev_err(cxlmd->dev.parent,
2406 "%s:%s: %s autodiscovery interrupted\n",
2407 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev),
2408 __func__);
2409 goto err_intr;
2410 }
2411
2412 set_bit(CXL_REGION_F_AUTO, &cxlr->flags);
2413
2414 res = kmalloc(sizeof(*res), GFP_KERNEL);
2415 if (!res) {
2416 rc = -ENOMEM;
2417 goto err_res;
2418 }
2419
2420 *res = DEFINE_RES_MEM_NAMED(hpa->start, range_len(hpa),
2421 dev_name(&cxlr->dev));
2422 rc = insert_resource(cxlrd->res, res);
2423 if (rc) {
2424 dev_dbg(cxlmd->dev.parent, "%s:%s: %s resource conflict: %d\n",
2425 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev),
2426 __func__, rc);
2427 goto err_insert;
2428 }
2429
2430 p->res = res;
2431 p->interleave_ways = cxled->cxld.interleave_ways;
2432 p->interleave_granularity = cxled->cxld.interleave_granularity;
2433 p->state = CXL_CONFIG_INTERLEAVE_ACTIVE;
2434 /*
2435 * unregister_region() is now enabled and @res does not need
2436 * separate cleanup
2437 */
2438
2439 rc = sysfs_update_group(&cxlr->dev.kobj, get_cxl_region_target_group());
2440 if (rc)
2441 goto err_sysfs;
2442
2443 dev_dbg(cxlmd->dev.parent, "%s:%s: %s %s res: %pr iw: %d ig: %d\n",
2444 dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev), __func__,
2445 dev_name(&cxlr->dev), p->res, p->interleave_ways,
2446 p->interleave_granularity);
2447
2448 /* ...to match put_device() in cxl_add_to_region() */
2449 get_device(&cxlr->dev);
2450 up_write(&cxl_region_rwsem);
2451
2452 return cxlr;
2453
2454 err_insert:
2455 kfree(res);
2456 err_res:
2457 err_sysfs:
2458 err_intr:
2459 up_write(&cxl_region_rwsem);
2460 devm_release_action(port->uport, unregister_region, cxlr);
2461 return ERR_PTR(rc);
2462 }
2463
--
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 5:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-28 5:28 [cxl:for-6.3/cxl-ram-region 17/18] drivers/cxl/core/region.c:2404:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true kernel test robot
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.