diff mbox

intel: update global_name before HASH_ADD

Message ID 1484352420-9522-1-git-send-email-dongwon.kim@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kim, Dongwon Jan. 14, 2017, 12:07 a.m. UTC
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>
---
 intel/intel_bufmgr_gem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Chris Wilson Jan. 15, 2017, 8:16 p.m. UTC | #1
On Fri, Jan 13, 2017 at 04:07:00PM -0800, Dongwon Kim wrote:
> 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>

Thanks for the fix! Pushed,
-Chris
diff mbox

Patch

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);
 	}