Commit 47cc1409 authored by Thomas Hellstrom's avatar Thomas Hellstrom Committed by Dave Airlie

drm: Fix hashtab implementation leaking illegal error codes to user space.

reported by Dave Airlie
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 9b1a51b6
...@@ -106,7 +106,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item) ...@@ -106,7 +106,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
hlist_for_each(list, h_list) { hlist_for_each(list, h_list) {
entry = hlist_entry(list, drm_hash_item_t, head); entry = hlist_entry(list, drm_hash_item_t, head);
if (entry->key == key) if (entry->key == key)
return -1; return -EINVAL;
if (entry->key > key) if (entry->key > key)
break; break;
parent = list; parent = list;
...@@ -154,7 +154,7 @@ int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key, ...@@ -154,7 +154,7 @@ int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key,
list = drm_ht_find_key(ht, key); list = drm_ht_find_key(ht, key);
if (!list) if (!list)
return -1; return -EINVAL;
*item = hlist_entry(list, drm_hash_item_t, head); *item = hlist_entry(list, drm_hash_item_t, head);
return 0; return 0;
...@@ -170,7 +170,7 @@ int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key) ...@@ -170,7 +170,7 @@ int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key)
ht->fill--; ht->fill--;
return 0; return 0;
} }
return -1; return -EINVAL;
} }
int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item) int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment