mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
conf: Fix error flow in virDomainPCIAddressEnsureAddr()
This avoids setting 'ret' multiple times, which will result
in errors being masked if the first operation fails but the
second one succeeds.
Introduced-by: f183b87fc1
Spotted-by: Coverity
Reported-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
b3a3759b62
commit
9f4abfa601
@ -940,15 +940,21 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
|
||||
addrStr, flags, true))
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainPCIAddressReserveAddrInternal(addrs, &dev->addr.pci,
|
||||
flags, dev->isolationGroup,
|
||||
true);
|
||||
if (virDomainPCIAddressReserveAddrInternal(addrs, &dev->addr.pci,
|
||||
flags, dev->isolationGroup,
|
||||
true) < 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
ret = virDomainPCIAddressReserveNextAddr(addrs, dev, flags, -1);
|
||||
if (virDomainPCIAddressReserveNextAddr(addrs, dev, flags, -1) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dev->addr.pci.extFlags = dev->pciAddrExtFlags;
|
||||
ret = virDomainPCIAddressExtensionEnsureAddr(addrs, &dev->addr.pci);
|
||||
if (virDomainPCIAddressExtensionEnsureAddr(addrs, &dev->addr.pci) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(addrStr);
|
||||
|
Loading…
Reference in New Issue
Block a user