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 <sadas@codeaurora.org>
Signed-off-by: Ling Wan <lingw@codeaurora.org>
This commit is contained in:
Ling Wan
2013-06-07 21:19:43 -07:00
committed by Iliyan Malchev
parent 43159f81ab
commit 6946ec86df

View File

@@ -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;