summaryrefslogtreecommitdiff
path: root/core/tee/tadb.c
diff options
context:
space:
mode:
authorJens Wiklander <jens.wiklander@linaro.org>2019-11-20 09:25:18 +0100
committerJérôme Forissier <jerome@forissier.org>2019-12-05 14:12:45 +0100
commitbc6f3bf2503251dd734289e0a429c9f7fe4aef83 (patch)
treecf52e4125236d302405394abb07642855fc09ef2 /core/tee/tadb.c
parent2e42d8e79e5dfa78d221a08ef773685e8720bc0f (diff)
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 <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'core/tee/tadb.c')
-rw-r--r--core/tee/tadb.c27
1 files changed, 11 insertions, 16 deletions
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);