Since a purged buffer is one without any associated pages, attempting to
use it should generate EFAULT rather than EINVAL, as it is not strictly
an invalid parameter.

Signed-off-by: Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index f2ef2c8518ba..1c91a6718e89 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1733,7 +1733,7 @@ i915_gem_mmap_gtt(struct drm_file *file,
 
        if (obj->madv != I915_MADV_WILLNEED) {
                DRM_ERROR("Attempting to mmap a purgeable buffer\n");
-               ret = -EINVAL;
+               ret = -EFAULT;
                goto out;
        }
 
@@ -2087,7 +2087,7 @@ i915_gem_object_get_pages(struct drm_i915_gem_object *obj)
 
        if (obj->madv != I915_MADV_WILLNEED) {
                DRM_ERROR("Attempting to obtain a purgeable object\n");
-               return -EINVAL;
+               return -EFAULT;
        }
 
        BUG_ON(obj->pages_pin_count);
@@ -4091,7 +4091,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
 
        if (obj->madv != I915_MADV_WILLNEED) {
                DRM_ERROR("Attempting to pin a purgeable buffer\n");
-               ret = -EINVAL;
+               ret = -EFAULT;
                goto out;
        }
 
-- 
1.9.rc1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to