drm/prime: Use dma_buf from GEM object instance

Avoid dereferencing struct drm_gem_object.import_attach for the
imported dma-buf. The dma_buf field in the GEM object instance refers
to the same buffer. Prepares to make import_attach optional.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Anusha Srivatsa <asrivats@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250226172457.217725-11-tzimmermann@suse.de
This commit is contained in:
Thomas Zimmermann 2025-02-26 18:03:13 +01:00
parent 0695d8fc11
commit f83a9b8c7f

View file

@ -453,13 +453,7 @@ struct dma_buf *drm_gem_prime_handle_to_dmabuf(struct drm_device *dev,
} }
mutex_lock(&dev->object_name_lock); mutex_lock(&dev->object_name_lock);
/* re-export the original imported object */ /* re-export the original imported/exported object */
if (obj->import_attach) {
dmabuf = obj->import_attach->dmabuf;
get_dma_buf(dmabuf);
goto out_have_obj;
}
if (obj->dma_buf) { if (obj->dma_buf) {
get_dma_buf(obj->dma_buf); get_dma_buf(obj->dma_buf);
dmabuf = obj->dma_buf; dmabuf = obj->dma_buf;