]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Adapt to VIR_ALLOC and virAsprintf in src/node_device/*
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 4 Jul 2013 10:11:59 +0000 (12:11 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Jul 2013 09:07:32 +0000 (11:07 +0200)
src/node_device/node_device_driver.c
src/node_device/node_device_udev.c

index 1f7e0fd4d2f008c0689ab2629177723a033c06e9..bbad1135932d7cd438d8cff8371d16e5a60188ce 100644 (file)
@@ -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 */
index 1f2e6919d8457df3b0296493e51d80ffeee33969..56a002353433278930e03cccf6c9653636149dd1 100644 (file)
@@ -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;