summaryrefslogtreecommitdiff
path: root/linux/drm_context.h
diff options
context:
space:
mode:
authorJeff Hartmann <jhartmann@valinux.com>2001-08-13 23:23:47 +0000
committerJeff Hartmann <jhartmann@valinux.com>2001-08-13 23:23:47 +0000
commitaa09e3611490d6a2f12f211c3c834f1237126313 (patch)
tree0938669d60d1697e119ed218f276aaa38830e29e /linux/drm_context.h
parent2d4b2cf6f69de2ceaf0c2b00ccbb24aad412b202 (diff)
Sync with Linus 2.4.9-pre2 + make all nopage routines more alike
Diffstat (limited to 'linux/drm_context.h')
-rw-r--r--linux/drm_context.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/linux/drm_context.h b/linux/drm_context.h
index 5e54d81a..eb4d61c8 100644
--- a/linux/drm_context.h
+++ b/linux/drm_context.h
@@ -160,7 +160,7 @@ int DRM(getsareactx)(struct inode *inode, struct file *filp,
return -EFAULT;
down(&dev->struct_sem);
- if ((int)request.ctx_id >= dev->max_context) {
+ if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) {
up(&dev->struct_sem);
return -EINVAL;
}
@@ -193,22 +193,20 @@ int DRM(setsareactx)(struct inode *inode, struct file *filp,
list_for_each(list, &dev->maplist->head) {
r_list = (drm_map_list_t *)list;
if(r_list->map &&
- r_list->map->handle == request.handle) break;
+ r_list->map->handle == request.handle)
+ goto found;
}
- if (list == &(dev->maplist->head)) {
- up(&dev->struct_sem);
- return -EINVAL;
- }
- map = r_list->map;
+bad:
up(&dev->struct_sem);
+ return -EINVAL;
- if (!map) return -EINVAL;
-
- down(&dev->struct_sem);
- if ((int)request.ctx_id >= dev->max_context) {
- up(&dev->struct_sem);
- return -EINVAL;
- }
+found:
+ map = r_list->map;
+ if (!map) goto bad;
+ if (dev->max_context < 0)
+ goto bad;
+ if (request.ctx_id >= (unsigned) dev->max_context)
+ goto bad;
dev->context_sareas[request.ctx_id] = map;
up(&dev->struct_sem);
return 0;