From: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/hyperv/hyperv_driver.c | 15 ++++++--------- src/hyperv/hyperv_wmi.c | 18 ++++-------------- src/hyperv/hyperv_wmi.h | 8 ++++---- 3 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 52e2ac111c..50b4c88939 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -3054,9 +3054,8 @@ hypervDomainDefineXMLFlags(virConnectPtr conn, } } - if (hypervAddEmbeddedParam(params, "SystemSettings", - &defineSystemParam, Msvm_VirtualSystemSettingData_WmiInfo) < 0) - goto error; + hypervAddEmbeddedParam(params, "SystemSettings", + &defineSystemParam, Msvm_VirtualSystemSettingData_WmiInfo); /* create the VM */ if (hypervInvokeMethod(priv, ¶ms, NULL) < 0) @@ -3312,9 +3311,8 @@ hypervDomainSetAutostart(virDomainPtr domain, int autostart) if (hypervSetEmbeddedProperty(autostartParam, "InstanceID", vssd->data->InstanceID) < 0) return -1; - if (hypervAddEmbeddedParam(params, "SystemSettings", - &autostartParam, Msvm_VirtualSystemSettingData_WmiInfo) < 0) - return -1; + hypervAddEmbeddedParam(params, "SystemSettings", + &autostartParam, Msvm_VirtualSystemSettingData_WmiInfo); if (hypervInvokeMethod(priv, ¶ms, NULL) < 0) return -1; @@ -4250,9 +4248,8 @@ hypervDomainSnapshotCreateXML(virDomainPtr domain, HYPERV_SNAPSHOT_CONSISTENCY_CRASH_CONSISTENT) < 0) return NULL; - if (hypervAddEmbeddedParam(params, "SnapshotSettings", &snapshotSettings, - Msvm_VirtualSystemSnapshotSettingData_WmiInfo) < 0) - return NULL; + hypervAddEmbeddedParam(params, "SnapshotSettings", &snapshotSettings, + Msvm_VirtualSystemSnapshotSettingData_WmiInfo); hypervAddSimpleParam(params, "SnapshotType", HYPERV_SNAPSHOT_TYPE_FULL); diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index 30ff81d83e..c669ecd8f9 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -314,11 +314,9 @@ hypervSetEmbeddedProperty(GHashTable *table, * Add a GHashTable containing object properties as an embedded param to * an invocation list. * - * Upon successful return the @table is consumed and the pointer is cleared out. - * - * Returns -1 on failure, 0 on success. + * Upon return the @table is consumed and the pointer is cleared out. */ -int +void hypervAddEmbeddedParam(hypervInvokeParamsList *params, const char *name, GHashTable **table, @@ -334,8 +332,6 @@ hypervAddEmbeddedParam(hypervInvokeParamsList *params, p->embedded.table = g_steal_pointer(table); p->embedded.info = classInfo; params->nbParams++; - - return 0; } @@ -1731,10 +1727,7 @@ hypervMsvmVSMSAddResourceSettings(virDomainPtr domain, hypervAddEprParam(params, "AffectedConfiguration", &eprQuery, Msvm_VirtualSystemSettingData_WmiInfo); - if (hypervAddEmbeddedParam(params, "ResourceSettings", &resourceSettings, wmiInfo) < 0) { - hypervFreeEmbeddedParam(resourceSettings); - return -1; - } + hypervAddEmbeddedParam(params, "ResourceSettings", &resourceSettings, wmiInfo); if (hypervInvokeMethod(priv, ¶ms, response) < 0) return -1; @@ -1760,10 +1753,7 @@ hypervMsvmVSMSModifyResourceSettings(hypervPrivate *priv, if (!params) return -1; - if (hypervAddEmbeddedParam(params, "ResourceSettings", &resourceSettings, wmiInfo) < 0) { - hypervFreeEmbeddedParam(resourceSettings); - return -1; - } + hypervAddEmbeddedParam(params, "ResourceSettings", &resourceSettings, wmiInfo); if (hypervInvokeMethod(priv, ¶ms, NULL) < 0) return -1; diff --git a/src/hyperv/hyperv_wmi.h b/src/hyperv/hyperv_wmi.h index c769ac4db0..c5cd34b411 100644 --- a/src/hyperv/hyperv_wmi.h +++ b/src/hyperv/hyperv_wmi.h @@ -155,10 +155,10 @@ int hypervSetEmbeddedProperty(GHashTable *table, const char *name, const char *value); -int hypervAddEmbeddedParam(hypervInvokeParamsList *params, - const char *name, - GHashTable **table, - hypervWmiClassInfo *info); +void hypervAddEmbeddedParam(hypervInvokeParamsList *params, + const char *name, + GHashTable **table, + hypervWmiClassInfo *info); void hypervFreeEmbeddedParam(GHashTable *p); -- 2.54.0