OSDN Git Service

intel: update global_name before HASH_ADD
authorDongwon Kim <dongwon.kim@intel.com>
Sat, 14 Jan 2017 00:07:00 +0000 (16:07 -0800)
committerChris Wilson <chris@chris-wilson.co.uk>
Sun, 15 Jan 2017 20:15:37 +0000 (20:15 +0000)
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@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
intel/intel_bufmgr_gem.c

index 75949b9..c47cb9b 100644 (file)
@@ -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);
        }