mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: remove unneeded cleanup:/ret in virpci.c
These were nops once enough cleanup was g_auto'd. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
ca35e8dad1
commit
668dd10ba9
@ -1849,7 +1849,6 @@ typedef virPCIDeviceAddressList *virPCIDeviceAddressListPtr;
|
|||||||
static int
|
static int
|
||||||
virPCIGetIOMMUGroupAddressesAddOne(virPCIDeviceAddressPtr newDevAddr, void *opaque)
|
virPCIGetIOMMUGroupAddressesAddOne(virPCIDeviceAddressPtr newDevAddr, void *opaque)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
virPCIDeviceAddressListPtr addrList = opaque;
|
virPCIDeviceAddressListPtr addrList = opaque;
|
||||||
g_autofree virPCIDeviceAddressPtr copyAddr = NULL;
|
g_autofree virPCIDeviceAddressPtr copyAddr = NULL;
|
||||||
|
|
||||||
@ -1860,11 +1859,9 @@ virPCIGetIOMMUGroupAddressesAddOne(virPCIDeviceAddressPtr newDevAddr, void *opaq
|
|||||||
|
|
||||||
if (VIR_APPEND_ELEMENT(*addrList->iommuGroupDevices,
|
if (VIR_APPEND_ELEMENT(*addrList->iommuGroupDevices,
|
||||||
*addrList->nIommuGroupDevices, copyAddr) < 0)
|
*addrList->nIommuGroupDevices, copyAddr) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2243,7 +2240,6 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
|
|||||||
size_t *num_virtual_functions,
|
size_t *num_virtual_functions,
|
||||||
unsigned int *max_virtual_functions)
|
unsigned int *max_virtual_functions)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
g_autofree char *totalvfs_file = NULL;
|
g_autofree char *totalvfs_file = NULL;
|
||||||
g_autofree char *totalvfs_str = NULL;
|
g_autofree char *totalvfs_str = NULL;
|
||||||
@ -2290,16 +2286,14 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
|
|||||||
|
|
||||||
VIR_DEBUG("Found %zu virtual functions for %s",
|
VIR_DEBUG("Found %zu virtual functions for %s",
|
||||||
*num_virtual_functions, sysfs_path);
|
*num_virtual_functions, sysfs_path);
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
error:
|
error:
|
||||||
for (i = 0; i < *num_virtual_functions; i++)
|
for (i = 0; i < *num_virtual_functions; i++)
|
||||||
VIR_FREE((*virtual_functions)[i]);
|
VIR_FREE((*virtual_functions)[i]);
|
||||||
VIR_FREE(*virtual_functions);
|
VIR_FREE(*virtual_functions);
|
||||||
*num_virtual_functions = 0;
|
*num_virtual_functions = 0;
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2489,22 +2483,21 @@ virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
|
|||||||
g_autofree char *pf_sysfs_device_path = NULL;
|
g_autofree char *pf_sysfs_device_path = NULL;
|
||||||
g_autofree char *vfname = NULL;
|
g_autofree char *vfname = NULL;
|
||||||
g_autofree char *vfPhysPortID = NULL;
|
g_autofree char *vfPhysPortID = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (virPCIGetPhysicalFunction(vf_sysfs_device_path, &pf_config_address) < 0)
|
if (virPCIGetPhysicalFunction(vf_sysfs_device_path, &pf_config_address) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!pf_config_address)
|
if (!pf_config_address)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virPCIDeviceAddressGetSysfsFile(pf_config_address,
|
if (virPCIDeviceAddressGetSysfsFile(pf_config_address,
|
||||||
&pf_sysfs_device_path) < 0) {
|
&pf_sysfs_device_path) < 0) {
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virPCIGetVirtualFunctionIndex(pf_sysfs_device_path,
|
if (virPCIGetVirtualFunctionIndex(pf_sysfs_device_path,
|
||||||
vf_sysfs_device_path, vf_index) < 0) {
|
vf_sysfs_device_path, vf_index) < 0) {
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the caller hasn't asked for a specific pfNetDevIdx, and VF
|
/* If the caller hasn't asked for a specific pfNetDevIdx, and VF
|
||||||
@ -2516,18 +2509,18 @@ virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
|
|||||||
*/
|
*/
|
||||||
if (pfNetDevIdx == -1) {
|
if (pfNetDevIdx == -1) {
|
||||||
if (virPCIGetNetName(vf_sysfs_device_path, 0, NULL, &vfname) < 0)
|
if (virPCIGetNetName(vf_sysfs_device_path, 0, NULL, &vfname) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (vfname) {
|
if (vfname) {
|
||||||
if (virNetDevGetPhysPortID(vfname, &vfPhysPortID) < 0)
|
if (virNetDevGetPhysPortID(vfname, &vfPhysPortID) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
pfNetDevIdx = 0;
|
pfNetDevIdx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virPCIGetNetName(pf_sysfs_device_path,
|
if (virPCIGetNetName(pf_sysfs_device_path,
|
||||||
pfNetDevIdx, vfPhysPortID, pfname) < 0) {
|
pfNetDevIdx, vfPhysPortID, pfname) < 0) {
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*pfname) {
|
if (!*pfname) {
|
||||||
@ -2537,12 +2530,10 @@ virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("The PF device for VF %s has no network device name"),
|
_("The PF device for VF %s has no network device name"),
|
||||||
vf_sysfs_device_path);
|
vf_sysfs_device_path);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user