diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2015-07-13 14:34:57 +0100 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2015-07-16 16:41:38 +0100 |
commit | ea1786416c58cb0896b640bad5a9e41e1baa4011 (patch) | |
tree | 7e187a3ce45d7b66db3f365b09607a02cf332797 /freedreno/kgsl | |
parent | dfed5e18f35e1a3b5d5b31ee11ada55a0d80abe1 (diff) |
freedreno: zero is a valid fd number, treat it as such
Abeit quite unlikely to get hit by this bug here, let just fix it.
v2: Correct conditional (do not call ioctl(DRM_IOCTL_PRIME_HANDLE_TO_FD)
when we already have the fd).
v3: Fix kgsl_pipe.c, suggested by Thierry.
Cc: freedreno@lists.freedesktop.org
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'freedreno/kgsl')
-rw-r--r-- | freedreno/kgsl/kgsl_bo.c | 1 | ||||
-rw-r--r-- | freedreno/kgsl/kgsl_pipe.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c index 15c3ff50..3407c769 100644 --- a/freedreno/kgsl/kgsl_bo.c +++ b/freedreno/kgsl/kgsl_bo.c @@ -168,6 +168,7 @@ drm_private struct fd_bo * kgsl_bo_from_handle(struct fd_device *dev, bo = &kgsl_bo->base; bo->funcs = &funcs; + bo->fd = -1; for (i = 0; i < ARRAY_SIZE(kgsl_bo->list); i++) list_inithead(&kgsl_bo->list[i]); diff --git a/freedreno/kgsl/kgsl_pipe.c b/freedreno/kgsl/kgsl_pipe.c index fc76b2b8..08c87a62 100644 --- a/freedreno/kgsl/kgsl_pipe.c +++ b/freedreno/kgsl/kgsl_pipe.c @@ -101,7 +101,7 @@ static void kgsl_pipe_destroy(struct fd_pipe *pipe) if (kgsl_pipe->drawctxt_id) ioctl(kgsl_pipe->fd, IOCTL_KGSL_DRAWCTXT_DESTROY, &req); - if (kgsl_pipe->fd) + if (kgsl_pipe->fd >= 0) close(kgsl_pipe->fd); free(kgsl_pipe); |