aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_context.c')
-rw-r--r--drivers/char/drm/drm_context.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c
index 83094c73da67..e1f882dc55aa 100644
--- a/drivers/char/drm/drm_context.c
+++ b/drivers/char/drm/drm_context.c
@@ -233,7 +233,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
233 mutex_unlock(&dev->struct_mutex); 233 mutex_unlock(&dev->struct_mutex);
234 234
235 request.handle = NULL; 235 request.handle = NULL;
236 list_for_each_entry(_entry, &dev->maplist->head, head) { 236 list_for_each_entry(_entry, &dev->maplist, head) {
237 if (_entry->map == map) { 237 if (_entry->map == map) {
238 request.handle = 238 request.handle =
239 (void *)(unsigned long)_entry->user_token; 239 (void *)(unsigned long)_entry->user_token;
@@ -268,15 +268,13 @@ int drm_setsareactx(struct inode *inode, struct file *filp,
268 drm_ctx_priv_map_t request; 268 drm_ctx_priv_map_t request;
269 drm_map_t *map = NULL; 269 drm_map_t *map = NULL;
270 drm_map_list_t *r_list = NULL; 270 drm_map_list_t *r_list = NULL;
271 struct list_head *list;
272 271
273 if (copy_from_user(&request, 272 if (copy_from_user(&request,
274 (drm_ctx_priv_map_t __user *) arg, sizeof(request))) 273 (drm_ctx_priv_map_t __user *) arg, sizeof(request)))
275 return -EFAULT; 274 return -EFAULT;
276 275
277 mutex_lock(&dev->struct_mutex); 276 mutex_lock(&dev->struct_mutex);
278 list_for_each(list, &dev->maplist->head) { 277 list_for_each_entry(r_list, &dev->maplist, head) {
279 r_list = list_entry(list, drm_map_list_t, head);
280 if (r_list->map 278 if (r_list->map
281 && r_list->user_token == (unsigned long)request.handle) 279 && r_list->user_token == (unsigned long)request.handle)
282 goto found; 280 goto found;
@@ -449,7 +447,7 @@ int drm_addctx(struct inode *inode, struct file *filp,
449 ctx_entry->tag = priv; 447 ctx_entry->tag = priv;
450 448
451 mutex_lock(&dev->ctxlist_mutex); 449 mutex_lock(&dev->ctxlist_mutex);
452 list_add(&ctx_entry->head, &dev->ctxlist->head); 450 list_add(&ctx_entry->head, &dev->ctxlist);
453 ++dev->ctx_count; 451 ++dev->ctx_count;
454 mutex_unlock(&dev->ctxlist_mutex); 452 mutex_unlock(&dev->ctxlist_mutex);
455 453
@@ -575,10 +573,10 @@ int drm_rmctx(struct inode *inode, struct file *filp,
575 } 573 }
576 574
577 mutex_lock(&dev->ctxlist_mutex); 575 mutex_lock(&dev->ctxlist_mutex);
578 if (!list_empty(&dev->ctxlist->head)) { 576 if (!list_empty(&dev->ctxlist)) {
579 drm_ctx_list_t *pos, *n; 577 drm_ctx_list_t *pos, *n;
580 578
581 list_for_each_entry_safe(pos, n, &dev->ctxlist->head, head) { 579 list_for_each_entry_safe(pos, n, &dev->ctxlist, head) {
582 if (pos->handle == ctx.handle) { 580 if (pos->handle == ctx.handle) {
583 list_del(&pos->head); 581 list_del(&pos->head);
584 drm_free(pos, sizeof(*pos), DRM_MEM_CTXLIST); 582 drm_free(pos, sizeof(*pos), DRM_MEM_CTXLIST);