@@ -520,6 +520,9 @@ int blk_revalidate_disk_zones(struct gendisk *disk)
sector_t sector = 0;
int ret = 0;
+ if (WARN_ON_ONCE(!blk_queue_is_zoned(q)))
+ return -EIO;
+
/*
* BIO based queues do not use a scheduler so only q->nr_zones
* needs to be updated so that the sysfs exposed value is correct.
@@ -535,10 +538,8 @@ int blk_revalidate_disk_zones(struct gendisk *disk)
*/
noio_flag = memalloc_noio_save();
- if (!blk_queue_is_zoned(q) || !nr_zones) {
- nr_zones = 0;
+ if (!nr_zones)
goto update;
- }
/* Allocate bitmaps */
ret = -ENOMEM;