Commit 4332bf43 authored by Daniel Vetter's avatar Daniel Vetter Committed by Dave Airlie

drm/prime: use proper pointer in drm_gem_prime_handle_to_fd

Part of the function uses the properly-typed dmabuf variable, the
other an untyped void *buf. Kill the later.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent becee2a5
...@@ -303,7 +303,6 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, ...@@ -303,7 +303,6 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev,
int *prime_fd) int *prime_fd)
{ {
struct drm_gem_object *obj; struct drm_gem_object *obj;
void *buf;
int ret = 0; int ret = 0;
struct dma_buf *dmabuf; struct dma_buf *dmabuf;
...@@ -323,15 +322,15 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, ...@@ -323,15 +322,15 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev,
goto out_have_obj; goto out_have_obj;
} }
buf = dev->driver->gem_prime_export(dev, obj, flags); dmabuf = dev->driver->gem_prime_export(dev, obj, flags);
if (IS_ERR(buf)) { if (IS_ERR(dmabuf)) {
/* normally the created dma-buf takes ownership of the ref, /* normally the created dma-buf takes ownership of the ref,
* but if that fails then drop the ref * but if that fails then drop the ref
*/ */
ret = PTR_ERR(buf); ret = PTR_ERR(dmabuf);
goto out; goto out;
} }
obj->export_dma_buf = buf; obj->export_dma_buf = dmabuf;
/* if we've exported this buffer the cheat and add it to the import list /* if we've exported this buffer the cheat and add it to the import list
* so we get the correct handle back * so we get the correct handle back
...@@ -341,7 +340,7 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, ...@@ -341,7 +340,7 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev,
if (ret) if (ret)
goto fail_put_dmabuf; goto fail_put_dmabuf;
ret = dma_buf_fd(buf, flags); ret = dma_buf_fd(dmabuf, flags);
if (ret < 0) if (ret < 0)
goto fail_rm_handle; goto fail_rm_handle;
...@@ -362,11 +361,12 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, ...@@ -362,11 +361,12 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev,
goto out; goto out;
fail_rm_handle: fail_rm_handle:
drm_prime_remove_buf_handle_locked(&file_priv->prime, buf); drm_prime_remove_buf_handle_locked(&file_priv->prime,
dmabuf);
fail_put_dmabuf: fail_put_dmabuf:
/* clear NOT to be checked when releasing dma_buf */ /* clear NOT to be checked when releasing dma_buf */
obj->export_dma_buf = NULL; obj->export_dma_buf = NULL;
dma_buf_put(buf); dma_buf_put(dmabuf);
out: out:
drm_gem_object_unreference_unlocked(obj); drm_gem_object_unreference_unlocked(obj);
mutex_unlock(&file_priv->prime.lock); mutex_unlock(&file_priv->prime.lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment