From 3ee0d9f2b7a8f2cb4137067f5a5a225bbd572908 Mon Sep 17 00:00:00 2001 From: "Huang, Tao" Date: Sat, 6 May 2017 13:45:41 +0800 Subject: [PATCH] OP-TEE: use sema_init instead of __SEMAPHORE_INITIALIZER 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) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x9c/0xd4) [] (dump_stack) from [] (__lock_acquire+0x638/0x1c10) [] (__lock_acquire) from [] (lock_acquire+0x1d0/0x29c) [] (lock_acquire) from [] (_raw_spin_lock_irqsave+0x50/0x64) [] (_raw_spin_lock_irqsave) from [] (down_interruptible+0xc/0x48) [] (down_interruptible) from [] (tee_supp_read+0x74/0x154) [] (tee_supp_read) from [] (__vfs_read+0x2c/0xf0) [] (__vfs_read) from [] (vfs_read+0x84/0x134) [] (vfs_read) from [] (SyS_read+0x4c/0xa4) [] (SyS_read) from [] (ret_fast_syscall+0x0/0x1c) Change-Id: I09335112bed6efb30e60a22b471d4467eecaf520 Signed-off-by: Huang, Tao --- security/optee_linuxdriver/core/tee_supp_com.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/security/optee_linuxdriver/core/tee_supp_com.c b/security/optee_linuxdriver/core/tee_supp_com.c index dbb5f19270d3..b43d9350d164 100644 --- a/security/optee_linuxdriver/core/tee_supp_com.c +++ b/security/optee_linuxdriver/core/tee_supp_com.c @@ -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); -- 2.34.1