diff mbox series

[05/23] target/sbc: get rid of the warning in cmp & write

Message ID 20210228055645.22253-6-chaitanya.kulkarni@wdc.com
State New
Headers show
Series [01/23] target/iblock: remove an extra argument | expand

Commit Message

Chaitanya Kulkarni Feb. 28, 2021, 5:56 a.m. UTC
Rename the function local variable i -> sg_cnt so we can get rid of the
shadow variable compilation warning:-

drivers/target//target_core_sbc.c: In function ‘compare_and_write_do_cmp’:
drivers/target//target_core_sbc.c:475:17: warning: declaration of ‘i’ shadows a previous local [-Wshadow]
    unsigned int i;
                 ^
drivers/target//target_core_sbc.c:451:6: note: shadowed declaration is here
  int i;
      ^
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/target/target_core_sbc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Johannes Thumshirn March 1, 2021, 12:51 p.m. UTC | #1
Oops,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index f7c527a826fd..7b07e557dc8d 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -448,7 +448,7 @@  compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
 	sense_reason_t ret;
 	unsigned int offset;
 	size_t rc;
-	int i;
+	int sg_cnt;
 
 	buf = kzalloc(cmp_len, GFP_KERNEL);
 	if (!buf) {
@@ -467,7 +467,7 @@  compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
 	 */
 	offset = 0;
 	ret = TCM_NO_SENSE;
-	for_each_sg(read_sgl, sg, read_nents, i) {
+	for_each_sg(read_sgl, sg, read_nents, sg_cnt) {
 		unsigned int len = min(sg->length, cmp_len);
 		unsigned char *addr = kmap_atomic(sg_page(sg));