We explicitly check whether the value is YES or NO, which makes it unnecessary to make sure it's not ABSENT beforehand. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/qemu/qemu_firmware.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 51223faadf..e459ed9a6c 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1081,31 +1081,25 @@ qemuFirmwareMatchDomain(const virDomainDef *def, if (def->os.firmwareFeatures) { reqSecureBoot = def->os.firmwareFeatures[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_SECURE_BOOT]; - if (reqSecureBoot != VIR_TRISTATE_BOOL_ABSENT) { - if (reqSecureBoot == VIR_TRISTATE_BOOL_YES && !supportsSecureBoot) { - VIR_DEBUG("User requested Secure Boot, firmware '%s' doesn't support it", - path); - return false; - } - - if (reqSecureBoot == VIR_TRISTATE_BOOL_NO && supportsSecureBoot) { - VIR_DEBUG("User refused Secure Boot, firmware '%s' supports it", path); - return false; - } + if (reqSecureBoot == VIR_TRISTATE_BOOL_YES && !supportsSecureBoot) { + VIR_DEBUG("User requested Secure Boot, firmware '%s' doesn't support it", + path); + return false; + } + if (reqSecureBoot == VIR_TRISTATE_BOOL_NO && supportsSecureBoot) { + VIR_DEBUG("User refused Secure Boot, firmware '%s' supports it", path); + return false; } reqEnrolledKeys = def->os.firmwareFeatures[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_ENROLLED_KEYS]; - if (reqEnrolledKeys != VIR_TRISTATE_BOOL_ABSENT) { - if (reqEnrolledKeys == VIR_TRISTATE_BOOL_YES && !hasEnrolledKeys) { - VIR_DEBUG("User requested Enrolled keys, firmware '%s' doesn't have them", - path); - return false; - } - - if (reqEnrolledKeys == VIR_TRISTATE_BOOL_NO && hasEnrolledKeys) { - VIR_DEBUG("User refused Enrolled keys, firmware '%s' has them", path); - return false; - } + if (reqEnrolledKeys == VIR_TRISTATE_BOOL_YES && !hasEnrolledKeys) { + VIR_DEBUG("User requested Enrolled keys, firmware '%s' doesn't have them", + path); + return false; + } + if (reqEnrolledKeys == VIR_TRISTATE_BOOL_NO && hasEnrolledKeys) { + VIR_DEBUG("User refused Enrolled keys, firmware '%s' has them", path); + return false; } } -- 2.35.3