Skip to content

Commit

Permalink
xen-dom-mgmt: change xstat result "if" check to assert
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Volodymyr Babchuk <[email protected]>
  • Loading branch information
firscity committed Apr 16, 2024
1 parent 3662bce commit 4c238f8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions xen-dom-mgmt/src/xen-dom-mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 4c238f8

Please sign in to comment.