[bcache:nvdimm-meta 3/12] drivers/md/bcache/nvm-pages.c:204:18: warning: variable 'base_pgoff' set but not used

From: kernel test robot
Date: Mon Jul 26 2021 - 15:39:19 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git nvdimm-meta
head: e9d63ebcb289612237d5a62fa9876114798555eb
commit: 6d4dbab94b60ec3633c4b5a5244e110f36753b6d [3/12] bcache: initialization of the buddy
config: s390-allyesconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 10.3.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/colyli/linux-bcache.git/commit/?id=6d4dbab94b60ec3633c4b5a5244e110f36753b6d
git remote add bcache https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git
git fetch --no-tags bcache nvdimm-meta
git checkout 6d4dbab94b60ec3633c4b5a5244e110f36753b6d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=s390

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/md/bcache/nvm-pages.c: In function 'init_nvmpg_set_header':
>> drivers/md/bcache/nvm-pages.c:204:18: warning: variable 'base_pgoff' set but not used [-Wunused-but-set-variable]
204 | unsigned long base_pgoff;
| ^~~~~~~~~~


vim +/base_pgoff +204 drivers/md/bcache/nvm-pages.c

168
169 /* Namespace 0 contains all meta data of the nvmpg allocation set */
170 static int init_nvmpg_set_header(struct bch_nvmpg_ns *ns)
171 {
172 struct bch_nvmpg_set_header *set_header;
173 struct bch_nvmpg_recs *sys_recs;
174 int i, j, used = 0, rc = 0;
175
176 if (ns->ns_id != 0) {
177 pr_err("unexpected ns_id %u for first nvmpg namespace.\n",
178 ns->ns_id);
179 return -EINVAL;
180 }
181
182 set_header = bch_nvmpg_offset_to_ptr(ns->sb->set_header_offset);
183
184 mutex_lock(&global_nvmpg_set->lock);
185 global_nvmpg_set->set_header = set_header;
186 global_nvmpg_set->heads_size = set_header->size;
187 global_nvmpg_set->heads_used = set_header->used;
188
189 /* Reserve the used space from buddy allocator */
190 reserve_nvmpg_pages(ns, 0, div_u64(ns->pages_offset, ns->page_size));
191
192 sys_recs = ns->base_addr + BCH_NVMPG_SYSRECS_HEAD_OFFSET;
193 for (i = 0; i < set_header->size; i++) {
194 struct bch_nvmpg_head *head;
195
196 head = &set_header->heads[i];
197 if (head->state == BCH_NVMPG_HD_STAT_FREE)
198 continue;
199
200 used++;
201
202 for (j = 0; j < BCH_NVMPG_NS_MAX; j++) {
203 struct bch_nvmpg_recs *recs;
> 204 unsigned long base_pgoff;
205
206 base_pgoff = (unsigned long)ns->base_addr >> PAGE_SHIFT;
207 recs = bch_nvmpg_offset_to_ptr(head->recs_offset[j]);
208
209 /* Iterate the recs list */
210 while (recs) {
211 rc = validate_recs(j, head, recs);
212 if (rc < 0)
213 goto unlock;
214
215 rc = reserve_nvmpg_recs(recs);
216 if (rc < 0)
217 goto unlock;
218
219 bitmap_set(ns->recs_bitmap, recs - sys_recs, 1);
220 recs = bch_nvmpg_offset_to_ptr(recs->next_offset);
221 }
222 }
223 }
224 unlock:
225 mutex_unlock(&global_nvmpg_set->lock);
226 return rc;
227 }
228

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip