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

[libvirt] [PATCH 05/15] Remove unneeded curly brackets around oneline code blocks in src/node_device/



As stated in our contributor guidelines, we don't want curly brackets
around oneline code block (with some exceptions).

Signed-off-by: Martin Kletzander <mkletzan redhat com>
---
 src/node_device/node_device_driver.c |  33 ++----
 src/node_device/node_device_hal.c    |   6 +-
 src/node_device/node_device_udev.c   | 222 ++++++++++++-----------------------
 3 files changed, 87 insertions(+), 174 deletions(-)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 5d58ca7..f564be7 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -48,9 +48,8 @@ static int update_caps(virNodeDeviceObjPtr dev)
     virNodeDevCapsDefPtr cap = dev->def->caps;

     while (cap) {
-        if (cap->type == VIR_NODE_DEV_CAP_SCSI_HOST) {
+        if (cap->type == VIR_NODE_DEV_CAP_SCSI_HOST)
             detect_scsi_host_caps(&dev->def->caps->data);
-        }
         if (cap->type == VIR_NODE_DEV_CAP_NET &&
             virNetDevGetLinkInfo(cap->data.net.ifname, &cap->data.net.lnk) < 0)
             return -1;
@@ -494,14 +493,12 @@ find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)

         dev = nodeDeviceLookupSCSIHostByWWN(conn, wwnn, wwpn, 0);

-        if (dev != NULL) {
+        if (dev != NULL)
             break;
-        }

         sleep(5);
-        if (get_time(&now) == -1) {
+        if (get_time(&now) == -1)
             break;
-        }
     }

     nodeDeviceLock(driver);
@@ -527,38 +524,33 @@ nodeDeviceCreateXML(virConnectPtr conn,
     nodeDeviceLock(driver);

     def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE, virt_type);
-    if (def == NULL) {
+    if (def == NULL)
         goto cleanup;
-    }

     if (virNodeDeviceCreateXMLEnsureACL(conn, def) < 0)
         goto cleanup;

-    if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1) {
+    if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1)
         goto cleanup;
-    }

     if (virNodeDeviceGetParentHost(&driver->devs,
                                    def->name,
                                    def->parent,
-                                   &parent_host) == -1) {
+                                   &parent_host) == -1)
         goto cleanup;
-    }

     if (virManageVport(parent_host,
                        wwpn,
                        wwnn,
-                       VPORT_CREATE) == -1) {
+                       VPORT_CREATE) == -1)
         goto cleanup;
-    }

     dev = find_new_device(conn, wwnn, wwpn);
     /* We don't check the return value, because one way or another,
      * we're returning what we get... */

-    if (dev == NULL) {
+    if (dev == NULL)
         virReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
-    }

  cleanup:
     nodeDeviceUnlock(driver);
@@ -590,9 +582,8 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
     if (virNodeDeviceDestroyEnsureACL(dev->conn, obj->def) < 0)
         goto out;

