diff options
author | Maarten Lankhorst <maarten.lankhorst@linux.intel.com> | 2020-01-06 12:35:33 +0300 |
---|---|---|
committer | Maarten Lankhorst <maarten.lankhorst@linux.intel.com> | 2020-01-06 12:35:33 +0300 |
commit | 22164fbe274c2dd96d2887fe121896d321000a61 (patch) | |
tree | 629a8af05ecbe3ed8e18938de2564517c9b44d92 /drivers/gpu/drm/drm_gem_ttm_helper.c | |
parent | 3d0dad869aeb5d8e81985c73a6c73428258f8083 (diff) | |
parent | f5c547efa16c0ea5abff0596e829f502be11902e (diff) | |
download | linux-22164fbe274c2dd96d2887fe121896d321000a61.tar.xz |
Merge drm/drm-next into drm-misc-next
Requested, and we need v5.5-rc1 backported as our current branch is still based on v5.4.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm/drm_gem_ttm_helper.c')
-rw-r--r-- | drivers/gpu/drm/drm_gem_ttm_helper.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_gem_ttm_helper.c b/drivers/gpu/drm/drm_gem_ttm_helper.c index 7412bfc5c05a..605a8a3da7f9 100644 --- a/drivers/gpu/drm/drm_gem_ttm_helper.c +++ b/drivers/gpu/drm/drm_gem_ttm_helper.c @@ -64,8 +64,19 @@ int drm_gem_ttm_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma) { struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem); + int ret; - return ttm_bo_mmap_obj(vma, bo); + ret = ttm_bo_mmap_obj(vma, bo); + if (ret < 0) + return ret; + + /* + * ttm has its own object refcounting, so drop gem reference + * to avoid double accounting counting. + */ + drm_gem_object_put_unlocked(gem); + + return 0; } EXPORT_SYMBOL(drm_gem_ttm_mmap); |