aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_gem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_gem.c')
-rw-r--r--drivers/gpu/drm/drm_gem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 434155b387e9..ccd1afdede02 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -251,7 +251,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
251 251
252 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 252 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
253 if (obj == NULL) 253 if (obj == NULL)
254 return -EINVAL; 254 return -EBADF;
255 255
256again: 256again:
257 if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0) 257 if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0)
@@ -259,8 +259,9 @@ again:
259 259
260 spin_lock(&dev->object_name_lock); 260 spin_lock(&dev->object_name_lock);
261 if (obj->name) { 261 if (obj->name) {
262 args->name = obj->name;
262 spin_unlock(&dev->object_name_lock); 263 spin_unlock(&dev->object_name_lock);
263 return -EEXIST; 264 return 0;
264 } 265 }
265 ret = idr_get_new_above(&dev->object_name_idr, obj, 1, 266 ret = idr_get_new_above(&dev->object_name_idr, obj, 1,
266 &obj->name); 267 &obj->name);