Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libnvdimm/btt: fix variable 'rc' set but not used

drivers/nvdimm/btt.c: In function 'btt_read_pg':
drivers/nvdimm/btt.c:1264:8: warning: variable 'rc' set but not used
[-Wunused-but-set-variable]
int rc;
^~

Add a ratelimited message in case a storm of errors is encountered.

Fixes: d9b83c756953 ("libnvdimm, btt: rework error clearing")
Signed-off-by: Qian Cai <cai@lca.pw>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Link: https://lore.kernel.org/r/1572530719-32161-1-git-send-email-cai@lca.pw
Signed-off-by: Dan Williams <dan.j.williams@intel.com>

authored by

Qian Cai and committed by
Dan Williams
4e24e37d d7c0d927

+4 -4
+4 -4
drivers/nvdimm/btt.c
··· 1261 1261 1262 1262 ret = btt_data_read(arena, page, off, postmap, cur_len); 1263 1263 if (ret) { 1264 - int rc; 1265 - 1266 1264 /* Media error - set the e_flag */ 1267 - rc = btt_map_write(arena, premap, postmap, 0, 1, 1268 - NVDIMM_IO_ATOMIC); 1265 + if (btt_map_write(arena, premap, postmap, 0, 1, NVDIMM_IO_ATOMIC)) 1266 + dev_warn_ratelimited(to_dev(arena), 1267 + "Error persistently tracking bad blocks at %#x\n", 1268 + premap); 1269 1269 goto out_rtt; 1270 1270 } 1271 1271