nvdimm/btt: fix variable 'rc' set but not used
PATCH 1/1 nvdimm/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 <[email protected]>
--- drivers/nvdimm/btt.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/nvdimm/btt.c +5 -0
@@ -1266,6 +1266,11 @@ static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip,/* Media error - set the e_flag */ rc =btt_map_write (arena, premap, postmap,0 ,1 ,NVDIMM_IO_ATOMIC ); + +if (rc) +dev_warn_ratelimited (to_dev (arena), +"Error persistently tracking bad blocks\n" ); + goto out_rtt; }
Signature · 1 line
1.8.3.1
Quoted 20 lines · Qian Cai
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 <[email protected]>--- drivers/nvdimm/btt.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/nvdimm/btt.c +0
-0
drivers/nvdimm/btt.c static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip, · line 1272
Quoted 7 lines
drivers/nvdimm/btt.c +4
-0@@ -1266,6 +1266,11 @@ static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip,/* Media error - set the e_flag */ rc =btt_map_write (arena, premap, postmap,0 ,1 ,NVDIMM_IO_ATOMIC ); + +if (rc) +dev_warn_ratelimited (to_dev (arena), +"Error persistently tracking bad blocks\n" );
If the driver is going to warn about bad blocks it should at least include the block address that is returning an error.