-    if (virNodeDeviceGetWWNs(obj->def, &wwnn, &wwpn) == -1) {
+    if (virNodeDeviceGetWWNs(obj->def, &wwnn, &wwpn) == -1)
         goto out;
-    }


     /* virNodeDeviceGetParentHost will cause the device object's lock to be
@@ -610,16 +601,14 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
     if (virNodeDeviceGetParentHost(&driver->devs,
                                    dev->name,
                                    parent_name,
-                                   &parent_host) == -1) {
+                                   &parent_host) == -1)
         goto out;
-    }

     if (virManageVport(parent_host,
                        wwpn,
                        wwnn,
-                       VPORT_DELETE) == -1) {
+                       VPORT_DELETE) == -1)
         goto out;
-    }

     ret = 0;
  out:
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index ec37223..c32b1fe 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -255,9 +255,8 @@ gather_scsi_host_cap(LibHalContext *ctx, const char *udi,

     retval = detect_scsi_host_caps(d);

-    if (retval == -1) {
+    if (retval == -1)
         goto out;
-    }

  out:
     return retval;
@@ -551,9 +550,8 @@ dev_refresh(const char *udi)
     }
     nodeDeviceUnlock(driverState);

-    if (dev) {
+    if (dev)
         dev_create(udi);
-    }
 }

 static void
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index f580a9b..7b47be8 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -166,9 +166,8 @@ static int udevGetIntProperty(struct udev_device *udev_device,
     ret = udevGetDeviceProperty(udev_device, property_key, &udev_value);

     if (ret == PROPERTY_FOUND) {
-        if (udevStrToLong_i(udev_value, NULL, base, value) != 0) {
+        if (udevStrToLong_i(udev_value, NULL, base, value) != 0)
             ret = PROPERTY_ERROR;
-        }
     }

     VIR_FREE(udev_value);
@@ -187,9 +186,8 @@ static int udevGetUintProperty(struct udev_device *udev_device,
     ret = udevGetDeviceProperty(udev_device, property_key, &udev_value);

     if (ret == PROPERTY_FOUND) {
-        if (udevStrToLong_ui(udev_value, NULL, base, value) != 0) {
+        if (udevStrToLong_ui(udev_value, NULL, base, value) != 0)
             ret = PROPERTY_ERROR;
-        }
     }

     VIR_FREE(udev_value);
@@ -266,9 +264,8 @@ static int udevGetIntSysfsAttr(struct udev_device *udev_device,
     ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &udev_value);

     if (ret == PROPERTY_FOUND) {
-        if (udevStrToLong_i(udev_value, NULL, base, value) != 0) {
+        if (udevStrToLong_i(udev_value, NULL, base, value) != 0)
             ret = PROPERTY_ERROR;
-        }
     }

     VIR_FREE(udev_value);
@@ -287,9 +284,8 @@ static int udevGetUintSysfsAttr(struct udev_device *udev_device,
     ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &udev_value);

     if (ret == PROPERTY_FOUND) {
-        if (udevStrToLong_ui(udev_value, NULL, base, value) != 0) {
+        if (udevStrToLong_ui(udev_value, NULL, base, value) != 0)
             ret = PROPERTY_ERROR;
-        }
     }

     VIR_FREE(udev_value);
@@ -307,9 +303,8 @@ static int udevGetUint64SysfsAttr(struct udev_device *udev_device,
     ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &udev_value);

     if (ret == PROPERTY_FOUND) {
-        if (udevStrToLong_ull(udev_value, NULL, 0, value) != 0) {
+        if (udevStrToLong_ull(udev_value, NULL, 0, value) != 0)
             ret = PROPERTY_ERROR;
-        }
     }

     VIR_FREE(udev_value);
@@ -329,9 +324,8 @@ static int udevGenerateDeviceName(struct udev_device *device,
                       udev_device_get_subsystem(device),
                       udev_device_get_sysname(device));

-    if (s != NULL) {
+    if (s != NULL)
         virBufferAsprintf(&buf, "_%s", s);
-    }

     if (virBufferCheckError(&buf) < 0)
         return -1;
@@ -339,9 +333,8 @@ static int udevGenerateDeviceName(struct udev_device *device,
     def->name = virBufferContentAndReset(&buf);

     for (i = 0; i < strlen(def->name); i++) {
-        if (!(c_isalnum(*(def->name + i)))) {
+        if (!(c_isalnum(*(def->name + i))))
             *(def->name + i) = '_';
-        }
     }

     return ret;
@@ -435,64 +428,55 @@ static int udevProcessPCI(struct udev_device *device,
     if (udevGetUintProperty(device,
                             "PCI_CLASS",
                             &data->pci_dev.class,
-                            16) == PROPERTY_ERROR) {
+                            16) == PROPERTY_ERROR)
         goto out;
-    }

     p = strrchr(syspath, '/');

     if ((p == NULL) || (udevStrToLong_ui(p+1,
                                          &p,
                                          16,
-                                         &data->pci_dev.domain) == -1)) {
+                                         &data->pci_dev.domain) == -1))
         goto out;
-    }

     if ((p == NULL) || (udevStrToLong_ui(p+1,
                                          &p,
                                          16,
-                                         &data->pci_dev.bus) == -1)) {
+                                         &data->pci_dev.bus) == -1))
         goto out;
-    }

     if ((p == NULL) || (udevStrToLong_ui(p+1,
                                          &p,
                                          16,
-                                         &data->pci_dev.slot) == -1)) {
+                                         &data->pci_dev.slot) == -1))
         goto out;
-    }

     if ((p == NULL) || (udevStrToLong_ui(p+1,
                                          &p,
                                          16,
-                                         &data->pci_dev.function) == -1)) {
+                                         &data->pci_dev.function) == -1))
         goto out;
-    }

     if (udevGetUintSysfsAttr(device,
                              "vendor",
                              &data->pci_dev.vendor,
-                             16) == PROPERTY_ERROR) {
+                             16) == PROPERTY_ERROR)
         goto out;
-    }

     if (udevGetUintSysfsAttr(device,
                              "device",
                              &data->pci_dev.product,
-                             16) == PROPERTY_ERROR) {
+                             16) == PROPERTY_ERROR)
         goto out;
-    }

     if (udevTranslatePCIIds(data->pci_dev.vendor,
                             data->pci_dev.product,
                             &data->pci_dev.vendor_name,
-                            &data->pci_dev.product_name) != 0) {
+                            &data->pci_dev.product_name) != 0)
         goto out;
-    }

-    if (udevGenerateDeviceName(device, def, NULL) != 0) {
+    if (udevGenerateDeviceName(device, def, NULL) != 0)
         goto out;
-    }

     rc = udevGetIntSysfsAttr(device,
                             "numa_node",
@@ -585,23 +569,20 @@ static int udevProcessUSBDevice(struct udev_device *device,
     if (udevGetUintProperty(device,
                             "BUSNUM",
                             &data->usb_dev.bus,
-                            10) == PROPERTY_ERROR) {
+                            10) == PROPERTY_ERROR)
         goto out;
-    }

     if (udevGetUintProperty(device,
                             "DEVNUM",
                             &data->usb_dev.device,
-                            10) == PROPERTY_ERROR) {
+                            10) == PROPERTY_ERROR)
         goto out;
-    }

     if (udevGetUintProperty(device,
                             "ID_VENDOR_ID",
                             &data->usb_dev.vendor,
-                            16) == PROPERTY_ERROR) {
+                            16) == PROPERTY_ERROR)
         goto out;
-    }

     err = udevGetStringProperty(device,
                                 "ID_VENDOR_FROM_DATABASE",
@@ -611,17 +592,15 @@ static int udevProcessUSBDevice(struct udev_device *device,
     if (err == PROPERTY_MISSING) {
         if (udevGetStringSysfsAttr(device,
                                   "manufacturer",
-                                  &data->usb_dev.vendor_name) == PROPERTY_ERROR) {
+                                  &data->usb_dev.vendor_name) == PROPERTY_ERROR)
             goto out;
-        }
     }

     if (udevGetUintProperty(device,
                             "ID_MODEL_ID",
                             &data->usb_dev.product,
-                            16) == PROPERTY_ERROR) {
+                            16) == PROPERTY_ERROR)
         goto out;
-    }

     err = udevGetStringProperty(device,
                                 "ID_MODEL_FROM_DATABASE",
@@ -631,14 +610,12 @@ static int udevProcessUSBDevice(struct udev_device *device,
     if (err == PROPERTY_MISSING) {
         if (udevGetStringSysfsAttr(device,
                                   "product",
-                                  &data->usb_dev.product_name) == PROPERTY_ERROR) {
+                                  &data->usb_dev.product_name) == PROPERTY_ERROR)
             goto out;
-        }
     }

-    if (udevGenerateDeviceName(device, def, NULL) != 0) {
+    if (udevGenerateDeviceName(device, def, NULL) != 0)
         goto out;
-    }

     ret = 0;

@@ -656,34 +633,29 @@ static int udevProcessUSBInterface(struct udev_device *device,
     if (udevGetUintSysfsAttr(device,
                              "bInterfaceNumber",
                              &data->usb_if.number,
-                             16) == PROPERTY_ERROR) {
+                             16) == PROPERTY_ERROR)
         goto out;
-    }

     if (udevGetUintSysfsAttr(device,
                              "bInterfaceClass",
                              &data->usb_if._class,
-                             16) == PROPERTY_ERROR) {
+                             16) == PROPERTY_ERROR)
         goto out;
-    }

     if (udevGetUintSysfsAttr(device,
                              "bInterfaceSubClass",
                              &data->usb_if.subclass,
-                             16) == PROPERTY_ERROR) {
+                             16) == PROPERTY_ERROR)
         goto out;
-    }

     if (udevGetUintSysfsAttr(device,
                              "bInterfaceProtocol",
                              &data->usb_if.protocol,
-                             16) == PROPERTY_ERROR) {
+                             16) == PROPERTY_ERROR)
         goto out;
-    }

-    if (udevGenerateDeviceName(device, def, NULL) != 0) {
+    if (udevGenerateDeviceName(device, def, NULL) != 0)
         goto out;
-    }

     ret = 0;

@@ -707,26 +679,22 @@ static int udevProcessNetworkInterface(struct udev_device *device,

     if (udevGetStringProperty(device,
                               "INTERFACE",
-                              &data->net.ifname) == PROPERTY_ERROR) {
+                              &data->net.ifname) == PROPERTY_ERROR)
         goto out;
-    }

     if (udevGetStringSysfsAttr(device,
                                "address",
-                               &data->net.address) == PROPERTY_ERROR) {
+                               &data->net.address) == PROPERTY_ERROR)
         goto out;
-    }

     if (udevGetUintSysfsAttr(device,
                              "addr_len",
                              &data->net.address_len,
-                             0) == PROPERTY_ERROR) {
+                             0) == PROPERTY_ERROR)
         goto out;
-    }

-    if (udevGenerateDeviceName(device, def, data->net.address) != 0) {
+    if (udevGenerateDeviceName(device, def, data->net.address) != 0)
         goto out;
-    }

     if (virNetDevGetLinkInfo(data->net.ifname, &data->net.lnk) < 0)
         goto out;
@@ -756,15 +724,13 @@ static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,
     if (udevStrToLong_ui(filename + strlen("host"),
                          NULL,
                          0,
-                         &data->scsi_host.host) == -1) {
+                         &data->scsi_host.host) == -1)
         goto out;
-    }

     detect_scsi_host_caps(&def->caps->data);

-    if (udevGenerateDeviceName(device, def, NULL) != 0) {
+    if (udevGenerateDeviceName(device, def, NULL) != 0)
         goto out;
-    }

     ret = 0;

@@ -785,9 +751,8 @@ static int udevProcessSCSITarget(struct udev_device *device ATTRIBUTE_UNUSED,
     if (VIR_STRDUP(data->scsi_target.name, sysname) < 0)
         goto out;

-    if (udevGenerateDeviceName(device, def, NULL) != 0) {
+    if (udevGenerateDeviceName(device, def, NULL) != 0)
         goto out;
-    }

     ret = 0;

@@ -864,36 +829,31 @@ static int udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED,

     filename = last_component(def->sysfs_path);

-    if (udevStrToLong_ui(filename, &p, 10, &data->scsi.host) == -1) {
+    if (udevStrToLong_ui(filename, &p, 10, &data->scsi.host) == -1)
         goto out;
-    }

     if ((p == NULL) || (udevStrToLong_ui(p+1,
                                          &p,
                                          10,
-                                         &data->scsi.bus) == -1)) {
+                                         &data->scsi.bus) == -1))
         goto out;
-    }

     if ((p == NULL) || (udevStrToLong_ui(p+1,
                                          &p,
                                          10,
-                                         &data->scsi.target) == -1)) {
+                                         &data->scsi.target) == -1))
         goto out;
-    }

     if ((p == NULL) || (udevStrToLong_ui(p+1,
                                          &p,
                                          10,
-                                         &data->scsi.lun) == -1)) {
+                                         &data->scsi.lun) == -1))
         goto out;
-    }

     switch (udevGetUintSysfsAttr(device, "type", &tmp, 0)) {
     case PROPERTY_FOUND:
-        if (udevGetSCSIType(def, tmp, &data->scsi.type) == -1) {
+        if (udevGetSCSIType(def, tmp, &data->scsi.type) == -1)
             goto out;
-        }
         break;
     case PROPERTY_MISSING:
         break; /* No type is not an error */
