mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
Replace 'goto err' with 'goto cleanup' in udev interface driver
The udev interface driver did not follow standard naming convention for goto labels. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
7c5752dd57
commit
5af5c28bbb
@ -112,21 +112,21 @@ udevInterfaceOpen(virConnectPtr conn,
|
|||||||
|
|
||||||
if (VIR_ALLOC(driverState) < 0) {
|
if (VIR_ALLOC(driverState) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto err;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
driverState->udev = udev_new();
|
driverState->udev = udev_new();
|
||||||
if (!driverState->udev) {
|
if (!driverState->udev) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("failed to create udev context"));
|
_("failed to create udev context"));
|
||||||
goto err;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
conn->interfacePrivateData = driverState;
|
conn->interfacePrivateData = driverState;
|
||||||
|
|
||||||
return VIR_DRV_OPEN_SUCCESS;
|
return VIR_DRV_OPEN_SUCCESS;
|
||||||
|
|
||||||
err:
|
cleanup:
|
||||||
VIR_FREE(driverState);
|
VIR_FREE(driverState);
|
||||||
|
|
||||||
return VIR_DRV_OPEN_ERROR;
|
return VIR_DRV_OPEN_ERROR;
|
||||||
@ -166,7 +166,7 @@ udevNumOfInterfacesByStatus(virConnectPtr conn, virUdevStatus status)
|
|||||||
_("failed to get number of %s interfaces on host"),
|
_("failed to get number of %s interfaces on host"),
|
||||||
virUdevStatusString(status));
|
virUdevStatusString(status));
|
||||||
count = -1;
|
count = -1;
|
||||||
goto err;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do the scan to load up the enumeration */
|
/* Do the scan to load up the enumeration */
|
||||||
@ -180,7 +180,7 @@ udevNumOfInterfacesByStatus(virConnectPtr conn, virUdevStatus status)
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
err:
|
cleanup:
|
||||||
if (enumerate)
|
if (enumerate)
|
||||||
udev_enumerate_unref(enumerate);
|
udev_enumerate_unref(enumerate);
|
||||||
udev_unref(udev);
|
udev_unref(udev);
|
||||||
@ -207,7 +207,7 @@ udevListInterfacesByStatus(virConnectPtr conn,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("failed to get list of %s interfaces on host"),
|
_("failed to get list of %s interfaces on host"),
|
||||||
virUdevStatusString(status));
|
virUdevStatusString(status));
|
||||||
goto err;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do the scan to load up the enumeration */
|
/* Do the scan to load up the enumeration */
|
||||||
@ -229,7 +229,7 @@ udevListInterfacesByStatus(virConnectPtr conn,
|
|||||||
dev = udev_device_new_from_syspath(udev, path);
|
dev = udev_device_new_from_syspath(udev, path);
|
||||||
if (VIR_STRDUP(names[count], udev_device_get_sysname(dev)) < 0) {
|
if (VIR_STRDUP(names[count], udev_device_get_sysname(dev)) < 0) {
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
goto err;
|
goto error;
|
||||||
}
|
}
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ udevListInterfacesByStatus(virConnectPtr conn,
|
|||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
err:
|
error:
|
||||||
if (enumerate)
|
if (enumerate)
|
||||||
udev_enumerate_unref(enumerate);
|
udev_enumerate_unref(enumerate);
|
||||||
udev_unref(udev);
|
udev_unref(udev);
|
||||||
@ -422,14 +422,14 @@ udevInterfaceLookupByName(virConnectPtr conn, const char *name)
|
|||||||
virReportError(VIR_ERR_NO_INTERFACE,
|
virReportError(VIR_ERR_NO_INTERFACE,
|
||||||
_("couldn't find interface named '%s'"),
|
_("couldn't find interface named '%s'"),
|
||||||
name);
|
name);
|
||||||
goto err;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
macaddr = udev_device_get_sysattr_value(dev, "address");
|
macaddr = udev_device_get_sysattr_value(dev, "address");
|
||||||
ret = virGetInterface(conn, name, macaddr);
|
ret = virGetInterface(conn, name, macaddr);
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
|
|
||||||
err:
|
cleanup:
|
||||||
udev_unref(udev);
|
udev_unref(udev);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -452,7 +452,7 @@ udevInterfaceLookupByMACString(virConnectPtr conn, const char *macstr)
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("failed to lookup interface with MAC address '%s'"),
|
_("failed to lookup interface with MAC address '%s'"),
|
||||||
macstr);
|
macstr);
|
||||||
goto err;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Match on MAC */
|
/* Match on MAC */
|
||||||
@ -469,7 +469,7 @@ udevInterfaceLookupByMACString(virConnectPtr conn, const char *macstr)
|
|||||||
virReportError(VIR_ERR_NO_INTERFACE,
|
virReportError(VIR_ERR_NO_INTERFACE,
|
||||||
_("couldn't find interface with MAC address '%s'"),
|
_("couldn't find interface with MAC address '%s'"),
|
||||||
macstr);
|
macstr);
|
||||||
goto err;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that we didn't get multiple items back */
|
/* Check that we didn't get multiple items back */
|
||||||
@ -477,7 +477,7 @@ udevInterfaceLookupByMACString(virConnectPtr conn, const char *macstr)
|
|||||||
virReportError(VIR_ERR_MULTIPLE_INTERFACES,
|
virReportError(VIR_ERR_MULTIPLE_INTERFACES,
|
||||||
_("the MAC address '%s' matches multiple interfaces"),
|
_("the MAC address '%s' matches multiple interfaces"),
|
||||||
macstr);
|
macstr);
|
||||||
goto err;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev = udev_device_new_from_syspath(udev, udev_list_entry_get_name(dev_entry));
|
dev = udev_device_new_from_syspath(udev, udev_list_entry_get_name(dev_entry));
|
||||||
@ -485,7 +485,7 @@ udevInterfaceLookupByMACString(virConnectPtr conn, const char *macstr)
|
|||||||
ret = virGetInterface(conn, name, macstr);
|
ret = virGetInterface(conn, name, macstr);
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
|
|
||||||
err:
|
cleanup:
|
||||||
if (enumerate)
|
if (enumerate)
|
||||||
udev_enumerate_unref(enumerate);
|
udev_enumerate_unref(enumerate);
|
||||||
udev_unref(udev);
|
udev_unref(udev);
|
||||||
@ -1043,13 +1043,13 @@ udevInterfaceGetXMLDesc(virInterfacePtr ifinfo,
|
|||||||
ifacedef = udevGetIfaceDef(udev, ifinfo->name);
|
ifacedef = udevGetIfaceDef(udev, ifinfo->name);
|
||||||
|
|
||||||
if (!ifacedef)
|
if (!ifacedef)
|
||||||
goto err;
|
goto cleanup;
|
||||||
|
|
||||||
xmlstr = virInterfaceDefFormat(ifacedef);
|
xmlstr = virInterfaceDefFormat(ifacedef);
|
||||||
|
|
||||||
virInterfaceDefFree(ifacedef);
|
virInterfaceDefFree(ifacedef);
|
||||||
|
|
||||||
err:
|
cleanup:
|
||||||
/* decrement our udev ptr */
|
/* decrement our udev ptr */
|
||||||
udev_unref(udev);
|
udev_unref(udev);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user