]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
drm: Use ENOENT consistently for the error return for an unmatched handle.
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 4 Aug 2010 13:19:46 +0000 (14:19 +0100)
committerDave Airlie <airlied@redhat.com>
Tue, 10 Aug 2010 00:46:55 +0000 (10:46 +1000)
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>
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_tiling.c
drivers/gpu/drm/nouveau/nouveau_gem.c
drivers/gpu/drm/nouveau/nv04_crtc.c
drivers/gpu/drm/nouveau/nv50_crtc.c
drivers/gpu/drm/radeon/radeon_cs.c
drivers/gpu/drm/radeon/radeon_cursor.c
drivers/gpu/drm/radeon/radeon_gem.c

index 4f1b8671448921dc74b4a7e201d2a03309f495d5..bf92d07510df740d856c173e7dcce292659fe6f7 100644 (file)
@@ -322,7 +322,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
 
        obj = drm_gem_object_lookup(dev, file_priv, args->handle);
        if (obj == NULL)
-               return -EBADF;
+               return -ENOENT;
 
 again:
        if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0) {
index 2a4ed7ca8b4ec6b1e415c2367144a4c6af158ae5..0758c7802e6b7e59e6f8993296a64856760cbd65 100644 (file)
@@ -456,7 +456,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
 
        obj = drm_gem_object_lookup(dev, file_priv, args->handle);
        if (obj == NULL)
-               return -EBADF;
+               return -ENOENT;
        obj_priv = to_intel_bo(obj);
 
        /* Bounds check source.
@@ -919,7 +919,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
 
        obj = drm_gem_object_lookup(dev, file_priv, args->handle);
        if (obj == NULL)
-               return -EBADF;
+               return -ENOENT;
        obj_priv = to_intel_bo(obj);
 
        /* Bounds check destination.
@@ -1002,7 +1002,7 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
 
        obj = drm_gem_object_lookup(dev, file_priv, args->handle);
        if (obj == NULL)
-               return -EBADF;
+               return -ENOENT;
        obj_priv = to_intel_bo(obj);
 
        mutex_lock(&dev->struct_mutex);
@@ -1060,7 +1060,7 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
        obj = drm_gem_object_lookup(dev, file_priv, args->handle);
        if (obj == NULL) {
                mutex_unlock(&dev->struct_mutex);
-               return -EBADF;
+               return -ENOENT;
        }
 
 #if WATCH_BUF
@@ -1099,7 +1099,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
 
        obj = drm_gem_object_lookup(dev, file_priv, args->handle);
        if (obj == NULL)
-               return -EBADF;
+               return -ENOENT;
 
        offset = args->offset;
 
@@ -1373,7 +1373,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
 
        obj = drm_gem_object_lookup(dev, file_priv, args->handle);
        if (obj == NULL)
-               return -EBADF;
+               return -ENOENT;
 
        mutex_lock(&dev->struct_mutex);
 
@@ -3364,7 +3364,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
                                                   reloc->target_handle);
                if (target_obj == NULL) {
                        i915_gem_object_unpin(obj);
-                       return -EBADF;
+                       return -ENOENT;
                }
                target_obj_priv = to_intel_bo(target_obj);
 
@@ -3781,7 +3781,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
                                   exec_list[i].handle, i);
                        /* prevent error path from reading uninitialized data */
                        args->buffer_count = i + 1;
-                       ret = -EBADF;
+                       ret = -ENOENT;
                        goto err;
                }
 
@@ -3791,7 +3791,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
                                   object_list[i]);
                        /* prevent error path from reading uninitialized data */
                        args->buffer_count = i + 1;
-                       ret = -EBADF;
+                       ret = -EINVAL;
                        goto err;
                }
                obj_priv->in_execbuffer = true;
@@ -4265,7 +4265,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
                DRM_ERROR("Bad handle in i915_gem_pin_ioctl(): %d\n",
                          args->handle);
                mutex_unlock(&dev->struct_mutex);
-               return -EBADF;
+               return -ENOENT;
        }
        obj_priv = to_intel_bo(obj);
 
@@ -4321,7 +4321,7 @@ i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
                DRM_ERROR("Bad handle in i915_gem_unpin_ioctl(): %d\n",
                          args->handle);
                mutex_unlock(&dev->struct_mutex);
-               return -EBADF;
+               return -ENOENT;
        }
 
        obj_priv = to_intel_bo(obj);
@@ -4355,7 +4355,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
        if (obj == NULL) {
                DRM_ERROR("Bad handle in i915_gem_busy_ioctl(): %d\n",
                          args->handle);
-               return -EBADF;
+               return -ENOENT;
        }
 
        mutex_lock(&dev->struct_mutex);
@@ -4408,7 +4408,7 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
        if (obj == NULL) {
                DRM_ERROR("Bad handle in i915_gem_madvise_ioctl(): %d\n",
                          args->handle);
-               return -EBADF;
+               return -ENOENT;
        }
 
        mutex_lock(&dev->struct_mutex);
index 155719e4d16fa899745bbf2ee757c9fdd65cc827..710eca70b323953e376d3c214a33e78996bed1d2 100644 (file)
@@ -275,7 +275,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
 
        obj = drm_gem_object_lookup(dev, file_priv, args->handle);
        if (obj == NULL)
