summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2023-06-06 11:23:56 +0300
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2023-06-20 10:54:47 +0300
commit274d4b96b12f78cef4f72a97a4967032233f6cae (patch)
tree328bbec4225e8314daff0973ea7b3395fa8749e3
parentd57ba095e4f170963ec420d6cd780aa19459bc65 (diff)
downloadlinux-274d4b96b12f78cef4f72a97a4967032233f6cae.tar.xz
drm/i915: Fix a NULL vs IS_ERR() bug
The mmap_offset_attach() function returns error pointers, it doesn't return NULL. Fixes: eaee1c085863 ("drm/i915: Add a function to mmap framebuffer obj") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ZH7tHLRZ9oBjedjN@moroto (cherry picked from commit 3a89311387cde27da8e290458b2d037133c1f7b5) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
-rw-r--r--drivers/gpu/drm/i915/gem/i915_gem_mman.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
index 4e7a838ab7bd..aa4d842d4c5a 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
@@ -1085,8 +1085,8 @@ int i915_gem_fb_mmap(struct drm_i915_gem_object *obj, struct vm_area_struct *vma
/* handle stolen and smem objects */
mmap_type = i915_ggtt_has_aperture(ggtt) ? I915_MMAP_TYPE_GTT : I915_MMAP_TYPE_WC;
mmo = mmap_offset_attach(obj, mmap_type, NULL);
- if (!mmo)
- return -ENODEV;
+ if (IS_ERR(mmo))
+ return PTR_ERR(mmo);
}
/*