Skip to content

Commit 1a148af

Browse files
author
Thomas Zimmermann
committed
drm/gem-shmem: 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-6-tzimmermann@suse.de
1 parent dbdd636 commit 1a148af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/gpu/drm/drm_gem_shmem_helper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,10 @@ int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem,
339339
int ret = 0;
340340

341341
if (drm_gem_is_imported(obj)) {
342-
ret = dma_buf_vmap(obj->import_attach->dmabuf, map);
342+
ret = dma_buf_vmap(obj->dma_buf, map);
343343
if (!ret) {
344344
if (drm_WARN_ON(obj->dev, map->is_iomem)) {
345-
dma_buf_vunmap(obj->import_attach->dmabuf, map);
345+
dma_buf_vunmap(obj->dma_buf, map);
346346
return -EIO;
347347
}
348348
}
@@ -405,7 +405,7 @@ void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem,
405405
struct drm_gem_object *obj = &shmem->base;
406406

407407
if (drm_gem_is_imported(obj)) {
408-
dma_buf_vunmap(obj->import_attach->dmabuf, map);
408+
dma_buf_vunmap(obj->dma_buf, map);
409409
} else {
410410
dma_resv_assert_held(shmem->base.resv);
411411

0 commit comments

Comments
 (0)