* [hch-misc:nvme-scanning-cleanup 5/27] drivers/nvme/target/passthru.c:527:6: warning: Variable 'ret' is reassigned a value before the old one has been used.
@ 2020-09-25 12:52 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-09-25 12:52 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 6010 bytes --]
CC: kbuild-all(a)lists.01.org
TO: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
CC: Christoph Hellwig <hch@lst.de>
CC: Logan Gunthorpe <logang@deltatee.com>
tree: git://git.infradead.org/users/hch/misc.git nvme-scanning-cleanup
head: a4965fd85cd56b6aaf0b985abac93ef12bd92d61
commit: bfaeed30ac537b096f9bc812c5b6f13de005f015 [5/27] nvme: lift the file open code from nvme_ctrl_get_by_path
:::::: branch date: 5 hours ago
:::::: commit date: 9 hours ago
compiler: nios2-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck warnings: (new ones prefixed by >>)
>> drivers/nvme/target/passthru.c:527:6: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
ret = 0;
^
drivers/nvme/target/passthru.c:478:0: note: Variable 'ret' is reassigned a value before the old one has been used.
int ret = -EINVAL;
^
drivers/nvme/target/passthru.c:527:6: note: Variable 'ret' is reassigned a value before the old one has been used.
ret = 0;
^
vim +/ret +527 drivers/nvme/target/passthru.c
ba76af676cd0514 Logan Gunthorpe 2020-07-24 473
ba76af676cd0514 Logan Gunthorpe 2020-07-24 474 int nvmet_passthru_ctrl_enable(struct nvmet_subsys *subsys)
ba76af676cd0514 Logan Gunthorpe 2020-07-24 475 {
ba76af676cd0514 Logan Gunthorpe 2020-07-24 476 struct nvme_ctrl *ctrl;
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 477 struct file *file;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 478 int ret = -EINVAL;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 479 void *old;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 480
ba76af676cd0514 Logan Gunthorpe 2020-07-24 481 mutex_lock(&subsys->lock);
ba76af676cd0514 Logan Gunthorpe 2020-07-24 482 if (!subsys->passthru_ctrl_path)
ba76af676cd0514 Logan Gunthorpe 2020-07-24 483 goto out_unlock;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 484 if (subsys->passthru_ctrl)
ba76af676cd0514 Logan Gunthorpe 2020-07-24 485 goto out_unlock;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 486
ba76af676cd0514 Logan Gunthorpe 2020-07-24 487 if (subsys->nr_namespaces) {
ba76af676cd0514 Logan Gunthorpe 2020-07-24 488 pr_info("cannot enable both passthru and regular namespaces for a single subsystem");
ba76af676cd0514 Logan Gunthorpe 2020-07-24 489 goto out_unlock;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 490 }
ba76af676cd0514 Logan Gunthorpe 2020-07-24 491
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 492 file = filp_open(subsys->passthru_ctrl_path, O_RDWR, 0);
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 493 if (IS_ERR(file)) {
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 494 ret = PTR_ERR(file);
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 495 goto out_unlock;
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 496 }
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 497
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 498 ctrl = nvme_ctrl_from_file(file);
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 499 if (!ctrl) {
ba76af676cd0514 Logan Gunthorpe 2020-07-24 500 pr_err("failed to open nvme controller %s\n",
ba76af676cd0514 Logan Gunthorpe 2020-07-24 501 subsys->passthru_ctrl_path);
ba76af676cd0514 Logan Gunthorpe 2020-07-24 502
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 503 goto out_put_file;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 504 }
ba76af676cd0514 Logan Gunthorpe 2020-07-24 505
ba76af676cd0514 Logan Gunthorpe 2020-07-24 506 old = xa_cmpxchg(&passthru_subsystems, ctrl->cntlid, NULL,
ba76af676cd0514 Logan Gunthorpe 2020-07-24 507 subsys, GFP_KERNEL);
ba76af676cd0514 Logan Gunthorpe 2020-07-24 508 if (xa_is_err(old)) {
ba76af676cd0514 Logan Gunthorpe 2020-07-24 509 ret = xa_err(old);
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 510 goto out_put_file;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 511 }
ba76af676cd0514 Logan Gunthorpe 2020-07-24 512
ba76af676cd0514 Logan Gunthorpe 2020-07-24 513 if (old)
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 514 goto out_put_file;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 515
ba76af676cd0514 Logan Gunthorpe 2020-07-24 516 subsys->passthru_ctrl = ctrl;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 517 subsys->ver = ctrl->vs;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 518
ba76af676cd0514 Logan Gunthorpe 2020-07-24 519 if (subsys->ver < NVME_VS(1, 2, 1)) {
ba76af676cd0514 Logan Gunthorpe 2020-07-24 520 pr_warn("nvme controller version is too old: %llu.%llu.%llu, advertising 1.2.1\n",
ba76af676cd0514 Logan Gunthorpe 2020-07-24 521 NVME_MAJOR(subsys->ver), NVME_MINOR(subsys->ver),
ba76af676cd0514 Logan Gunthorpe 2020-07-24 522 NVME_TERTIARY(subsys->ver));
ba76af676cd0514 Logan Gunthorpe 2020-07-24 523 subsys->ver = NVME_VS(1, 2, 1);
ba76af676cd0514 Logan Gunthorpe 2020-07-24 524 }
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 525 nvme_get_ctrl(ctrl);
3a6b076168e20a5 Christoph Hellwig 2020-09-16 526 __module_get(subsys->passthru_ctrl->ops->module);
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 @527 ret = 0;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 528
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 529 out_put_file:
bfaeed30ac537b0 Chaitanya Kulkarni 2020-09-16 530 filp_close(file, NULL);
ba76af676cd0514 Logan Gunthorpe 2020-07-24 531 out_unlock:
ba76af676cd0514 Logan Gunthorpe 2020-07-24 532 mutex_unlock(&subsys->lock);
ba76af676cd0514 Logan Gunthorpe 2020-07-24 533 return ret;
ba76af676cd0514 Logan Gunthorpe 2020-07-24 534 }
ba76af676cd0514 Logan Gunthorpe 2020-07-24 535
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-25 12:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 12:52 [hch-misc:nvme-scanning-cleanup 5/27] drivers/nvme/target/passthru.c:527:6: warning: Variable 'ret' is reassigned a value before the old one has been used 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.