From: Klaus Jensen <k.jen...@samsung.com>

The Maximum Open Resources field shall be less than or equal to the
Maximum Active Resources field.

Verify that constraint and remove the redundant check that the Maximum
Open Resources field does not exceed the number of zones.

Cc: Dmitry Fomichev <dmitry.fomic...@wdc.com>
Reported-by: Gollu Appalanaidu <anaidu.go...@samsung.com>
Signed-off-by: Klaus Jensen <k.jen...@samsung.com>
---
 hw/block/nvme-ns.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c
index 62b25cf69bfa..9586f7f33b8c 100644
--- a/hw/block/nvme-ns.c
+++ b/hw/block/nvme-ns.c
@@ -140,12 +140,6 @@ static int nvme_ns_zoned_check_calc_geometry(NvmeNamespace 
*ns, Error **errp)
         return -1;
     }
 
-    if (ns->params.max_open_zones > ns->num_zones) {
-        error_setg(errp,
-                   "max_open_zones value %u exceeds the number of zones %u",
-                   ns->params.max_open_zones, ns->num_zones);
-        return -1;
-    }
     if (ns->params.max_active_zones > ns->num_zones) {
         error_setg(errp,
                    "max_active_zones value %u exceeds the number of zones %u",
@@ -153,6 +147,12 @@ static int nvme_ns_zoned_check_calc_geometry(NvmeNamespace 
*ns, Error **errp)
         return -1;
     }
 
+    if (ns->params.max_open_zones > ns->params.max_active_zones) {
+        error_setg(errp, "max_open_zones (%u) exceeds max_active_zones (%u)",
+                   ns->params.max_open_zones, ns->params.max_active_zones);
+        return -1;
+    }
+
     if (ns->params.zd_extension_size) {
         if (ns->params.zd_extension_size & 0x3f) {
             error_setg(errp,
-- 
2.30.0


Reply via email to