[PATCH 2/8] scsi: sd_zbc: Rename a local variable

Bart Van Assche
2022-04-15T20:18:12Z

For zoned storage the word 'capacity' can either refer to the device
capacity or to the zone capacity. Prevent confusion between these two
concepts by renaming 'capacity' into 'device_capacity'.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/sd_zbc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 925976ac5113..d0275855b16c 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -223,7 +223,8 @@ int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
unsigned int nr_zones, report_zones_cb cb, void *data)
{
struct scsi_disk *sdkp = scsi_disk(disk);
- sector_t capacity = logical_to_sectors(sdkp->device, sdkp->capacity);
+ sector_t device_capacity = logical_to_sectors(sdkp->device,
+ sdkp->capacity);
unsigned int nr, i;
unsigned char *buf;
size_t offset, buflen = 0;
@@ -234,7 +235,7 @@ int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
/* Not a zoned device */
return -EOPNOTSUPP;

- if (!capacity)
+ if (!device_capacity)
/* Device gone or invalid */
return -ENODEV;

@@ -242,7 +243,7 @@ int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
if (!buf)
return -ENOMEM;

- while (zone_idx < nr_zones && sector < capacity) {
+ while (zone_idx < nr_zones && sector < device_capacity) {
ret = sd_zbc_do_report_zones(sdkp, buf, buflen,
sectors_to_logical(sdkp->device, sector), true);
if (ret)