target/riscv: improve error handling in trigger setup

Change-Id: I235973a3c44fb3d934925c74ffee47f8bd96de0d
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
This commit is contained in:
Evgeniy Naydanov 2023-08-03 17:57:02 +03:00
parent ee5c5c292f
commit 9b558838b1
1 changed files with 4 additions and 2 deletions

View File

@ -897,7 +897,7 @@ static int maybe_add_trigger_t2_t6(struct target *target,
}; };
ret = try_setup_single_match_trigger(target, trigger, eq); ret = try_setup_single_match_trigger(target, trigger, eq);
if (ret != ERROR_OK) if (ret != ERROR_OK)
return ERROR_FAIL; return ret;
if (trigger->length > 1) { if (trigger->length > 1) {
LOG_TARGET_DEBUG(target, "Trigger will match accesses at address 0x%" TARGET_PRIxADDR LOG_TARGET_DEBUG(target, "Trigger will match accesses at address 0x%" TARGET_PRIxADDR
@ -1042,7 +1042,9 @@ static int add_trigger(struct target *target, struct trigger *trigger)
break; break;
} while (0); } while (0);
riscv_set_register(target, GDB_REGNO_TSELECT, tselect); if (riscv_set_register(target, GDB_REGNO_TSELECT, tselect) != ERROR_OK &&
ret == ERROR_OK)
return ERROR_FAIL;
return ret; return ret;
} }