bhyve: use assert for missing TPM version
The TPM version config node should always be set. If it's not set, there's a bug in our code. An assertion is the correct way to check for this. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D40558
This commit is contained in:
parent
71fb2dcb00
commit
b3564c2337
@ -7,6 +7,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
@ -54,7 +55,8 @@ tpm_device_create(struct tpm_device **const new_dev, struct vmctx *const vm_ctx,
|
||||
}
|
||||
|
||||
value = get_config_value_node(nvl, "version");
|
||||
if (value == NULL || strcmp(value, "2.0")) {
|
||||
assert(value != NULL);
|
||||
if (strcmp(value, "2.0")) {
|
||||
warnx("%s: unsupported tpm version %s", __func__, value);
|
||||
error = EINVAL;
|
||||
goto err_out;
|
||||
|
Loading…
Reference in New Issue
Block a user