All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Gmeiner <christian.gmeiner@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: emil.l.velikov@gmail.com, lukas@mntmn.com
Subject: [PATCH libdrm 2/2] xf86drm: handle non existing OF_COMPATIBLE_N uevent entry
Date: Thu, 18 Oct 2018 22:07:37 +0200	[thread overview]
Message-ID: <20181018200737.5953-3-christian.gmeiner@gmail.com> (raw)
In-Reply-To: <20181018200737.5953-1-christian.gmeiner@gmail.com>

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 --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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2018-10-18 20:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 20:07 [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism Christian Gmeiner
2018-10-18 20:07 ` [PATCH libdrm 1/2] xf86drm: fallback to DRIVER uevent entry when OF_FULLNAME fails Christian Gmeiner
2018-10-25 13:34   ` Emil Velikov
2018-10-25 16:07     ` Christian Gmeiner
2018-10-18 20:07 ` Christian Gmeiner [this message]
2018-10-23 17:28 ` [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism Emil Velikov
2018-10-29 11:32   ` Lucas Stach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181018200737.5953-3-christian.gmeiner@gmail.com \
    --to=christian.gmeiner@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=lukas@mntmn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.