'out' can be replaced by 'return pci' instead. CC: Stefan Weil <s...@weilnetz.de> Signed-off-by: Daniel Henrique Barboza <danielhb...@gmail.com> --- qga/commands-win32.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 2461fd19bf..c520a341df 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -513,7 +513,7 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); if (dev_info == INVALID_HANDLE_VALUE) { error_setg_win32(errp, GetLastError(), "failed to get devices tree"); - goto out; + return pci; } g_debug("enumerating devices"); @@ -584,7 +584,7 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) } else { error_setg_win32(errp, GetLastError(), "failed to get device instance ID"); - goto out; + return pci; } } @@ -598,14 +598,14 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) g_error("CM_Locate_DevInst failed with code %lx", cr); error_setg_win32(errp, GetLastError(), "failed to get device instance"); - goto out; + return pci; } cr = CM_Get_Parent(&parent_dev_inst, dev_inst, 0); if (cr != CR_SUCCESS) { g_error("CM_Get_Parent failed with code %lx", cr); error_setg_win32(errp, GetLastError(), "failed to get parent device instance"); - goto out; + return pci; } cr = CM_Get_Device_ID_Size(&dev_id_size, parent_dev_inst, 0); @@ -613,7 +613,7 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) g_error("CM_Get_Device_ID_Size failed with code %lx", cr); error_setg_win32(errp, GetLastError(), "failed to get parent device ID length"); - goto out; + return pci; } ++dev_id_size; @@ -628,7 +628,7 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) g_error("CM_Get_Device_ID failed with code %lx", cr); error_setg_win32(errp, GetLastError(), "failed to get parent device ID"); - goto out; + return pci; } } @@ -642,14 +642,14 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) if (parent_dev_info == INVALID_HANDLE_VALUE) { error_setg_win32(errp, GetLastError(), "failed to get parent device"); - goto out; + return pci; } parent_dev_info_data.cbSize = sizeof(SP_DEVINFO_DATA); if (!SetupDiEnumDeviceInfo(parent_dev_info, 0, &parent_dev_info_data)) { error_setg_win32(errp, GetLastError(), "failed to get parent device data"); - goto out; + return pci; } for (j = 0; @@ -731,7 +731,6 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) free_dev_info: SetupDiDestroyDeviceInfoList(dev_info); -out: return pci; } -- 2.24.1