Simplify code a bit by reusing common part.
Change-Id: I95f0c5f89b3d89fde2961e6cd7aa5c31aa2e61f4
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
static struct thread_table_field *set_thread_table(pid_t tid, bool is_stdout, uint16_t blk)
{
- struct thread_table_field *ptr = NULL;
+ struct thread_table_field *ptr;
- hash_for_each_possible(g_thread_table->data, ptr, next, tid) {
- if (ptr->tid == tid && ptr->is_stdout == is_stdout) {
- ptr->blk = blk;
- return ptr;
- }
+ ptr = get_thread_table(tid, is_stdout);
+ if (ptr) {
+ ptr->blk = blk;
+ return ptr;
}
ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);