Skip to content

Commit

Permalink
[Review] xtest: add --clear-storage option
Browse files Browse the repository at this point in the history
Fix error handling.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
  • Loading branch information
jforissier committed May 30, 2023
1 parent 604bc27 commit 033e5a4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ta/storage/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,16 +691,20 @@ static TEE_Result clear_storage(uint32_t storage_id)
if (res)
goto out;
obj_id = TEE_Malloc(TEE_OBJECT_ID_MAX_LEN, 0);
if (!obj_id)
if (!obj_id) {
res = TEE_ERROR_OUT_OF_MEMORY;
goto out;
}

while (true) {
enum_res = TEE_GetNextPersistentObject(oe, &oi, obj_id,
&obj_id_sz);
if (enum_res == TEE_ERROR_ITEM_NOT_FOUND)
break;
if (enum_res)
if (enum_res) {
res = enum_res;
break;
}
IMSG("Deleting persistent object #%zu", i);
res = TEE_OpenPersistentObject(storage_id, obj_id, obj_id_sz,
TEE_DATA_FLAG_ACCESS_WRITE_META,
Expand Down

0 comments on commit 033e5a4

Please sign in to comment.