Replace the open-coded self-import check with the drm core helper drm_gem_prime_self_import(), which performs the same ops and device match and returns the backing GEM object with a reference.
Assisted-by: GitHub-Copilot:claude-opus-4.8 Signed-off-by: Niranjana Vishwanathapura <[email protected]> --- drivers/gpu/drm/panthor/panthor_gem.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c index 72908be5e144..7f713c5f19cb 100644 --- a/drivers/gpu/drm/panthor/panthor_gem.c +++ b/drivers/gpu/drm/panthor/panthor_gem.c @@ -584,15 +584,11 @@ struct drm_gem_object * panthor_gem_prime_import(struct drm_device *dev, struct dma_buf *dma_buf) { - struct drm_gem_object *obj = dma_buf->priv; + struct drm_gem_object *obj; - if (dma_buf->ops == &panthor_dma_buf_ops && obj->dev == dev) { - /* Importing dmabuf exported from our own gem increases - * refcount on gem itself instead of f_count of dmabuf. - */ - drm_gem_object_get(obj); + obj = drm_gem_prime_self_import(dev, dma_buf, &panthor_dma_buf_ops); + if (obj) return obj; - } return drm_gem_prime_import(dev, dma_buf); } -- 2.43.0
