[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 14/37] Adapt to VIR_ALLOC and virAsprintf in src/node_device/*



---
 src/node_device/node_device_driver.c |  4 +---
 src/node_device/node_device_udev.c   | 18 ++++--------------
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 1f7e0fd..bbad113 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -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 */
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 1f2e691..56a0023 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -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;
-- 
1.8.1.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]