[PATCH] intel: update global_name before HASH_ADD

Dongwon Kim dongwon.kim at intel.com
Sat Jan 14 00:07:00 UTC 2017


bo->global_name should be updated first before a hash value
for the entry is calculated with it by HASH_ADD macro.

Signed-off-by: Dongwon Kim <dongwon.kim at intel.com>
---
 intel/intel_bufmgr_gem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 75949b9..c47cb9b 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -2736,11 +2736,12 @@ drm_intel_gem_bo_flink(drm_intel_bo *bo, uint32_t * name)
 
 		pthread_mutex_lock(&bufmgr_gem->lock);
 		if (!bo_gem->global_name) {
+			bo_gem->global_name = flink.name;
+			bo_gem->reusable = false;
+
 			HASH_ADD(name_hh, bufmgr_gem->name_table,
 				 global_name, sizeof(bo_gem->global_name),
 				 bo_gem);
-			bo_gem->global_name = flink.name;
-			bo_gem->reusable = false;
 		}
 		pthread_mutex_unlock(&bufmgr_gem->lock);
 	}
-- 
2.7.4



More information about the dri-devel mailing list