@@ -903,9 +863,8 @@ static int udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED,
         break;
     }

-    if (udevGenerateDeviceName(device, def, NULL) != 0) {
+    if (udevGenerateDeviceName(device, def, NULL) != 0)
         goto out;
-    }

     ret = 0;

@@ -926,16 +885,14 @@ static int udevProcessDisk(struct udev_device *device,

     if (udevGetUint64SysfsAttr(device,
                                "size",
-                               &data->storage.num_blocks) == PROPERTY_ERROR) {
+                               &data->storage.num_blocks) == PROPERTY_ERROR)
         goto out;
-    }

     if (udevGetUint64SysfsAttr(device,
                                "queue/logical_block_size",
                                &data->storage.logical_block_size)
-        == PROPERTY_ERROR) {
+        == PROPERTY_ERROR)
         goto out;
-    }

     data->storage.size = data->storage.num_blocks *
         data->storage.logical_block_size;
@@ -953,9 +910,8 @@ static int udevProcessRemoveableMedia(struct udev_device *device,
     int tmp_int = 0, ret = 0;

     if ((udevGetIntSysfsAttr(device, "removable", &tmp_int, 0) == PROPERTY_FOUND) &&
-        (tmp_int == 1)) {
+        (tmp_int == 1))
         def->caps->data.storage.flags |= VIR_NODE_DEV_CAP_STORAGE_REMOVABLE;
-    }

     if (has_media) {

@@ -963,21 +919,18 @@ static int udevProcessRemoveableMedia(struct udev_device *device,
             VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE;

         if (udevGetStringProperty(device, "ID_FS_LABEL",
-                                  &data->storage.media_label) == PROPERTY_ERROR) {
+                                  &data->storage.media_label) == PROPERTY_ERROR)
             goto out;
-        }

         if (udevGetUint64SysfsAttr(device,
                                    "size",
-                                   &data->storage.num_blocks) == PROPERTY_ERROR) {
+                                   &data->storage.num_blocks) == PROPERTY_ERROR)
             goto out;
