* [rppt:ramdax 1/1] drivers/nvdimm/ramdax.c:89:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true
@ 2025-05-14 21:51 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-05-14 21:51 UTC (permalink / raw)
To: Mike Rapoport (Microsoft); +Cc: llvm, oe-kbuild-all, Mike Rapoport
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-05-14 21:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-14 21:51 [rppt:ramdax 1/1] drivers/nvdimm/ramdax.c:89:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox