These functions can't fail really. Drop checking of their retval then. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/hyperv/hyperv_driver.c | 9 +++------ src/hyperv/hyperv_wmi.c | 21 ++++++++------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 542253b8b8..eb35cf6115 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -1378,11 +1378,9 @@ hypervDomainSendKey(virDomainPtr domain, unsigned int codeset, } } - if (virAsprintf(&selector, - "CreationClassName=Msvm_Keyboard&DeviceID=%s&" + virAsprintf(&selector, "CreationClassName=Msvm_Keyboard&DeviceID=%s&" "SystemCreationClassName=Msvm_ComputerSystem&" - "SystemName=%s", keyboard->data.common->DeviceID, uuid_string) < 0) - goto cleanup; + "SystemName=%s", keyboard->data.common->DeviceID, uuid_string); /* press the keys */ for (i = 0; i < nkeycodes; i++) { @@ -1464,8 +1462,7 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory, virCheckFlags(0, -1); - if (virAsprintf(&memory_str, "%lu", memory_mb) < 0) - goto cleanup; + virAsprintf(&memory_str, "%lu", memory_mb); virUUIDFormat(domain->uuid, uuid_string); diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index 04f82389c1..c0c9b7f77e 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -439,8 +439,7 @@ hypervCreateInvokeXmlDoc(hypervInvokeParamsListPtr params, WsXmlDocH *docRoot) char *method = NULL; WsXmlNodeH xmlNodeMethod = NULL; - if (virAsprintf(&method, "%s_INPUT", params->method) < 0) - goto cleanup; + virAsprintf(&method, "%s_INPUT", params->method); *docRoot = ws_xml_create_doc(NULL, method); if (*docRoot == NULL) { @@ -849,9 +848,9 @@ hypervInvokeMethod(hypervPrivate *priv, hypervInvokeParamsListPtr params, params->method, paramsDocRoot); /* check return code of invocation */ - if (virAsprintf(&returnValue_xpath, "/s:Envelope/s:Body/p:%s_OUTPUT/p:ReturnValue", - params->method) < 0) - goto cleanup; + virAsprintf(&returnValue_xpath, + "/s:Envelope/s:Body/p:%s_OUTPUT/p:ReturnValue", + params->method); returnValue = ws_xml_get_xpath_value(response, returnValue_xpath); if (!returnValue) { @@ -865,12 +864,10 @@ hypervInvokeMethod(hypervPrivate *priv, hypervInvokeParamsListPtr params, goto cleanup; if (returnCode == CIM_RETURNCODE_TRANSITION_STARTED) { - if (virAsprintf(&jobcode_instance_xpath, + virAsprintf(&jobcode_instance_xpath, "/s:Envelope/s:Body/p:%s_OUTPUT/p:Job/a:ReferenceParameters/" "w:SelectorSet/w:Selector[@Name='InstanceID']", - params->method) < 0) { - goto cleanup; - } + params->method); instanceID = ws_xml_get_xpath_value(response, jobcode_instance_xpath); if (!instanceID) { @@ -1341,10 +1338,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain, virUUIDFormat(domain->uuid, uuid_string); - if (virAsprintf(&selector, "Name=%s&CreationClassName=Msvm_ComputerSystem", - uuid_string) < 0 || - virAsprintf(&properties, "RequestedState=%d", requestedState) < 0) - goto cleanup; + virAsprintf(&selector, "Name=%s&CreationClassName=Msvm_ComputerSystem", uuid_string); + virAsprintf(&properties, "RequestedState=%d", requestedState); if (priv->wmiVersion == HYPERV_WMI_VERSION_V1) resourceUri = MSVM_COMPUTERSYSTEM_V1_RESOURCE_URI; -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list