lib: avb: change the return value if the item is not found

Change-Id: Ie6d29a59323789c594b4c6e9167c3bbe58e25e9f
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
Jason Zhu 2018-02-25 20:59:23 +08:00
parent d52a71fde0
commit 90ed034fda
2 changed files with 4 additions and 4 deletions

View File

@ -184,7 +184,7 @@ static AvbIOResult read_rollback_index(AvbOps *ops,
int ret;
ret = trusty_read_rollback_index(rollback_index_location,
out_rollback_index);
if (ret == TEE_ERROR_GENERIC) {
if (ret == TEE_ERROR_ITEM_NOT_FOUND) {
*out_rollback_index = 0;
ret = trusty_write_rollback_index(rollback_index_location,
*out_rollback_index);
@ -228,7 +228,7 @@ static AvbIOResult read_is_device_unlocked(AvbOps *ops, bool *out_is_unlocked)
int ret;
ret = trusty_read_lock_state((uint8_t *)out_is_unlocked);
if (ret == TEE_ERROR_GENERIC) {
if (ret == TEE_ERROR_ITEM_NOT_FOUND) {
*out_is_unlocked = 1;
if (trusty_write_lock_state(*out_is_unlocked)) {
printf("%s: init lock state error\n", __FILE__);

View File

@ -159,7 +159,7 @@ int rk_avb_read_flash_lock_state(uint8_t *flash_lock_state)
int ret;
ret = trusty_read_flash_lock_state(flash_lock_state);
if (ret == TEE_ERROR_GENERIC) {
if (ret == TEE_ERROR_ITEM_NOT_FOUND) {
*flash_lock_state = 1;
if (trusty_write_flash_lock_state(*flash_lock_state)) {
printf("trusty_write_flash_lock_state error!\n");
@ -214,7 +214,7 @@ int rk_avb_read_lock_state(uint8_t *lock_state)
int ret;
ret = trusty_read_lock_state(lock_state);
if (ret == TEE_ERROR_GENERIC) {
if (ret == TEE_ERROR_ITEM_NOT_FOUND) {
*lock_state = 1;
if (rk_avb_write_lock_state(*lock_state)) {
printf("avb_write_lock_state error!\n");