From 6946ec86df0cab8a3fa33133f10df38f1cd79bee Mon Sep 17 00:00:00 2001 From: Ling Wan Date: Fri, 7 Jun 2013 21:19:43 -0700 Subject: [PATCH] msm: kgsl: Only initialize process structure once If the debug root of the process structure is initialized then it means that the remaining fields will also be initialized. Check this field at the beginning of the initialization routine and skip to end of the function. This also by-passes the reinitialization of some fields because of errorneous NULL pointer check of rb node. The rb node is always initialized to NULL so checking if it is NULL to determine whether the pointer is initialized or not is wrong. CRs-Fixed: 498014 Change-Id: I73b2124c037187bc96942714dac62c0a72c26372 Signed-off-by: Shubhraprakash Das Signed-off-by: Ling Wan --- drivers/gpu/msm/kgsl.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c index 36dab33e4a8..710720df4ff 100644 --- a/drivers/gpu/msm/kgsl.c +++ b/drivers/gpu/msm/kgsl.c @@ -903,10 +903,15 @@ kgsl_get_process_private(struct kgsl_device_private *cur_dev_priv) mutex_lock(&private->process_private_mutex); - if (!private->mem_rb.rb_node) { - private->mem_rb = RB_ROOT; - idr_init(&private->mem_idr); - } + /* + * If debug root initialized then it means the rest of the fields + * are also initialized + */ + if (private->debug_root) + goto done; + + private->mem_rb = RB_ROOT; + idr_init(&private->mem_idr); if ((!private->pagetable) && kgsl_mmu_enabled()) { unsigned long pt_name; @@ -921,11 +926,10 @@ kgsl_get_process_private(struct kgsl_device_private *cur_dev_priv) } } - if (!private->kobj.parent) - kgsl_process_init_sysfs(private); - if (!private->debug_root) - kgsl_process_init_debugfs(private); + kgsl_process_init_sysfs(private); + kgsl_process_init_debugfs(private); +done: mutex_unlock(&private->process_private_mutex); return private;