aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_gem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_gem.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 70cc30803e3b..34063c561899 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -167,12 +167,10 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data,
167 167
168 ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle); 168 ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle);
169out: 169out:
170 mutex_lock(&dev->struct_mutex); 170 drm_gem_object_handle_unreference_unlocked(nvbo->gem);
171 drm_gem_object_handle_unreference(nvbo->gem);
172 mutex_unlock(&dev->struct_mutex);
173 171
174 if (ret) 172 if (ret)
175 drm_gem_object_unreference(nvbo->gem); 173 drm_gem_object_unreference_unlocked(nvbo->gem);
176 return ret; 174 return ret;
177} 175}
178 176
@@ -865,9 +863,7 @@ nouveau_gem_ioctl_pin(struct drm_device *dev, void *data,
865 req->domain = NOUVEAU_GEM_DOMAIN_VRAM; 863 req->domain = NOUVEAU_GEM_DOMAIN_VRAM;
866 864
867out: 865out:
868 mutex_lock(&dev->struct_mutex); 866 drm_gem_object_unreference_unlocked(gem);
869 drm_gem_object_unreference(gem);
870 mutex_unlock(&dev->struct_mutex);
871 867
872 return ret; 868 return ret;
873} 869}
@@ -891,9 +887,7 @@ nouveau_gem_ioctl_unpin(struct drm_device *dev, void *data,
891 887
892 ret = nouveau_bo_unpin(nouveau_gem_object(gem)); 888 ret = nouveau_bo_unpin(nouveau_gem_object(gem));
893 889
894 mutex_lock(&dev->struct_mutex); 890 drm_gem_object_unreference_unlocked(gem);
895 drm_gem_object_unreference(gem);
896 mutex_unlock(&dev->struct_mutex);
897 891
898 return ret; 892 return ret;
899} 893}
@@ -935,9 +929,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,
935 } 929 }
936 930
937out: 931out:
938 mutex_lock(&dev->struct_mutex); 932 drm_gem_object_unreference_unlocked(gem);
939 drm_gem_object_unreference(gem);
940 mutex_unlock(&dev->struct_mutex);
941 return ret; 933 return ret;
942} 934}
943 935
@@ -965,9 +957,7 @@ nouveau_gem_ioctl_cpu_fini(struct drm_device *dev, void *data,
965 ret = 0; 957 ret = 0;
966 958
967out: 959out:
968 mutex_lock(&dev->struct_mutex); 960 drm_gem_object_unreference_unlocked(gem);
969 drm_gem_object_unreference(gem);
970 mutex_unlock(&dev->struct_mutex);
971 return ret; 961 return ret;
972} 962}
973 963
@@ -986,9 +976,7 @@ nouveau_gem_ioctl_info(struct drm_device *dev, void *data,
986 return -EINVAL; 976 return -EINVAL;
987 977
988 ret = nouveau_gem_info(gem, req); 978 ret = nouveau_gem_info(gem, req);
989 mutex_lock(&dev->struct_mutex); 979 drm_gem_object_unreference_unlocked(gem);
990 drm_gem_object_unreference(gem);
991 mutex_unlock(&dev->struct_mutex);
992 return ret; 980 return ret;
993} 981}
994 982