summaryrefslogtreecommitdiff
path: root/linux-core/drm_bufs.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer-ubuntu.(none)>2006-08-29 00:01:19 +1000
committerDave Airlie <airlied@starflyer-ubuntu.(none)>2006-08-29 00:01:19 +1000
commit3cfab681b3c82c7951f1cc337d2021a6f0d08b1e (patch)
tree4d880f5961a0fe31bddf80391923f117add9e674 /linux-core/drm_bufs.c
parent88928380c87e60d22a0a9698c468036f180f0761 (diff)
parent9b984b34e99f694e10251e15bc2ec1bc844dcca4 (diff)
Merge branch 'master' into nouveau-1
Diffstat (limited to 'linux-core/drm_bufs.c')
-rw-r--r--linux-core/drm_bufs.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c
index 7d3121d3..abd7c829 100644
--- a/linux-core/drm_bufs.c
+++ b/linux-core/drm_bufs.c
@@ -65,7 +65,7 @@ static drm_map_list_t *drm_find_matching_map(drm_device_t *dev,
return NULL;
}
-static int drm_map_handle(drm_device_t *dev, drm_hash_item_t *hash,
+static int drm_map_handle(drm_device_t *dev, drm_hash_item_t *hash,
unsigned long user_token, int hashed_handle)
{
int use_hashed_handle;
@@ -78,14 +78,16 @@ static int drm_map_handle(drm_device_t *dev, drm_hash_item_t *hash,
#error Unsupported long size. Neither 64 nor 32 bits.
#endif
- if (use_hashed_handle) {
- return drm_ht_just_insert_please(&dev->map_hash, hash,
- user_token, 32 - PAGE_SHIFT - 3,
- PAGE_SHIFT, DRM_MAP_HASH_OFFSET);
- } else {
+ if (!use_hashed_handle) {
+ int ret;
hash->key = user_token;
- return drm_ht_insert_item(&dev->map_hash, hash);
+ ret = drm_ht_insert_item(&dev->map_hash, hash);
+ if (ret != -EINVAL)
+ return ret;
}
+ return drm_ht_just_insert_please(&dev->map_hash, hash,
+ user_token, 32 - PAGE_SHIFT - 3,
+ PAGE_SHIFT, DRM_MAP_HASH_OFFSET);
}
/**
@@ -290,7 +292,7 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
user_token = (map->type == _DRM_SHM) ? (unsigned long) map->handle :
map->offset;
- ret = drm_map_handle(dev, &list->hash, user_token, 0);
+ ret = drm_map_handle(dev, &list->hash, user_token, 0);
if (ret) {
drm_free(map, sizeof(*map), DRM_MEM_MAPS);