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

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

 



Default the count value to 0.

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

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)
-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux