public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block/blk-map: Remove set but unused variable 'added'
@ 2022-09-05  2:25 Jiapeng Chong
  2022-09-05  3:54 ` Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2022-09-05  2:25 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, Jiapeng Chong, Abaci Robot

The variable added is not effectively used in the function, so delete
it.

block/blk-map.c:273:16: warning: variable 'added' set but not used.

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2049
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 block/blk-map.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/blk-map.c b/block/blk-map.c
index 2fbe298d3822..a06919822a73 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -270,7 +270,7 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
 	while (iov_iter_count(iter)) {
 		struct page **pages, *stack_pages[UIO_FASTIOV];
 		ssize_t bytes;
-		size_t offs, added = 0;
+		size_t offs = 0;
 		int npages;
 
 		if (nr_vecs <= ARRAY_SIZE(stack_pages)) {
@@ -306,7 +306,6 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
 					break;
 				}
 
-				added += n;
 				bytes -= n;
 				offs = 0;
 			}
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block/blk-map: Remove set but unused variable 'added'
  2022-09-05  2:25 [PATCH] block/blk-map: Remove set but unused variable 'added' Jiapeng Chong
@ 2022-09-05  3:54 ` Damien Le Moal
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2022-09-05  3:54 UTC (permalink / raw)
  To: Jiapeng Chong, axboe; +Cc: linux-block, linux-kernel, Abaci Robot

On 9/5/22 11:25, Jiapeng Chong wrote:
> The variable added is not effectively used in the function, so delete
> it.
> 
> block/blk-map.c:273:16: warning: variable 'added' set but not used.
> 
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2049
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  block/blk-map.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/block/blk-map.c b/block/blk-map.c
> index 2fbe298d3822..a06919822a73 100644
> --- a/block/blk-map.c
> +++ b/block/blk-map.c
> @@ -270,7 +270,7 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
>  	while (iov_iter_count(iter)) {
>  		struct page **pages, *stack_pages[UIO_FASTIOV];
>  		ssize_t bytes;
> -		size_t offs, added = 0;
> +		size_t offs = 0;

offs is initialized with the call to iov_iter_get_pages_alloc2() so I do
not think it needs to be initialized to 0 here, unless you have a compiler
or sparse warning. If that is the case, this should be mentioned in the
commit message too.

>  		int npages;
>  
>  		if (nr_vecs <= ARRAY_SIZE(stack_pages)) {
> @@ -306,7 +306,6 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
>  					break;
>  				}
>  
> -				added += n;
>  				bytes -= n;
>  				offs = 0;
>  			}

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-05  3:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-05  2:25 [PATCH] block/blk-map: Remove set but unused variable 'added' Jiapeng Chong
2022-09-05  3:54 ` Damien Le Moal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox