summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/drm_bufs.c14
-rw-r--r--linux-core/drm_hashtab.c6
2 files changed, 11 insertions, 9 deletions
diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c
index efb48dce..29983060 100644
--- a/linux-core/drm_bufs.c
+++ b/linux-core/drm_bufs.c
@@ -78,14 +78,16 @@ 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)
+ return 0;
}
+ return drm_ht_just_insert_please(&dev->map_hash, hash,
+ user_token, 32 - PAGE_SHIFT - 3,
+ PAGE_SHIFT, DRM_MAP_HASH_OFFSET);
}
/**
diff --git a/linux-core/drm_hashtab.c b/linux-core/drm_hashtab.c
index 40599227..63ee5f91 100644
--- a/linux-core/drm_hashtab.c
+++ b/linux-core/drm_hashtab.c
@@ -115,7 +115,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
hlist_for_each(list, h_list) {
entry = hlist_entry(list, drm_hash_item_t, head);
if (entry->key == key)
- return -1;
+ return -EINVAL;
if (entry->key > key)
break;
parent = list;
@@ -163,7 +163,7 @@ int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key,
list = drm_ht_find_key(ht, key);
if (!list)
- return -1;
+ return -EINVAL;
*item = hlist_entry(list, drm_hash_item_t, head);
return 0;
@@ -179,7 +179,7 @@ int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key)
ht->fill--;
return 0;
}
- return -1;
+ return -EINVAL;
}
int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item)