From bc6f3bf2503251dd734289e0a429c9f7fe4aef83 Mon Sep 17 00:00:00 2001 From: Jens Wiklander Date: Wed, 20 Nov 2019 09:25:18 +0100 Subject: core: remove unreachable code from tee_tadb_ta_open() Prior to this patch tee_tadb_ta_open() had some unreachable code. With this patch remove that code, but retain the behaviour of tee_tadb_ta_open(). Reviewed-by: Jerome Forissier Signed-off-by: Jens Wiklander --- core/tee/tadb.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'core/tee') diff --git a/core/tee/tadb.c b/core/tee/tadb.c index b1a77606..01f00234 100644 --- a/core/tee/tadb.c +++ b/core/tee/tadb.c @@ -619,10 +619,9 @@ TEE_Result tee_tadb_ta_delete(const TEE_UUID *uuid) TEE_Result tee_tadb_ta_open(const TEE_UUID *uuid, struct tee_tadb_ta_read **ta_ret) { - TEE_Result res; - size_t idx; - struct tee_tadb_ta_read *ta; - static struct tadb_entry last_entry; + TEE_Result res = TEE_SUCCESS; + size_t idx = 0; + struct tee_tadb_ta_read *ta = NULL; if (is_null_uuid(uuid)) return TEE_ERROR_GENERIC; @@ -631,19 +630,15 @@ TEE_Result tee_tadb_ta_open(const TEE_UUID *uuid, if (!ta) return TEE_ERROR_OUT_OF_MEMORY; - if (!memcmp(uuid, &last_entry.prop.uuid, sizeof(*uuid))) { - ta->entry = last_entry; - } else { - res = tee_tadb_open(&ta->db); - if (res) - goto err_free; /* Mustn't all tadb_put() */ + res = tee_tadb_open(&ta->db); + if (res) + goto err_free; /* Mustn't call tadb_put() */ - mutex_read_lock(&tadb_mutex); - res = find_ent(ta->db, uuid, &idx, &ta->entry); - mutex_read_unlock(&tadb_mutex); - if (res) - goto err; - } + mutex_read_lock(&tadb_mutex); + res = find_ent(ta->db, uuid, &idx, &ta->entry); + mutex_read_unlock(&tadb_mutex); + if (res) + goto err; res = ta_operation_open(OPTEE_RPC_FS_OPEN, ta->entry.file_number, &ta->fd); -- cgit v1.2.3