Module: Mesa
Branch: master
Commit: 5603bb13e36276ddb1bf1a5c41f00988b368110e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5603bb13e36276ddb1bf1a5c41f00988b368110e

Author: Iago Toral Quiroga <[email protected]>
Date:   Wed Dec  2 07:57:32 2020 +0100

v3dv: fix early return from failed drmGetMagic

v2: Log more detail to stderr upon failure (Chema)

Fixes: b14679ab226 ('v3dv: check return value of drmGetMagic')
Reviewed-by: Jose Maria Casanova Crespo <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7865>

---

 src/broadcom/vulkan/v3dv_device.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/broadcom/vulkan/v3dv_device.c 
b/src/broadcom/vulkan/v3dv_device.c
index 0e2bbf6634e..455ef4f7d20 100644
--- a/src/broadcom/vulkan/v3dv_device.c
+++ b/src/broadcom/vulkan/v3dv_device.c
@@ -402,10 +402,18 @@ v3dv_drm_handle_device(void *data, struct wl_drm *drm, 
const char *device)
    struct v3dv_wayland_info *info = data;
    info->fd = open(device, O_RDWR | O_CLOEXEC);
    info->is_set = info->fd != -1;
+   if (!info->is_set) {
+      fprintf(stderr, "v3dv_drm_handle_device: could not open %s (%s)\n",
+              device, strerror(errno));
+      return;
+   }
 
    drm_magic_t magic;
    if (drmGetMagic(info->fd, &magic)) {
-      fprintf(stderr, "drmGetMagic failed.");
+      fprintf(stderr, "v3dv_drm_handle_device: drmGetMagic failed\n");
+      close(info->fd);
+      info->fd = -1;
+      info->is_set = false;
       return;
    }
    wl_drm_authenticate(info->wl_drm, magic);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to