-               return -EINVAL;
+               return -ENOENT;
        obj_priv = to_intel_bo(obj);
 
        if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode)) {
@@ -362,7 +362,7 @@ i915_gem_get_tiling(struct drm_device *dev, void *data,
 
        obj = drm_gem_object_lookup(dev, file_priv, args->handle);
        if (obj == NULL)
-               return -EINVAL;
+               return -ENOENT;
        obj_priv = to_intel_bo(obj);
 
        mutex_lock(&dev->struct_mutex);
index 547f2c24c1e76ac38eaab50db207e5eaa5c59395..0f417ac1b696b769a0982f762bfa696a50637de1 100644 (file)
@@ -284,7 +284,7 @@ retry:
                if (!gem) {
                        NV_ERROR(dev, "Unknown handle 0x%08x\n", b->handle);
                        validate_fini(op, NULL);
-                       return -EINVAL;
+                       return -ENOENT;
                }
                nvbo = gem->driver_private;
 
@@ -759,7 +759,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,
 
        gem = drm_gem_object_lookup(dev, file_priv, req->handle);
        if (!gem)
-               return ret;
+               return -ENOENT;
        nvbo = nouveau_gem_object(gem);
 
        if (nvbo->cpu_filp) {
@@ -797,7 +797,7 @@ nouveau_gem_ioctl_cpu_fini(struct drm_device *dev, void *data,
 
        gem = drm_gem_object_lookup(dev, file_priv, req->handle);
        if (!gem)
-               return ret;
+               return -ENOENT;
        nvbo = nouveau_gem_object(gem);
 
        if (nvbo->cpu_filp != file_priv)
@@ -822,7 +822,7 @@ nouveau_gem_ioctl_info(struct drm_device *dev, void *data,
 
        gem = drm_gem_object_lookup(dev, file_priv, req->handle);
        if (!gem)
-               return -EINVAL;
+               return -ENOENT;
 
        ret = nouveau_gem_info(gem, req);
        drm_gem_object_unreference_unlocked(gem);
index 08c7e073edce266887480c46aee61a0e9b3bb1b0..96f46c421fa5567d2e92dd86f52213bc1d6fc46a 100644 (file)
@@ -917,7 +917,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 
        gem = drm_gem_object_lookup(dev, file_priv, buffer_handle);
        if (!gem)
-               return -EINVAL;
+               return -ENOENT;
        cursor = nouveau_gem_object(gem);
 
        ret = nouveau_bo_map(cursor);
index a438e56a5286cbc1a92802f4fa6f998bdd8a56ee..dbd9a63bc7f2d8305d8422f67281707a5a0b569d 100644 (file)
@@ -365,7 +365,7 @@ nv50_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 
        gem = drm_gem_object_lookup(dev, file_priv, buffer_handle);
        if (!gem)
-               return -EINVAL;
+               return -ENOENT;
        cursor = nouveau_gem_object(gem);
 
        ret = nouveau_bo_map(cursor);
index ae0fb7356e627c083ec4c1a0222608b43d917cf8..fcc79b5d22d1de44f1b76e9f2793b0b0aa95ba80 100644 (file)
@@ -72,7 +72,7 @@ int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
                        if (p->relocs[i].gobj == NULL) {
                                DRM_ERROR("gem object lookup failed 0x%x\n",
                                          r->handle);
-                               return -EINVAL;
+                               return -ENOENT;
                        }
                        p->relocs_ptr[i] = &p->relocs[i];
                        p->relocs[i].robj = p->relocs[i].gobj->driver_private;
index 4eb67c0e0996e539b9ad46242b25ef0070e8dfeb..5731fc9b1ae3ae9274188a5bf8cdae7aa78f3b33 100644 (file)
@@ -170,7 +170,7 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc,
        obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
        if (!obj) {
                DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id);
-               return -EINVAL;
+               return -ENOENT;
        }
 
        ret = radeon_gem_object_pin(obj, RADEON_GEM_DOMAIN_VRAM, &gpu_addr);
index a72a3ee5d69b332242f48ce7cc5304aa59d4e619..c578f265b24cefc6dce21734783b01c1aed1ce27 100644 (file)
@@ -226,7 +226,7 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,
        /* just do a BO wait for now */
        gobj = drm_gem_object_lookup(dev, filp, args->handle);
        if (gobj == NULL) {
-               return -EINVAL;
+               return -ENOENT;
        }
        robj = gobj->driver_private;
 
@@ -245,7 +245,7 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data,
 
        gobj = drm_gem_object_lookup(dev, filp, args->handle);
        if (gobj == NULL) {
-               return -EINVAL;
+               return -ENOENT;
        }
        robj = gobj->driver_private;
        args->addr_ptr = radeon_bo_mmap_offset(robj);
@@ -264,7 +264,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
 
        gobj = drm_gem_object_lookup(dev, filp, args->handle);
        if (gobj == NULL) {
-               return -EINVAL;
+               return -ENOENT;
        }
        robj = gobj->driver_private;
        r = radeon_bo_wait(robj, &cur_placement, true);
@@ -294,7 +294,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
 
        gobj = drm_gem_object_lookup(dev, filp, args->handle);
        if (gobj == NULL) {
-               return -EINVAL;
+               return -ENOENT;
        }
        robj = gobj->driver_private;
        r = radeon_bo_wait(robj, NULL, false);
@@ -316,7 +316,7 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data,
        DRM_DEBUG("%d \n", args->handle);
        gobj = drm_gem_object_lookup(dev, filp, args->handle);
        if (gobj == NULL)
-               return -EINVAL;
+               return -ENOENT;
        robj = gobj->driver_private;
        r = radeon_bo_set_tiling_flags(robj, args->tiling_flags, args->pitch);
        drm_gem_object_unreference_unlocked(gobj);
@@ -334,7 +334,7 @@ int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data,
        DRM_DEBUG("\n");
        gobj = drm_gem_object_lookup(dev, filp, args->handle);
        if (gobj == NULL)
-               return -EINVAL;
+               return -ENOENT;
        rbo = gobj->driver_private;
        r = radeon_bo_reserve(rbo, false);
        if (unlikely(r != 0))