提交 95cc2149 编写于 作者: M Michal Privoznik

Adapt to VIR_ALLOC and virAsprintf in src/node_device/*

上级 56965922
......@@ -78,10 +78,8 @@ static int update_driver_name(virNodeDeviceObjPtr dev)
VIR_FREE(dev->def->driver);
if (virAsprintf(&driver_link, "%s/driver", dev->def->sysfs_path) < 0) {
virReportOOMError();
if (virAsprintf(&driver_link, "%s/driver", dev->def->sysfs_path) < 0)
goto cleanup;
}
/* Some devices don't have an explicit driver, so just return
without a name */
......
......@@ -1345,10 +1345,8 @@ static int udevAddOneDevice(struct udev_device *device)
virNodeDeviceObjPtr dev = NULL;
int ret = -1;
if (VIR_ALLOC(def) != 0) {
virReportOOMError();
if (VIR_ALLOC(def) != 0)
goto out;
}
if (VIR_STRDUP(def->sysfs_path, udev_device_get_syspath(device)) < 0)
goto out;
......@@ -1359,10 +1357,8 @@ static int udevAddOneDevice(struct udev_device *device)
goto out;
}
if (VIR_ALLOC(def->caps) != 0) {
virReportOOMError();
if (VIR_ALLOC(def->caps) != 0)
goto out;
}
if (udevGetDeviceType(device, &def->caps->type) != 0) {
goto out;
......@@ -1625,18 +1621,14 @@ static int udevSetupSystemDev(void)
virNodeDeviceObjPtr dev = NULL;
int ret = -1;
if (VIR_ALLOC(def) != 0) {
virReportOOMError();
if (VIR_ALLOC(def) != 0)
goto out;
}
if (VIR_STRDUP(def->name, "computer") < 0)
goto out;
if (VIR_ALLOC(def->caps) != 0) {
virReportOOMError();
if (VIR_ALLOC(def->caps) != 0)
goto out;
}
#if defined(__x86_64__) || defined(__i386__) || defined(__amd64__)
udevGetDMIData(&def->caps->data);
......@@ -1689,7 +1681,6 @@ static int nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED,
#endif
if (VIR_ALLOC(priv) < 0) {
virReportOOMError();
ret = -1;
goto out;
}
......@@ -1697,7 +1688,6 @@ static int nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED,
priv->watch = -1;
if (VIR_ALLOC(driverState) < 0) {
virReportOOMError();
VIR_FREE(priv);
ret = -1;
goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册