aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_ioctl.c')
-rw-r--r--drivers/gpu/drm/drm_ioctl.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 904d7e9c8e47..956fd38d7c9e 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -158,14 +158,11 @@ int drm_getmap(struct drm_device *dev, void *data,
158 int i; 158 int i;
159 159
160 idx = map->offset; 160 idx = map->offset;
161 161 if (idx < 0)
162 mutex_lock(&dev->struct_mutex);
163 if (idx < 0) {
164 mutex_unlock(&dev->struct_mutex);
165 return -EINVAL; 162 return -EINVAL;
166 }
167 163
168 i = 0; 164 i = 0;
165 mutex_lock(&dev->struct_mutex);
169 list_for_each(list, &dev->maplist) { 166 list_for_each(list, &dev->maplist) {
170 if (i == idx) { 167 if (i == idx) {
171 r_list = list_entry(list, struct drm_map_list, head); 168 r_list = list_entry(list, struct drm_map_list, head);
@@ -211,9 +208,9 @@ int drm_getclient(struct drm_device *dev, void *data,
211 int i; 208 int i;
212 209
213 idx = client->idx; 210 idx = client->idx;
214 mutex_lock(&dev->struct_mutex);
215
216 i = 0; 211 i = 0;
212
213 mutex_lock(&dev->struct_mutex);
217 list_for_each_entry(pt, &dev->filelist, lhead) { 214 list_for_each_entry(pt, &dev->filelist, lhead) {
218 if (i++ >= idx) { 215 if (i++ >= idx) {
219 client->auth = pt->authenticated; 216 client->auth = pt->authenticated;
@@ -249,8 +246,6 @@ int drm_getstats(struct drm_device *dev, void *data,
249 246
250 memset(stats, 0, sizeof(*stats)); 247 memset(stats, 0, sizeof(*stats));
251 248
252 mutex_lock(&dev->struct_mutex);
253
254 for (i = 0; i < dev->counters; i++) { 249 for (i = 0; i < dev->counters; i++) {
255 if (dev->types[i] == _DRM_STAT_LOCK) 250 if (dev->types[i] == _DRM_STAT_LOCK)
256 stats->data[i].value = 251 stats->data[i].value =
@@ -262,8 +257,6 @@ int drm_getstats(struct drm_device *dev, void *data,
262 257
263 stats->count = dev->counters; 258 stats->count = dev->counters;
264 259
265 mutex_unlock(&dev->struct_mutex);
266
267 return 0; 260 return 0;
268} 261}
269 262