zlogger: asorted code cleanup 86/298686/2
authorMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 11 Sep 2023 15:42:13 +0000 (17:42 +0200)
committerMateusz Majewski <m.majewski2@samsung.com>
Wed, 13 Sep 2023 12:00:31 +0000 (14:00 +0200)
Simplify code a bit by reusing common part.

Change-Id: I95f0c5f89b3d89fde2961e6cd7aa5c31aa2e61f4
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
kernel/zlogger/zlogger.c

index c99630a..b5ddc2c 100644 (file)
@@ -144,13 +144,12 @@ static struct thread_table_field *get_thread_table(pid_t tid, bool is_stdout)
 
 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);