linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] scsi: sd_zbc: Remove set but not used variable 'buflen'
@ 2019-11-15 13:18 YueHaibing
  2019-11-17 23:56 ` Damien Le Moal
  2019-11-18 15:33 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: YueHaibing @ 2019-11-15 13:18 UTC (permalink / raw)
  To: James E . J . Bottomley, Damien Le Moal, Jens Axboe, Martin K. Petersen
  Cc: YueHaibing, linux-scsi, linux-block, linux-kernel,
	kernel-janitors, Hulk Robot

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/scsi/sd_zbc.c: In function 'sd_zbc_check_zones':
drivers/scsi/sd_zbc.c:341:9: warning:
 variable 'buflen' set but not used [-Wunused-but-set-variable]

It is not used since commit d9dd73087a8b ("block: Enhance
blk_revalidate_disk_zones()")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/scsi/sd_zbc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 23281825ec38..0e5ede48f045 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -338,7 +338,6 @@ static int sd_zbc_check_zoned_characteristics(struct scsi_disk *sdkp,
 static int sd_zbc_check_zones(struct scsi_disk *sdkp, unsigned char *buf,
 			      u32 *zblocks)
 {
-	size_t buflen;
 	u64 zone_blocks = 0;
 	sector_t max_lba;
 	unsigned char *rec;
@@ -363,7 +362,6 @@ static int sd_zbc_check_zones(struct scsi_disk *sdkp, unsigned char *buf,
 	}
 
 	/* Parse REPORT ZONES header */
-	buflen = min_t(size_t, get_unaligned_be32(&buf[0]) + 64, SD_BUF_SIZE);
 	rec = buf + 64;
 	zone_blocks = get_unaligned_be64(&rec[8]);
 	if (!zone_blocks || !is_power_of_2(zone_blocks)) {




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

* Re: [PATCH -next] scsi: sd_zbc: Remove set but not used variable 'buflen'
  2019-11-15 13:18 [PATCH -next] scsi: sd_zbc: Remove set but not used variable 'buflen' YueHaibing
@ 2019-11-17 23:56 ` Damien Le Moal
  2019-11-18 15:33 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2019-11-17 23:56 UTC (permalink / raw)
  To: YueHaibing, James E . J . Bottomley, Jens Axboe, Martin K. Petersen
  Cc: linux-scsi, linux-block, linux-kernel, kernel-janitors, Hulk Robot

On 2019/11/15 22:20, YueHaibing wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/scsi/sd_zbc.c: In function 'sd_zbc_check_zones':
> drivers/scsi/sd_zbc.c:341:9: warning:
>  variable 'buflen' set but not used [-Wunused-but-set-variable]
> 
> It is not used since commit d9dd73087a8b ("block: Enhance
> blk_revalidate_disk_zones()")
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/scsi/sd_zbc.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
> index 23281825ec38..0e5ede48f045 100644
> --- a/drivers/scsi/sd_zbc.c
> +++ b/drivers/scsi/sd_zbc.c
> @@ -338,7 +338,6 @@ static int sd_zbc_check_zoned_characteristics(struct scsi_disk *sdkp,
>  static int sd_zbc_check_zones(struct scsi_disk *sdkp, unsigned char *buf,
>  			      u32 *zblocks)
>  {
> -	size_t buflen;
>  	u64 zone_blocks = 0;
>  	sector_t max_lba;
>  	unsigned char *rec;
> @@ -363,7 +362,6 @@ static int sd_zbc_check_zones(struct scsi_disk *sdkp, unsigned char *buf,
>  	}
>  
>  	/* Parse REPORT ZONES header */
> -	buflen = min_t(size_t, get_unaligned_be32(&buf[0]) + 64, SD_BUF_SIZE);
>  	rec = buf + 64;
>  	zone_blocks = get_unaligned_be64(&rec[8]);
>  	if (!zone_blocks || !is_power_of_2(zone_blocks)) {

Good catch !

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>

-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH -next] scsi: sd_zbc: Remove set but not used variable 'buflen'
  2019-11-15 13:18 [PATCH -next] scsi: sd_zbc: Remove set but not used variable 'buflen' YueHaibing
  2019-11-17 23:56 ` Damien Le Moal
@ 2019-11-18 15:33 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2019-11-18 15:33 UTC (permalink / raw)
  To: YueHaibing, James E . J . Bottomley, Damien Le Moal, Martin K. Petersen
  Cc: linux-scsi, linux-block, linux-kernel, kernel-janitors, Hulk Robot

On 11/15/19 6:18 AM, YueHaibing wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/scsi/sd_zbc.c: In function 'sd_zbc_check_zones':
> drivers/scsi/sd_zbc.c:341:9: warning:
>   variable 'buflen' set but not used [-Wunused-but-set-variable]
> 
> It is not used since commit d9dd73087a8b ("block: Enhance
> blk_revalidate_disk_zones()")

Applied, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2019-11-18 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15 13:18 [PATCH -next] scsi: sd_zbc: Remove set but not used variable 'buflen' YueHaibing
2019-11-17 23:56 ` Damien Le Moal
2019-11-18 15:33 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).