Since each code path ensures that @parseOpaque cannot be NULL, we can
use the argument instead of using virQEMUCapsCacheLookup where the
QEMU capabilities may have been changed during the libvirt job.
Signed-off-by: Marc Hartmayer <mhartmay(a)linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
---
src/qemu/qemu_domain.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 2096a2a39ac5..05641b3dceb8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5790,16 +5790,11 @@ qemuDomainDeviceDefValidateInput(const virDomainInputDef *input,
static int
qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
const virDomainDef *def,
- void *opaque,
- void *parseOpaque ATTRIBUTE_UNUSED)
+ void *opaque ATTRIBUTE_UNUSED,
+ void *parseOpaque)
{
int ret = 0;
- virQEMUDriverPtr driver = opaque;
- virQEMUCapsPtr qemuCaps = NULL;
-
- if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
- def->emulator)))
- return -1;
+ virQEMUCapsPtr qemuCaps = parseOpaque;
switch ((virDomainDeviceType)dev->type) {
case VIR_DOMAIN_DEVICE_NET:
@@ -5876,7 +5871,6 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
break;
}
- virObjectUnref(qemuCaps);
return ret;
}
--
2.17.0