On Fri, Jun 08, 2018 at 09:40:55AM -0500, Brijesh Singh wrote:
Signed-off-by: Brijesh Singh <<brijesh.singh(a)amd.com>>
---
src/qemu/qemu_capabilities.c | 7 ++++
src/qemu/qemu_capabilities.h | 4 +++
src/qemu/qemu_driver.c | 82 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 93 insertions(+)
...
+
+static int
+qemuNodeGetSEVInfo(virConnectPtr conn,
+ virTypedParameterPtr *params,
+ int *nparams,
+ unsigned int flags)
+{
+ virQEMUDriverPtr driver = conn->privateData;
+ virCapsPtr caps = NULL;
+ virQEMUCapsPtr qemucaps = NULL;
+ int ret = -1;
+
+ if (virNodeGetSevInfoEnsureACL(conn) < 0)
+ return ret;
+
+ if (!(caps = virQEMUDriverGetCapabilities(driver, true)))
you don't need ^this, I'll remove it before merging...
+ return ret;
+
+ qemucaps = virQEMUCapsCacheLookupByArch(driver->qemuCapsCache,
+ virArchFromHost());
+ if (!qemucaps)
+ goto cleanup;
+
+ if (!virQEMUCapsGet(qemucaps, QEMU_CAPS_SEV_GUEST)) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("QEMU does not support SEV guest"));
+ goto cleanup;
+ }
+
+ if (qemuGetSEVInfoToParams(qemucaps, params, nparams, flags) < 0)
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ virObjectUnref(qemucaps);
+ virObjectUnref(caps);
...neither ^this single unref (and the variable itself for that matter)...
Erik