aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-08-04 09:19:46 -0400
committerDave Airlie <airlied@redhat.com>2010-08-09 20:46:55 -0400
commitbf79cb914dbfe848add8bb76cbb8ff89110d29ff (patch)
tree999c982fe33a39b5000fa16887bc439ff66d678f /drivers/gpu/drm/i915/i915_gem.c
parenta44d2f37253cb7a8dc302e345d8909828b093e3c (diff)
drm: Use ENOENT consistently for the error return for an unmatched handle.
This is consistent with trying to access a filename that not exist within a directory which is a good analogy here. The main reason for the change is that it is easy to confuse the error code of EBADF as an performing an ioctl on an invalid file descriptor (rather than an unknown object). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 2a4ed7ca8b4e..0758c7802e6b 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -456,7 +456,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
456 456
457 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 457 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
458 if (obj == NULL) 458 if (obj == NULL)
459 return -EBADF; 459 return -ENOENT;
460 obj_priv = to_intel_bo(obj); 460 obj_priv = to_intel_bo(obj);
461 461
462 /* Bounds check source. 462 /* Bounds check source.
@@ -919,7 +919,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
919 919
920 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 920 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
921 if (obj == NULL) 921 if (obj == NULL)
922 return -EBADF; 922 return -ENOENT;
923 obj_priv = to_intel_bo(obj); 923 obj_priv = to_intel_bo(obj);
924 924
925 /* Bounds check destination. 925 /* Bounds check destination.
@@ -1002,7 +1002,7 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
1002 1002
1003 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 1003 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
1004 if (obj == NULL) 1004 if (obj == NULL)
1005 return -EBADF; 1005 return -ENOENT;
1006 obj_priv = to_intel_bo(obj); 1006 obj_priv = to_intel_bo(obj);
1007 1007
1008 mutex_lock(&dev->struct_mutex); 1008 mutex_lock(&dev->struct_mutex);
@@ -1060,7 +1060,7 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
1060 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 1060 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
1061 if (obj == NULL) { 1061 if (obj == NULL) {
1062 mutex_unlock(&dev->struct_mutex); 1062 mutex_unlock(&dev->struct_mutex);
1063 return -EBADF; 1063 return -ENOENT;
1064 } 1064 }
1065 1065
1066#if WATCH_BUF 1066#if WATCH_BUF
@@ -1099,7 +1099,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
1099 1099
1100 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 1100 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
1101 if (obj == NULL) 1101 if (obj == NULL)
1102 return -EBADF; 1102 return -ENOENT;
1103 1103
1104 offset = args->offset; 1104 offset = args->offset;
1105 1105
@@ -1373,7 +1373,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
1373 1373
1374 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 1374 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
1375 if (obj == NULL) 1375 if (obj == NULL)
1376 return -EBADF; 1376 return -ENOENT;
1377 1377
1378 mutex_lock(&dev->struct_mutex); 1378 mutex_lock(&dev->struct_mutex);
1379 1379
@@ -3364,7 +3364,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
3364 reloc->target_handle); 3364 reloc->target_handle);
3365 if (target_obj == NULL) { 3365 if (target_obj == NULL) {
3366 i915_gem_object_unpin(obj); 3366 i915_gem_object_unpin(obj);
3367 return -EBADF; 3367 return -ENOENT;
3368 } 3368 }
3369 target_obj_priv = to_intel_bo(target_obj); 3369 target_obj_priv = to_intel_bo(target_obj);
3370 3370
@@ -3781,7 +3781,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
3781 exec_list[i].handle, i); 3781 exec_list[i].handle, i);
3782 /* prevent error path from reading uninitialized data */ 3782 /* prevent error path from reading uninitialized data */
3783 args->buffer_count = i + 1; 3783 args->buffer_count = i + 1;
3784 ret = -EBADF; 3784 ret = -ENOENT;
3785 goto err; 3785 goto err;
3786 } 3786 }
3787 3787
@@ -3791,7 +3791,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
3791 object_list[i]); 3791 object_list[i]);
3792 /* prevent error path from reading uninitialized data */ 3792 /* prevent error path from reading uninitialized data */
3793 args->buffer_count = i + 1; 3793 args->buffer_count = i + 1;
3794 ret = -EBADF; 3794 ret = -EINVAL;
3795 goto err; 3795 goto err;
3796 } 3796 }
3797 obj_priv->in_execbuffer = true; 3797 obj_priv->in_execbuffer = true;
@@ -4265,7 +4265,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
4265 DRM_ERROR("Bad handle in i915_gem_pin_ioctl(): %d\n", 4265 DRM_ERROR("Bad handle in i915_gem_pin_ioctl(): %d\n",
4266 args->handle); 4266 args->handle);
4267 mutex_unlock(&dev->struct_mutex); 4267 mutex_unlock(&dev->struct_mutex);
4268 return -EBADF; 4268 return -ENOENT;
4269 } 4269 }
4270 obj_priv = to_intel_bo(obj); 4270 obj_priv = to_intel_bo(obj);
4271 4271
@@ -4321,7 +4321,7 @@ i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
4321 DRM_ERROR("Bad handle in i915_gem_unpin_ioctl(): %d\n", 4321 DRM_ERROR("Bad handle in i915_gem_unpin_ioctl(): %d\n",
4322 args->handle); 4322 args->handle);
4323 mutex_unlock(&dev->struct_mutex); 4323 mutex_unlock(&dev->struct_mutex);
4324 return -EBADF; 4324 return -ENOENT;
4325 } 4325 }
4326 4326
4327 obj_priv = to_intel_bo(obj); 4327 obj_priv = to_intel_bo(obj);
@@ -4355,7 +4355,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
4355 if (obj == NULL) { 4355 if (obj == NULL) {
4356 DRM_ERROR("Bad handle in i915_gem_busy_ioctl(): %d\n", 4356 DRM_ERROR("Bad handle in i915_gem_busy_ioctl(): %d\n",
4357 args->handle); 4357 args->handle);
4358 return -EBADF; 4358 return -ENOENT;
4359 } 4359 }
4360 4360
4361 mutex_lock(&dev->struct_mutex); 4361 mutex_lock(&dev->struct_mutex);
@@ -4408,7 +4408,7 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
4408 if (obj == NULL) { 4408 if (obj == NULL) {
4409 DRM_ERROR("Bad handle in i915_gem_madvise_ioctl(): %d\n", 4409 DRM_ERROR("Bad handle in i915_gem_madvise_ioctl(): %d\n",
4410 args->handle); 4410 args->handle);
4411 return -EBADF; 4411 return -ENOENT;
4412 } 4412 }
4413 4413
4414 mutex_lock(&dev->struct_mutex); 4414 mutex_lock(&dev->struct_mutex);