From: kernel test robot <lkp@intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
Ben Widawsky <ben.widawsky@intel.com>,
Dan Williams <dan.j.williams@intel.com>,
linux-kernel@vger.kernel.org
Subject: [cxl-cxl:pending 31/38] drivers/cxl/pmem.c:66:6: warning: variable 'nvdimm' is used uninitialized whenever 'if' condition is true
Date: Sat, 14 Aug 2021 14:58:10 +0800 [thread overview]
Message-ID: <202108141400.cUDQV9sC-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4698 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git pending
head: fa809cc6feedcd2575b63def7135dfaf066266bb
commit: fc6fd550b9f1ada1bdb5e12f83e3794e81a2eb42 [31/38] cxl/mbox: Add exclusive kernel command support
config: x86_64-randconfig-a015-20210814 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1f7b25ea76a925aca690da28de9d78db7ca99d0c)
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=fc6fd550b9f1ada1bdb5e12f83e3794e81a2eb42
git remote add cxl-cxl https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git
git fetch --no-tags cxl-cxl pending
git checkout fc6fd550b9f1ada1bdb5e12f83e3794e81a2eb42
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
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/cxl/pmem.c:66:6: warning: variable 'nvdimm' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!cxl_nvb->nvdimm_bus)
^~~~~~~~~~~~~~~~~~~~
drivers/cxl/pmem.c:80:7: note: uninitialized use occurs here
if (!nvdimm && rc == 0)
^~~~~~
drivers/cxl/pmem.c:66:2: note: remove the 'if' if its condition is always false
if (!cxl_nvb->nvdimm_bus)
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/cxl/pmem.c:58:23: note: initialize the variable 'nvdimm' to silence this warning
struct nvdimm *nvdimm;
^
= NULL
1 warning generated.
vim +66 drivers/cxl/pmem.c
21083f51521fb0 Dan Williams 2021-06-15 50
21083f51521fb0 Dan Williams 2021-06-15 51 static int cxl_nvdimm_probe(struct device *dev)
21083f51521fb0 Dan Williams 2021-06-15 52 {
21083f51521fb0 Dan Williams 2021-06-15 53 struct cxl_nvdimm *cxl_nvd = to_cxl_nvdimm(dev);
fc6fd550b9f1ad Dan Williams 2021-06-17 54 struct cxl_memdev *cxlmd = cxl_nvd->cxlmd;
fc6fd550b9f1ad Dan Williams 2021-06-17 55 struct cxl_mem *cxlm = cxlmd->cxlm;
21083f51521fb0 Dan Williams 2021-06-15 56 struct cxl_nvdimm_bridge *cxl_nvb;
21083f51521fb0 Dan Williams 2021-06-15 57 unsigned long flags = 0;
21083f51521fb0 Dan Williams 2021-06-15 58 struct nvdimm *nvdimm;
21083f51521fb0 Dan Williams 2021-06-15 59 int rc = -ENXIO;
21083f51521fb0 Dan Williams 2021-06-15 60
21083f51521fb0 Dan Williams 2021-06-15 61 cxl_nvb = cxl_find_nvdimm_bridge();
21083f51521fb0 Dan Williams 2021-06-15 62 if (!cxl_nvb)
21083f51521fb0 Dan Williams 2021-06-15 63 return -ENXIO;
21083f51521fb0 Dan Williams 2021-06-15 64
21083f51521fb0 Dan Williams 2021-06-15 65 device_lock(&cxl_nvb->dev);
21083f51521fb0 Dan Williams 2021-06-15 @66 if (!cxl_nvb->nvdimm_bus)
21083f51521fb0 Dan Williams 2021-06-15 67 goto out;
21083f51521fb0 Dan Williams 2021-06-15 68
fc6fd550b9f1ad Dan Williams 2021-06-17 69 set_exclusive_cxl_commands(cxlm, exclusive_cmds);
fc6fd550b9f1ad Dan Williams 2021-06-17 70
21083f51521fb0 Dan Williams 2021-06-15 71 set_bit(NDD_LABELING, &flags);
21083f51521fb0 Dan Williams 2021-06-15 72 nvdimm = nvdimm_create(cxl_nvb->nvdimm_bus, cxl_nvd, NULL, flags, 0, 0,
21083f51521fb0 Dan Williams 2021-06-15 73 NULL);
fc6fd550b9f1ad Dan Williams 2021-06-17 74 dev_set_drvdata(dev, nvdimm);
fc6fd550b9f1ad Dan Williams 2021-06-17 75 rc = devm_add_action_or_reset(dev, unregister_nvdimm, cxl_nvd);
21083f51521fb0 Dan Williams 2021-06-15 76 out:
21083f51521fb0 Dan Williams 2021-06-15 77 device_unlock(&cxl_nvb->dev);
21083f51521fb0 Dan Williams 2021-06-15 78 put_device(&cxl_nvb->dev);
21083f51521fb0 Dan Williams 2021-06-15 79
fc6fd550b9f1ad Dan Williams 2021-06-17 80 if (!nvdimm && rc == 0)
fc6fd550b9f1ad Dan Williams 2021-06-17 81 rc = -ENOMEM;
fc6fd550b9f1ad Dan Williams 2021-06-17 82
21083f51521fb0 Dan Williams 2021-06-15 83 return rc;
21083f51521fb0 Dan Williams 2021-06-15 84 }
21083f51521fb0 Dan Williams 2021-06-15 85
:::::: The code at line 66 was first introduced by commit
:::::: 21083f51521fb0f60dbac591f175c3ed48435af4 cxl/pmem: Register 'pmem' / cxl_nvdimm devices
:::::: TO: Dan Williams <dan.j.williams@intel.com>
:::::: CC: Dan Williams <dan.j.williams@intel.com>
---
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: 41353 bytes --]
reply other threads:[~2021-08-14 6:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202108141400.cUDQV9sC-lkp@intel.com \
--to=lkp@intel.com \
--cc=alison.schofield@intel.com \
--cc=ben.widawsky@intel.com \
--cc=clang-built-linux@googlegroups.com \
--cc=dan.j.williams@intel.com \
--cc=ira.weiny@intel.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®