]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
DRM: Return -EBADF on bad object in flink, and return curent name if it exists.
authorEric Anholt <eric@anholt.net>
Tue, 9 Sep 2008 18:40:34 +0000 (11:40 -0700)
committerDave Airlie <airlied@linux.ie>
Fri, 17 Oct 2008 21:10:52 +0000 (07:10 +1000)
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_gem.c

index 434155b387e9f4ad34d468f2b87a2665843477a9..ccd1afdede0249f5109e614732d85e67bbfd8b4b 100644 (file)
@@ -251,7 +251,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 -EINVAL;
+               return -EBADF;
 
 again:
        if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0)
@@ -259,8 +259,9 @@ again:
 
        spin_lock(&dev->object_name_lock);
        if (obj->name) {
+               args->name = obj->name;
                spin_unlock(&dev->object_name_lock);
-               return -EEXIST;
+               return 0;
        }
        ret = idr_get_new_above(&dev->object_name_idr, obj, 1,
                                 &obj->name);