提交 d85e29dd 编写于 作者: J Ján Tomko

Reformat nodeStateCleanup

Remove the ret variable and return early if there is no driver.
上级 5c88b34a
......@@ -1488,42 +1488,38 @@ static void udevPCITranslateDeinit(void)
static int nodeStateCleanup(void)
{
int ret = 0;
udevPrivate *priv = NULL;
struct udev_monitor *udev_monitor = NULL;
struct udev *udev = NULL;
if (driver) {
nodeDeviceLock();
if (!driver)
return -1;
priv = driver->privateData;
nodeDeviceLock();
if (priv->watch != -1)
virEventRemoveHandle(priv->watch);
priv = driver->privateData;
udev_monitor = DRV_STATE_UDEV_MONITOR(driver);
if (priv->watch != -1)
virEventRemoveHandle(priv->watch);
if (udev_monitor != NULL) {
udev = udev_monitor_get_udev(udev_monitor);
udev_monitor_unref(udev_monitor);
}
udev_monitor = DRV_STATE_UDEV_MONITOR(driver);
if (udev != NULL)
udev_unref(udev);
if (udev_monitor != NULL) {
udev = udev_monitor_get_udev(udev_monitor);
udev_monitor_unref(udev_monitor);
}
virNodeDeviceObjListFree(&driver->devs);
nodeDeviceUnlock();
virMutexDestroy(&driver->lock);
VIR_FREE(driver);
VIR_FREE(priv);
if (udev != NULL)
udev_unref(udev);
udevPCITranslateDeinit();
} else {
ret = -1;
}
virNodeDeviceObjListFree(&driver->devs);
nodeDeviceUnlock();
virMutexDestroy(&driver->lock);
VIR_FREE(driver);
VIR_FREE(priv);
return ret;
udevPCITranslateDeinit();
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册