Default the count value to 0.
Signed-off-by: Christian Gmeiner <[email protected]>
---
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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel