[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202109292008.Iz3jbTrl-lkp@intel.com>
Date: Wed, 29 Sep 2021 20:54:21 +0800
From: kernel test robot <lkp@...el.com>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [mcgrof-next:20210927-for-axboe-add-disk-error-handling 63/63]
drivers/nvdimm/pmem.c:495:9: error: ignoring return value of
'device_add_disk' declared with attribute 'warn_unused_result'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20210927-for-axboe-add-disk-error-handling
head: f47bd67958d80a5c7b133125fac4f57933b0cb2a
commit: f47bd67958d80a5c7b133125fac4f57933b0cb2a [63/63] block: add __must_check for *add_disk*() callers
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 11.2.0
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-next.git/commit/?id=f47bd67958d80a5c7b133125fac4f57933b0cb2a
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20210927-for-axboe-add-disk-error-handling
git checkout f47bd67958d80a5c7b133125fac4f57933b0cb2a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
drivers/nvdimm/pmem.c: In function 'pmem_attach_disk':
>> drivers/nvdimm/pmem.c:495:9: error: ignoring return value of 'device_add_disk' declared with attribute 'warn_unused_result' [-Werror=unused-result]
495 | device_add_disk(dev, disk, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
vim +495 drivers/nvdimm/pmem.c
1e240e8d4a7d922 drivers/nvdimm/pmem.c Christoph Hellwig 2019-06-26 369
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 370 static int pmem_attach_disk(struct device *dev,
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 371 struct nd_namespace_common *ndns)
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 372 {
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 373 struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev);
f284a4f23752d03 drivers/nvdimm/pmem.c Dan Williams 2016-07-07 374 struct nd_region *nd_region = to_nd_region(dev->parent);
ce7f11a230d5b71 drivers/nvdimm/pmem.c Ross Zwisler 2018-06-06 375 int nid = dev_to_node(dev), fua;
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 376 struct resource *res = &nsio->res;
a4574f63edc6f76 drivers/nvdimm/pmem.c Dan Williams 2020-10-13 377 struct range bb_range;
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 378 struct nd_pfn *nd_pfn = NULL;
c1d6e828a35df52 drivers/nvdimm/pmem.c Dan Williams 2017-01-24 379 struct dax_device *dax_dev;
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 380 struct nd_pfn_sb *pfn_sb;
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 381 struct pmem_device *pmem;
468ded03c07e0f2 drivers/nvdimm/pmem.c Dan Williams 2016-01-15 382 struct request_queue *q;
6e0c90d691cd5d9 drivers/nvdimm/pmem.c Dan Williams 2017-06-26 383 struct device *gendev;
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 384 struct gendisk *disk;
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 385 void *addr;
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 386 int rc;
fefc1d97fa4b5e0 drivers/nvdimm/pmem.c Pankaj Gupta 2019-07-05 387 unsigned long flags = 0UL;
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 388
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 389 pmem = devm_kzalloc(dev, sizeof(*pmem), GFP_KERNEL);
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 390 if (!pmem)
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 391 return -ENOMEM;
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 392
8f4b01fcded2dc8 drivers/nvdimm/pmem.c Aneesh Kumar K.V 2019-10-31 393 rc = devm_namespace_enable(dev, ndns, nd_info_block_reserve());
8f4b01fcded2dc8 drivers/nvdimm/pmem.c Aneesh Kumar K.V 2019-10-31 394 if (rc)
8f4b01fcded2dc8 drivers/nvdimm/pmem.c Aneesh Kumar K.V 2019-10-31 395 return rc;
8f4b01fcded2dc8 drivers/nvdimm/pmem.c Aneesh Kumar K.V 2019-10-31 396
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 397 /* while nsio_rw_bytes is active, parse a pfn info block if present */
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 398 if (is_nd_pfn(dev)) {
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 399 nd_pfn = to_nd_pfn(dev);
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 400 rc = nvdimm_setup_pfn(nd_pfn, &pmem->pgmap);
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 401 if (rc)
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 402 return rc;
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 403 }
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 404
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 405 /* we're attaching a block device, disable raw namespace access */
8f4b01fcded2dc8 drivers/nvdimm/pmem.c Aneesh Kumar K.V 2019-10-31 406 devm_namespace_disable(dev, ndns);
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 407
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 408 dev_set_drvdata(dev, pmem);
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 409 pmem->phys_addr = res->start;
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 410 pmem->size = resource_size(res);
0b277961f4484fb drivers/nvdimm/pmem.c Dan Williams 2017-06-09 411 fua = nvdimm_has_flush(nd_region);
0b277961f4484fb drivers/nvdimm/pmem.c Dan Williams 2017-06-09 412 if (!IS_ENABLED(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) || fua < 0) {
61031952f4c89db drivers/nvdimm/pmem.c Ross Zwisler 2015-06-25 413 dev_warn(dev, "unable to guarantee persistence of writes\n");
0b277961f4484fb drivers/nvdimm/pmem.c Dan Williams 2017-06-09 414 fua = 0;
0b277961f4484fb drivers/nvdimm/pmem.c Dan Williams 2017-06-09 415 }
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 416
947df02d255a6a8 drivers/nvdimm/pmem.c Dan Williams 2016-03-21 417 if (!devm_request_mem_region(dev, res->start, resource_size(res),
450c6633e874c4d drivers/nvdimm/pmem.c Dan Williams 2016-11-28 418 dev_name(&ndns->dev))) {
947df02d255a6a8 drivers/nvdimm/pmem.c Dan Williams 2016-03-21 419 dev_warn(dev, "could not reserve region %pR\n", res);
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 420 return -EBUSY;
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 421 }
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 422
87eb73b2ca7c1b9 drivers/nvdimm/pmem.c Christoph Hellwig 2021-05-21 423 disk = blk_alloc_disk(nid);
87eb73b2ca7c1b9 drivers/nvdimm/pmem.c Christoph Hellwig 2021-05-21 424 if (!disk)
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 425 return -ENOMEM;
87eb73b2ca7c1b9 drivers/nvdimm/pmem.c Christoph Hellwig 2021-05-21 426 q = disk->queue;
468ded03c07e0f2 drivers/nvdimm/pmem.c Dan Williams 2016-01-15 427
87eb73b2ca7c1b9 drivers/nvdimm/pmem.c Christoph Hellwig 2021-05-21 428 pmem->disk = disk;
a624eb520390cec drivers/nvdimm/pmem.c Dan Williams 2021-06-07 429 pmem->pgmap.owner = pmem;
34c0fd540e79fb4 drivers/nvdimm/pmem.c Dan Williams 2016-01-15 430 pmem->pfn_flags = PFN_DEV;
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 431 pmem->pgmap.ref = &q->q_usage_counter;
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 432 if (is_nd_pfn(dev)) {
f6a55e1a3fe6b3b drivers/nvdimm/pmem.c Christoph Hellwig 2019-06-26 433 pmem->pgmap.type = MEMORY_DEVICE_FS_DAX;
f6a55e1a3fe6b3b drivers/nvdimm/pmem.c Christoph Hellwig 2019-06-26 434 pmem->pgmap.ops = &fsdax_pagemap_ops;
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 435 addr = devm_memremap_pages(dev, &pmem->pgmap);
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 436 pfn_sb = nd_pfn->pfn_sb;
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 437 pmem->data_offset = le64_to_cpu(pfn_sb->dataoff);
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 438 pmem->pfn_pad = resource_size(res) -
a4574f63edc6f76 drivers/nvdimm/pmem.c Dan Williams 2020-10-13 439 range_len(&pmem->pgmap.range);
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 440 pmem->pfn_flags |= PFN_MAP;
a4574f63edc6f76 drivers/nvdimm/pmem.c Dan Williams 2020-10-13 441 bb_range = pmem->pgmap.range;
a4574f63edc6f76 drivers/nvdimm/pmem.c Dan Williams 2020-10-13 442 bb_range.start += pmem->data_offset;
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 443 } else if (pmem_should_map_pages(dev)) {
a4574f63edc6f76 drivers/nvdimm/pmem.c Dan Williams 2020-10-13 444 pmem->pgmap.range.start = res->start;
a4574f63edc6f76 drivers/nvdimm/pmem.c Dan Williams 2020-10-13 445 pmem->pgmap.range.end = res->end;
b7b3c01b191596d drivers/nvdimm/pmem.c Dan Williams 2020-10-13 446 pmem->pgmap.nr_range = 1;
f6a55e1a3fe6b3b drivers/nvdimm/pmem.c Christoph Hellwig 2019-06-26 447 pmem->pgmap.type = MEMORY_DEVICE_FS_DAX;
f6a55e1a3fe6b3b drivers/nvdimm/pmem.c Christoph Hellwig 2019-06-26 448 pmem->pgmap.ops = &fsdax_pagemap_ops;
e8d5134833006a4 drivers/nvdimm/pmem.c Christoph Hellwig 2017-12-29 449 addr = devm_memremap_pages(dev, &pmem->pgmap);
34c0fd540e79fb4 drivers/nvdimm/pmem.c Dan Williams 2016-01-15 450 pmem->pfn_flags |= PFN_MAP;
a4574f63edc6f76 drivers/nvdimm/pmem.c Dan Williams 2020-10-13 451 bb_range = pmem->pgmap.range;
91ed7ac444ef749 drivers/nvdimm/pmem.c Dan Williams 2018-10-04 452 } else {
32b2397c1e56f33 drivers/nvdimm/pmem.c sumiyawang 2021-08-22 453 addr = devm_memremap(dev, pmem->phys_addr,
32b2397c1e56f33 drivers/nvdimm/pmem.c sumiyawang 2021-08-22 454 pmem->size, ARCH_MEMREMAP_PMEM);
50f44ee7248ad2f drivers/nvdimm/pmem.c Dan Williams 2019-06-13 455 if (devm_add_action_or_reset(dev, pmem_release_queue,
d8668bb0451c3c4 drivers/nvdimm/pmem.c Christoph Hellwig 2019-06-26 456 &pmem->pgmap))
50f44ee7248ad2f drivers/nvdimm/pmem.c Dan Williams 2019-06-13 457 return -ENOMEM;
a4574f63edc6f76 drivers/nvdimm/pmem.c Dan Williams 2020-10-13 458 bb_range.start = res->start;
a4574f63edc6f76 drivers/nvdimm/pmem.c Dan Williams 2020-10-13 459 bb_range.end = res->end;
91ed7ac444ef749 drivers/nvdimm/pmem.c Dan Williams 2018-10-04 460 }
b36f47617f6ce7c drivers/nvdimm/pmem.c Dan Williams 2015-09-15 461
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 462 if (IS_ERR(addr))
200c79da824c978 drivers/nvdimm/pmem.c Dan Williams 2016-03-22 463 return PTR_ERR(addr);
7a9eb2066631779 drivers/nvdimm/pmem.c Dan Williams 2016-06-03 464 pmem->virt_addr = addr;
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 465
ce7f11a230d5b71 drivers/nvdimm/pmem.c Ross Zwisler 2018-06-06 466 blk_queue_write_cache(q, true, fua);
5a92289f41311a5 drivers/nvdimm/pmem.c Dan Williams 2016-03-21 467 blk_queue_physical_block_size(q, PAGE_SIZE);
f979b13c3cc5158 drivers/nvdimm/pmem.c Dan Williams 2017-06-04 468 blk_queue_logical_block_size(q, pmem_sector_size(ndns));
5a92289f41311a5 drivers/nvdimm/pmem.c Dan Williams 2016-03-21 469 blk_queue_max_hw_sectors(q, UINT_MAX);
8b904b5b6b58b9a drivers/nvdimm/pmem.c Bart Van Assche 2018-03-07 470 blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
4557641b4c70466 drivers/nvdimm/pmem.c Ross Zwisler 2018-06-26 471 if (pmem->pfn_flags & PFN_MAP)
8b904b5b6b58b9a drivers/nvdimm/pmem.c Bart Van Assche 2018-03-07 472 blk_queue_flag_set(QUEUE_FLAG_DAX, q);
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 473
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 474 disk->fops = &pmem_fops;
6ec26b8b2d70b41 drivers/nvdimm/pmem.c Christoph Hellwig 2020-05-08 475 disk->private_data = pmem;
5212e11fde4d40f drivers/nvdimm/pmem.c Vishal Verma 2015-06-25 476 nvdimm_namespace_disk_name(ndns, disk->disk_name);
cfe30b872058f21 drivers/nvdimm/pmem.c Dan Williams 2016-03-03 477 set_capacity(disk, (pmem->size - pmem->pfn_pad - pmem->data_offset)
cfe30b872058f21 drivers/nvdimm/pmem.c Dan Williams 2016-03-03 478 / 512);
b95f5f4391fad65 drivers/nvdimm/pmem.c Dan Williams 2016-01-04 479 if (devm_init_badblocks(dev, &pmem->bb))
b95f5f4391fad65 drivers/nvdimm/pmem.c Dan Williams 2016-01-04 480 return -ENOMEM;
a4574f63edc6f76 drivers/nvdimm/pmem.c Dan Williams 2020-10-13 481 nvdimm_badblocks_populate(nd_region, &pmem->bb, &bb_range);
57f7f317abdd079 drivers/nvdimm/pmem.c Dan Williams 2016-01-06 482 disk->bb = &pmem->bb;
f02716db951c5e0 drivers/nvdimm/pmem.c Dan Williams 2016-06-15 483
fefc1d97fa4b5e0 drivers/nvdimm/pmem.c Pankaj Gupta 2019-07-05 484 if (is_nvdimm_sync(nd_region))
fefc1d97fa4b5e0 drivers/nvdimm/pmem.c Pankaj Gupta 2019-07-05 485 flags = DAXDEV_F_SYNC;
fefc1d97fa4b5e0 drivers/nvdimm/pmem.c Pankaj Gupta 2019-07-05 486 dax_dev = alloc_dax(pmem, disk->disk_name, &pmem_dax_ops, flags);
4e4ced93794acb4 drivers/nvdimm/pmem.c Vivek Goyal 2020-04-01 487 if (IS_ERR(dax_dev)) {
4e4ced93794acb4 drivers/nvdimm/pmem.c Vivek Goyal 2020-04-01 488 return PTR_ERR(dax_dev);
c1d6e828a35df52 drivers/nvdimm/pmem.c Dan Williams 2017-01-24 489 }
ce7f11a230d5b71 drivers/nvdimm/pmem.c Ross Zwisler 2018-06-06 490 dax_write_cache(dax_dev, nvdimm_has_cache(nd_region));
c1d6e828a35df52 drivers/nvdimm/pmem.c Dan Williams 2017-01-24 491 pmem->dax_dev = dax_dev;
6e0c90d691cd5d9 drivers/nvdimm/pmem.c Dan Williams 2017-06-26 492 gendev = disk_to_dev(disk);
6e0c90d691cd5d9 drivers/nvdimm/pmem.c Dan Williams 2017-06-26 493 gendev->groups = pmem_attribute_groups;
6e0c90d691cd5d9 drivers/nvdimm/pmem.c Dan Williams 2017-06-26 494
fef912bf860e8e7 drivers/nvdimm/pmem.c Hannes Reinecke 2018-09-28 @495 device_add_disk(dev, disk, NULL);
c1d6e828a35df52 drivers/nvdimm/pmem.c Dan Williams 2017-01-24 496 if (devm_add_action_or_reset(dev, pmem_release_disk, pmem))
f02716db951c5e0 drivers/nvdimm/pmem.c Dan Williams 2016-06-15 497 return -ENOMEM;
f02716db951c5e0 drivers/nvdimm/pmem.c Dan Williams 2016-06-15 498
32f61d67570db03 drivers/nvdimm/pmem.c Christoph Hellwig 2020-09-01 499 nvdimm_check_and_set_ro(disk);
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 500
975750a98c26769 drivers/nvdimm/pmem.c Toshi Kani 2017-06-12 501 pmem->bb_state = sysfs_get_dirent(disk_to_dev(disk)->kobj.sd,
975750a98c26769 drivers/nvdimm/pmem.c Toshi Kani 2017-06-12 502 "badblocks");
6aa734a2f38e2e1 drivers/nvdimm/pmem.c Dan Williams 2017-06-30 503 if (!pmem->bb_state)
6aa734a2f38e2e1 drivers/nvdimm/pmem.c Dan Williams 2017-06-30 504 dev_warn(dev, "'badblocks' notification disabled\n");
975750a98c26769 drivers/nvdimm/pmem.c Toshi Kani 2017-06-12 505
8c2f7e8658df1d3 drivers/nvdimm/pmem.c Dan Williams 2015-06-25 506 return 0;
8c2f7e8658df1d3 drivers/nvdimm/pmem.c Dan Williams 2015-06-25 507 }
9e853f2313e5eb1 drivers/block/pmem.c Ross Zwisler 2015-04-01 508
:::::: The code at line 495 was first introduced by commit
:::::: fef912bf860e8e7e48a2bfb978a356bba743a8b7 block: genhd: add 'groups' argument to device_add_disk
:::::: TO: Hannes Reinecke <hare@...e.de>
:::::: CC: Jens Axboe <axboe@...nel.dk>
---
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" (71235 bytes)
Powered by blists - more mailing lists