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>
diff --git a/core/tee/tadb.c b/core/tee/tadb.c
index b1a7760..01f0023 100644
--- a/core/tee/tadb.c
+++ b/core/tee/tadb.c
@@ -619,10 +619,9 @@
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 @@
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);