From 459b234d79daaa8a003da9ea48775a5587d5ba2a Mon Sep 17 00:00:00 2001
From: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date: Wed, 23 Aug 2006 11:31:10 +0200
Subject: Allow multiple addMaps with the same 32-bit map offset. (Reported by
 Dave Airlie)

---
 linux-core/drm_bufs.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'linux-core')

diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c
index 2eeb401d..13b0b174 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);
 }
 
 /**
-- 
cgit v1.2.3