mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
Return directly from qemuDomainAttachChrDeviceAssignAddr
This function should never need a cleanup section.
This commit is contained in:
parent
ac518960a6
commit
c11586940c
@ -1762,47 +1762,40 @@ qemuDomainAttachChrDeviceAssignAddr(virDomainObjPtr vm,
|
|||||||
{
|
{
|
||||||
virDomainDefPtr def = vm->def;
|
virDomainDefPtr def = vm->def;
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
|
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
|
||||||
chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) {
|
chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) {
|
||||||
if (virDomainVirtioSerialAddrAutoAssign(def, &chr->info, true) < 0)
|
if (virDomainVirtioSerialAddrAutoAssign(def, &chr->info, true) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
ret = 1;
|
return 1;
|
||||||
|
|
||||||
} else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
} else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
||||||
chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI) {
|
chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI) {
|
||||||
if (virDomainPCIAddressEnsureAddr(priv->pciaddrs, &chr->info) < 0)
|
if (virDomainPCIAddressEnsureAddr(priv->pciaddrs, &chr->info) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
ret = 1;
|
return 1;
|
||||||
|
|
||||||
} else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
} else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
||||||
chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB) {
|
chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB) {
|
||||||
if (virDomainUSBAddressEnsure(priv->usbaddrs, &chr->info) < 0)
|
if (virDomainUSBAddressEnsure(priv->usbaddrs, &chr->info) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
ret = 1;
|
return 1;
|
||||||
|
|
||||||
} else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
|
} else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
|
||||||
chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) {
|
chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) {
|
||||||
if (virDomainVirtioSerialAddrAutoAssign(def, &chr->info, false) < 0)
|
if (virDomainVirtioSerialAddrAutoAssign(def, &chr->info, false) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
ret = 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 1)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL ||
|
if (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL ||
|
||||||
chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Unsupported address type for character device"));
|
_("Unsupported address type for character device"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int qemuDomainAttachChrDevice(virConnectPtr conn,
|
int qemuDomainAttachChrDevice(virConnectPtr conn,
|
||||||
|
Loading…
Reference in New Issue
Block a user