From: kernel test robot <lkp@intel.com>
To: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Mike Rapoport <rppt@kernel.org>
Subject: [rppt:ramdax 1/1] drivers/nvdimm/ramdax.c:89:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true
Date: Thu, 15 May 2025 05:51:47 +0800 [thread overview]
Message-ID: <202505150504.66GhNnqk-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git ramdax
head: 0b81d6e851e5acf76aba4697db1281798bedbec8
commit: 0b81d6e851e5acf76aba4697db1281798bedbec8 [1/1] nvdimm: allow exposing RAM carveouts as NVDIMM devices
config: x86_64-buildonly-randconfig-003-20250515 (https://download.01.org/0day-ci/archive/20250515/202505150504.66GhNnqk-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250515/202505150504.66GhNnqk-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505150504.66GhNnqk-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/nvdimm/ramdax.c:89:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
89 | if (!dimm->label_area)
| ^~~~~~~~~~~~~~~~~
drivers/nvdimm/ramdax.c:117:9: note: uninitialized use occurs here
117 | return err;
| ^~~
drivers/nvdimm/ramdax.c:89:2: note: remove the 'if' if its condition is always false
89 | if (!dimm->label_area)
| ^~~~~~~~~~~~~~~~~~~~~~
90 | goto err_free_dimm;
| ~~~~~~~~~~~~~~~~~~
drivers/nvdimm/ramdax.c:81:9: note: initialize the variable 'err' to silence this warning
81 | int err;
| ^
| = 0
1 warning generated.
vim +89 drivers/nvdimm/ramdax.c
73
74 static int ramdax_register_dimm(struct resource *res, void *data)
75 {
76 resource_size_t start = res->start;
77 resource_size_t size = resource_size(res);
78 unsigned long flags = 0, cmd_mask = 0;
79 struct nvdimm_bus *nvdimm_bus = data;
80 struct ramdax_dimm *dimm;
81 int err;
82
83 dimm = kzalloc(sizeof(*dimm), GFP_KERNEL);
84 if (!dimm)
85 return -ENOMEM;
86
87 dimm->label_area = memremap(start + size - LABEL_AREA_SIZE,
88 LABEL_AREA_SIZE, MEMREMAP_WB);
> 89 if (!dimm->label_area)
90 goto err_free_dimm;
91
92 set_bit(NDD_LABELING, &flags);
93 set_bit(NDD_REGISTER_SYNC, &flags);
94 set_bit(ND_CMD_GET_CONFIG_SIZE, &cmd_mask);
95 set_bit(ND_CMD_GET_CONFIG_DATA, &cmd_mask);
96 set_bit(ND_CMD_SET_CONFIG_DATA, &cmd_mask);
97 dimm->nvdimm = nvdimm_create(nvdimm_bus, dimm,
98 /* dimm_attribute_groups */ NULL,
99 flags, cmd_mask, 0, NULL);
100 if (!dimm->nvdimm) {
101 err = -ENOMEM;
102 goto err_unmap_label;
103 }
104
105 err = ramdax_register_region(res, dimm->nvdimm, nvdimm_bus);
106 if (err)
107 goto err_remove_nvdimm;
108
109 return 0;
110
111 err_remove_nvdimm:
112 nvdimm_delete(dimm->nvdimm);
113 err_unmap_label:
114 memunmap(dimm->label_area);
115 err_free_dimm:
116 kfree(dimm);
117 return err;
118 }
119
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2025-05-14 21:52 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=202505150504.66GhNnqk-lkp@intel.com \
--to=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=rppt@kernel.org \
/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