-        }

         if (udevGetUint64SysfsAttr(device,
                                    "queue/logical_block_size",
-                                   &data->storage.logical_block_size) == PROPERTY_ERROR) {
+                                   &data->storage.logical_block_size) == PROPERTY_ERROR)
             goto out;
-        }

         /* XXX This calculation is wrong for the qemu virtual cdrom
          * which reports the size in 512 byte blocks, but the logical
@@ -1046,16 +999,14 @@ static int udevProcessSD(struct udev_device *device,

     if (udevGetUint64SysfsAttr(device,
                                "size",
-                               &data->storage.num_blocks) == PROPERTY_ERROR) {
+                               &data->storage.num_blocks) == PROPERTY_ERROR)
         goto out;
-    }

     if (udevGetUint64SysfsAttr(device,
                                "queue/logical_block_size",
                                &data->storage.logical_block_size)
-        == PROPERTY_ERROR) {
+        == PROPERTY_ERROR)
         goto out;
-    }

     data->storage.size = data->storage.num_blocks *
         data->storage.logical_block_size;
@@ -1099,9 +1050,8 @@ static int udevKludgeStorageType(virNodeDeviceDefPtr def)

 static void udevStripSpaces(char *s)
 {
-    if (s == NULL) {
+    if (s == NULL)
         return;
-    }

     while (virFileStripSuffix(s, " ")) {
         /* do nothing */
