From ed014cd94aafa2c660643b370bbfde33a552924d Mon Sep 17 00:00:00 2001 From: Dmytro Firsov Date: Thu, 11 Apr 2024 20:20:34 +0300 Subject: [PATCH] xen-dom-mgmt: change xstat result "if" check to assert Result from xstat sysctl was tested on 0, which stands for 0 active domains. This condition is theoretically impossible in Dom0 and definitely not a valid state, so change it to ASSERT instead of if condition. Signed-off-by: Dmytro Firsov --- xen-dom-mgmt/src/xen-dom-mgmt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/xen-dom-mgmt/src/xen-dom-mgmt.c b/xen-dom-mgmt/src/xen-dom-mgmt.c index fbbff101..b01aa97c 100644 --- a/xen-dom-mgmt/src/xen-dom-mgmt.c +++ b/xen-dom-mgmt/src/xen-dom-mgmt.c @@ -916,13 +916,11 @@ static int init_domain0(const struct device *d) } ret = xstat_getdominfo(dom0stat, 0, 1); + /* Zero means no domains, theoretically impossible */ + __ASSERT_NO_MSG(ret); if (ret < 0) { LOG_ERR("Failed to get info for dom0 (rc=%d)", ret); goto out; - } else if (ret == 0) { - /* Theoretically impossible */ - ret = -EINVAL; - goto out; } #endif