[PATCH 02/13] block: cleanup blkdev_report_zones()

Damien Le Moal
2025-10-31T06:16:58Z

The variable capacity is used only in one place and so can be removed
and get_capacity(disk) used directly instead.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
block/blk-zoned.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index f3b371056df4..8d2111879328 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -156,7 +156,6 @@ int blkdev_report_zones(struct block_device *bdev, sector_t sector,
unsigned int nr_zones, report_zones_cb cb, void *data)
{
struct gendisk *disk = bdev->bd_disk;
- sector_t capacity = get_capacity(disk);
struct disk_report_zones_cb_args args = {
.disk = disk,
.user_cb = cb,
@@ -166,7 +165,7 @@ int blkdev_report_zones(struct block_device *bdev, sector_t sector,
if (!bdev_is_zoned(bdev) || WARN_ON_ONCE(!disk->fops->report_zones))
return -EOPNOTSUPP;

- if (!nr_zones || sector >= capacity)
+ if (!nr_zones || sector >= get_capacity(disk))
return 0;

return disk->fops->report_zones(disk, sector, nr_zones,
--
2.51.0