diff mbox series

[libdrm,2/2] xf86drm: handle non existing OF_COMPATIBLE_N uevent entry

Message ID 20181018200737.5953-3-christian.gmeiner@gmail.com (mailing list archive)
State New, archived
Headers show
Series xf86drm: add OF_ fallback mechanism | expand

Commit Message

Christian Gmeiner Oct. 18, 2018, 8:07 p.m. UTC
Default the count value to 0.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
 xf86drm.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/xf86drm.c b/xf86drm.c
index 4ee1337b..a9152f0c 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3537,17 +3537,16 @@  static int drmParsePlatformDeviceInfo(int maj, int min,
 {
 #ifdef __linux__
     char path[PATH_MAX + 1], *value;
-    unsigned int count, i;
+    unsigned int count = 0, i;
     int err;
 
     snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min);
 
     value = sysfs_uevent_get(path, "OF_COMPATIBLE_N");
-    if (!value)
-        return -ENOENT;
-
-    sscanf(value, "%u", &count);
-    free(value);
+    if (value) {
+        sscanf(value, "%u", &count);
+        free(value);
+    }
 
     info->compatible = calloc(count + 1, sizeof(*info->compatible));
     if (!info->compatible)