target/riscv: fix error on exit with uninitialized target
riscv_deinit_target() tries to get_target_type() even if the examination failed or was not called at all. dtm_version is not known and an annoying error is printed: Error: [riscv.cpu.0] Unsupported DTM version: -1 Error: [riscv.cpu.0] Could not identify target type. Avoid calling get_target_type() if dtm_version is DTM_DTMCS_VERSION_UNKNOWN. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I48239b1b11561357e845f3a6cb3a8e3b19e35715
This commit is contained in:
parent
b7e7a030c1
commit
2ff738dfba
|
@ -535,9 +535,12 @@ static void riscv_deinit_target(struct target *target)
|
|||
LOG_TARGET_DEBUG(target, "riscv_deinit_target()");
|
||||
|
||||
struct riscv_info *info = target->arch_info;
|
||||
struct target_type *tt = get_target_type(target);
|
||||
struct target_type *tt = NULL;
|
||||
if (info->dtm_version != DTM_DTMCS_VERSION_UNKNOWN) {
|
||||
tt = get_target_type(target);
|
||||
if (!tt)
|
||||
LOG_TARGET_ERROR(target, "Could not identify target type.");
|
||||
}
|
||||
|
||||
if (riscv_flush_registers(target) != ERROR_OK)
|
||||
LOG_TARGET_ERROR(target, "Failed to flush registers. Ignoring this error.");
|
||||
|
|
Loading…
Reference in New Issue