mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +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))
|
addrStr, flags, true))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = virDomainPCIAddressReserveAddrInternal(addrs, &dev->addr.pci,
|
if (virDomainPCIAddressReserveAddrInternal(addrs, &dev->addr.pci,
|
||||||
flags, dev->isolationGroup,
|
flags, dev->isolationGroup,
|
||||||
true);
|
true) < 0) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = virDomainPCIAddressReserveNextAddr(addrs, dev, flags, -1);
|
if (virDomainPCIAddressReserveNextAddr(addrs, dev, flags, -1) < 0)
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->addr.pci.extFlags = dev->pciAddrExtFlags;
|
dev->addr.pci.extFlags = dev->pciAddrExtFlags;
|
||||||
ret = virDomainPCIAddressExtensionEnsureAddr(addrs, &dev->addr.pci);
|
if (virDomainPCIAddressExtensionEnsureAddr(addrs, &dev->addr.pci) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(addrStr);
|
VIR_FREE(addrStr);
|
||||||
|
Loading…
Reference in New Issue
Block a user