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:
parent
d52a71fde0
commit
90ed034fda
|
|
@ -184,7 +184,7 @@ static AvbIOResult read_rollback_index(AvbOps *ops,
|
||||||
int ret;
|
int ret;
|
||||||
ret = trusty_read_rollback_index(rollback_index_location,
|
ret = trusty_read_rollback_index(rollback_index_location,
|
||||||
out_rollback_index);
|
out_rollback_index);
|
||||||
if (ret == TEE_ERROR_GENERIC) {
|
if (ret == TEE_ERROR_ITEM_NOT_FOUND) {
|
||||||
*out_rollback_index = 0;
|
*out_rollback_index = 0;
|
||||||
ret = trusty_write_rollback_index(rollback_index_location,
|
ret = trusty_write_rollback_index(rollback_index_location,
|
||||||
*out_rollback_index);
|
*out_rollback_index);
|
||||||
|
|
@ -228,7 +228,7 @@ static AvbIOResult read_is_device_unlocked(AvbOps *ops, bool *out_is_unlocked)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = trusty_read_lock_state((uint8_t *)out_is_unlocked);
|
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;
|
*out_is_unlocked = 1;
|
||||||
if (trusty_write_lock_state(*out_is_unlocked)) {
|
if (trusty_write_lock_state(*out_is_unlocked)) {
|
||||||
printf("%s: init lock state error\n", __FILE__);
|
printf("%s: init lock state error\n", __FILE__);
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ int rk_avb_read_flash_lock_state(uint8_t *flash_lock_state)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = trusty_read_flash_lock_state(flash_lock_state);
|
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;
|
*flash_lock_state = 1;
|
||||||
if (trusty_write_flash_lock_state(*flash_lock_state)) {
|
if (trusty_write_flash_lock_state(*flash_lock_state)) {
|
||||||
printf("trusty_write_flash_lock_state error!\n");
|
printf("trusty_write_flash_lock_state error!\n");
|
||||||
|
|
@ -214,7 +214,7 @@ int rk_avb_read_lock_state(uint8_t *lock_state)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = trusty_read_lock_state(lock_state);
|
ret = trusty_read_lock_state(lock_state);
|
||||||
if (ret == TEE_ERROR_GENERIC) {
|
if (ret == TEE_ERROR_ITEM_NOT_FOUND) {
|
||||||
*lock_state = 1;
|
*lock_state = 1;
|
||||||
if (rk_avb_write_lock_state(*lock_state)) {
|
if (rk_avb_write_lock_state(*lock_state)) {
|
||||||
printf("avb_write_lock_state error!\n");
|
printf("avb_write_lock_state error!\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue