OP-TEE: use sema_init instead of __SEMAPHORE_INITIALIZER
authorHuang, Tao <huangtao@rock-chips.com>
Sat, 6 May 2017 05:45:41 +0000 (13:45 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 8 May 2017 01:44:37 +0000 (09:44 +0800)
Fix lockdep warning:
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU:rk3288:/ $  0 PID: 234 Comm: tee-supplicant Not tainted 4.4.64 #51
Hardware name: Rockchip (Device Tree)
[<c0110018>] (unwind_backtrace) from [<c010c048>] (show_stack+0x10/0x14)
[<c010c048>] (show_stack) from [<c04194a8>] (dump_stack+0x9c/0xd4)
[<c04194a8>] (dump_stack) from [<c018321c>] (__lock_acquire+0x638/0x1c10)
[<c018321c>] (__lock_acquire) from [<c01850ec>] (lock_acquire+0x1d0/0x29c)
[<c01850ec>] (lock_acquire) from [<c0bc0f3c>] (_raw_spin_lock_irqsave+0x50/0x64)
[<c0bc0f3c>] (_raw_spin_lock_irqsave) from [<c017e148>] (down_interruptible+0xc/0x48)
[<c017e148>] (down_interruptible) from [<c03cd72c>] (tee_supp_read+0x74/0x154)
[<c03cd72c>] (tee_supp_read) from [<c025d638>] (__vfs_read+0x2c/0xf0)
[<c025d638>] (__vfs_read) from [<c025de30>] (vfs_read+0x84/0x134)
[<c025de30>] (vfs_read) from [<c025e720>] (SyS_read+0x4c/0xa4)
[<c025e720>] (SyS_read) from [<c01072c0>] (ret_fast_syscall+0x0/0x1c)

Change-Id: I09335112bed6efb30e60a22b471d4467eecaf520
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
security/optee_linuxdriver/core/tee_supp_com.c

index dbb5f19270d37b8e905baee3e77d1e87cd9f26d9..b43d9350d1648048a26c85bf2afb69f43e35a3ad 100644 (file)
@@ -258,10 +258,8 @@ int tee_supp_init(struct tee *tee)
                return -ENOMEM;
        }
 
-       rpc->datafromuser = (struct semaphore)
-           __SEMAPHORE_INITIALIZER(rpc->datafromuser, 0);
-       rpc->datatouser = (struct semaphore)
-           __SEMAPHORE_INITIALIZER(rpc->datatouser, 0);
+       sema_init(&rpc->datafromuser, 0);
+       sema_init(&rpc->datatouser, 0);
        mutex_init(&rpc->thrd_mutex);
        mutex_init(&rpc->outsync);
        mutex_init(&rpc->insync);