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/tegra/gem.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index f76af733ea79..fa724dcb459d 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -768,16 +768,12 @@ struct dma_buf *tegra_gem_prime_export(struct drm_gem_object *gem, struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm, struct dma_buf *buf) { + struct drm_gem_object *gem; struct tegra_bo *bo; - if (buf->ops == &tegra_gem_prime_dmabuf_ops) { - struct drm_gem_object *gem = buf->priv; - - if (gem->dev == drm) { - drm_gem_object_get(gem); - return gem; - } - } + gem = drm_gem_prime_self_import(drm, buf, &tegra_gem_prime_dmabuf_ops); + if (gem) + return gem; bo = tegra_bo_import(drm, buf); if (IS_ERR(bo)) -- 2.43.0