@@ -1130,25 +1080,21 @@ static int udevProcessStorage(struct udev_device *device,

     if (udevGetStringProperty(device,
                               "ID_BUS",
-                              &data->storage.bus) == PROPERTY_ERROR) {
+                              &data->storage.bus) == PROPERTY_ERROR)
         goto out;
-    }
     if (udevGetStringProperty(device,
                               "ID_SERIAL",
-                              &data->storage.serial) == PROPERTY_ERROR) {
+                              &data->storage.serial) == PROPERTY_ERROR)
         goto out;
-    }
     if (udevGetStringSysfsAttr(device,
                                "device/vendor",
-                               &data->storage.vendor) == PROPERTY_ERROR) {
+                               &data->storage.vendor) == PROPERTY_ERROR)
         goto out;
-    }
     udevStripSpaces(def->caps->data.storage.vendor);
     if (udevGetStringSysfsAttr(device,
                                "device/model",
-                               &data->storage.model) == PROPERTY_ERROR) {
+                               &data->storage.model) == PROPERTY_ERROR)
         goto out;
-    }
     udevStripSpaces(def->caps->data.storage.model);
     /* There is no equivalent of the hotpluggable property in libudev,
      * but storage is going toward a world in which hotpluggable is
@@ -1184,9 +1130,8 @@ static int udevProcessStorage(struct udev_device *device,
         } else {

             /* If udev doesn't have it, perhaps we can guess it. */
-            if (udevKludgeStorageType(def) != 0) {
+            if (udevKludgeStorageType(def) != 0)
                 goto out;
-            }
         }
     }

@@ -1204,9 +1149,8 @@ static int udevProcessStorage(struct udev_device *device,
         goto out;
     }

-    if (udevGenerateDeviceName(device, def, data->storage.serial) != 0) {
+    if (udevGenerateDeviceName(device, def, data->storage.serial) != 0)
         goto out;
-    }

  out:
     VIR_DEBUG("Storage ret=%d", ret);
