Skip to content

Commit

Permalink
DRM: Return -EBADF on bad object in flink, and return curent name if …
Browse files Browse the repository at this point in the history
…it exists.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Eric Anholt authored and Dave Airlie committed Oct 17, 2008
1 parent dbb19d3 commit d4e7b89
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/gpu/drm/drm_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,17 @@ 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)
return -ENOMEM;

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);
Expand Down

0 comments on commit d4e7b89

Please sign in to comment.