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

[libvirt] [PATCH v2] udev: only report a warning if udev_enumerate_scan_devices fails



Even if an error is reported by `udev_enumerate_scan_devices`,
e.g. because a driver of a device has an bug, we can still enumerate
all other devices. Additionally the documentation of
udev_enumerate_scan_devices says that on success an integer >= 0 is
returned (see man udev_enumerate_scan_devices(3)).

Reviewed-by: Bjoern Walk <bwalk linux ibm com>
Signed-off-by: Marc Hartmayer <mhartmay linux ibm com>
---
 src/node_device/node_device_udev.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 299f55260129..eb4d8b3cfe4a 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1480,13 +1480,8 @@ udevEnumerateDevices(struct udev *udev)
     if (udevEnumerateAddMatches(udev_enumerate) < 0)
         goto cleanup;
 
-    ret = udev_enumerate_scan_devices(udev_enumerate);
-    if (ret != 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("udev scan devices returned %d"),
-                       ret);
-        goto cleanup;
-    }
+    if (udev_enumerate_scan_devices(udev_enumerate) < 0)
+        VIR_WARN("udev scan devices failed");
 
     udev_list_entry_foreach(list_entry,
                             udev_enumerate_get_list_entry(udev_enumerate)) {
@@ -1494,6 +1489,7 @@ udevEnumerateDevices(struct udev *udev)
         udevProcessDeviceListEntry(udev, list_entry);
     }
 
+    ret = 0;
  cleanup:
     udev_enumerate_unref(udev_enumerate);
     return ret;
-- 
2.17.0


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