@@ -1376,9 +1320,8 @@ static int udevSetParent(struct udev_device *device,
     do {

         parent_device = udev_device_get_parent(parent_device);
-        if (parent_device == NULL) {
+        if (parent_device == NULL)
             break;
-        }

         parent_sysfs_path = udev_device_get_syspath(parent_device);
         if (parent_sysfs_path == NULL) {
@@ -1427,24 +1370,20 @@ static int udevAddOneDevice(struct udev_device *device)

     if (udevGetStringProperty(device,
                               "DRIVER",
-                              &def->driver) == PROPERTY_ERROR) {
+                              &def->driver) == PROPERTY_ERROR)
         goto out;
-    }

     if (VIR_ALLOC(def->caps) != 0)
         goto out;

-    if (udevGetDeviceType(device, &def->caps->type) != 0) {
+    if (udevGetDeviceType(device, &def->caps->type) != 0)
         goto out;
-    }

-    if (udevGetDeviceDetails(device, def) != 0) {
+    if (udevGetDeviceDetails(device, def) != 0)
         goto out;
-    }

-    if (udevSetParent(device, def) != 0) {
+    if (udevSetParent(device, def) != 0)
         goto out;
-    }

     /* If this is a device change, the old definition will be freed
      * and the current definition will take its place. */
@@ -1544,9 +1483,8 @@ static int nodeStateCleanup(void)
             udev_monitor_unref(udev_monitor);
         }

-        if (udev != NULL) {
+        if (udev != NULL)
             udev_unref(udev);
-        }

         virNodeDeviceObjListFree(&driverState->devs);
         nodeDeviceUnlock(driverState);
@@ -1635,27 +1573,23 @@ udevGetDMIData(union _virNodeDevCapData *data)

     if (udevGetStringSysfsAttr(device,
                                "product_name",
-                               &data->system.product_name) == PROPERTY_ERROR) {
+                               &data->system.product_name) == PROPERTY_ERROR)
         goto out;
-    }
     if (udevGetStringSysfsAttr(device,
                                "sys_vendor",
                                &data->system.hardware.vendor_name)
-        == PROPERTY_ERROR) {
+        == PROPERTY_ERROR)
         goto out;
-    }
     if (udevGetStringSysfsAttr(device,
                                "product_version",
                                &data->system.hardware.version)
-        == PROPERTY_ERROR) {
+        == PROPERTY_ERROR)
         goto out;
-    }
     if (udevGetStringSysfsAttr(device,
                                "product_serial",
                                &data->system.hardware.serial)
-        == PROPERTY_ERROR) {
+        == PROPERTY_ERROR)
         goto out;
-    }

     if (virGetHostUUID(data->system.hardware.uuid))
         goto out;
@@ -1663,27 +1597,23 @@ udevGetDMIData(union _virNodeDevCapData *data)
     if (udevGetStringSysfsAttr(device,
                                "bios_vendor",
                                &data->system.firmware.vendor_name)
-        == PROPERTY_ERROR) {
+        == PROPERTY_ERROR)
         goto out;
-    }
     if (udevGetStringSysfsAttr(device,
                                "bios_version",
                                &data->system.firmware.version)
-        == PROPERTY_ERROR) {
+        == PROPERTY_ERROR)
         goto out;
-    }
     if (udevGetStringSysfsAttr(device,
                                "bios_date",
                                &data->system.firmware.release_date)
-        == PROPERTY_ERROR) {
+        == PROPERTY_ERROR)
         goto out;
-    }

  out:
     VIR_FREE(tmp);
-    if (device != NULL) {
+    if (device != NULL)
         udev_device_unref(device);
-    }
     return;
 }
 #endif
@@ -1719,9 +1649,8 @@ static int udevSetupSystemDev(void)
     ret = 0;

  out:
-    if (ret == -1) {
+    if (ret == -1)
         virNodeDeviceDefFree(def);
-    }

     return ret;
 }
@@ -1834,9 +1763,8 @@ static int nodeStateInitialize(bool privileged,
     nodeDeviceUnlock(driverState);

  out:
-    if (ret == -1) {
+    if (ret == -1)
         nodeStateCleanup();
-    }
     return ret;
 }

@@ -1853,9 +1781,8 @@ static virDrvOpenStatus nodeDeviceOpen(virConnectPtr conn,
 {
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);

-    if (driverState == NULL) {
+    if (driverState == NULL)
         return VIR_DRV_OPEN_DECLINED;
-    }

     conn->nodeDevicePrivateData = driverState;

@@ -1896,9 +1823,8 @@ int udevNodeRegister(void)
 {
     VIR_DEBUG("Registering udev node device backend");

-    if (virRegisterNodeDeviceDriver(&udevNodeDeviceDriver) < 0) {
+    if (virRegisterNodeDeviceDriver(&udevNodeDeviceDriver) < 0)
         return -1;
-    }

     return virRegisterStateDriver(&udevStateDriver);
 }
-- 
2.1.3


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