Merge pull request #369 from riscv/check_error

Propagate some errors in execute_abstract_command().
reverse-resume-order
Tim Newsome 2019-04-16 13:33:14 -07:00 committed by GitHub
commit 15f2d35bc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -744,13 +744,14 @@ static int execute_abstract_command(struct target *target, uint32_t command)
} }
} }
dmi_write_exec(target, DMI_COMMAND, command); if (dmi_write_exec(target, DMI_COMMAND, command) != ERROR_OK)
return ERROR_FAIL;
uint32_t abstractcs = 0; uint32_t abstractcs = 0;
wait_for_idle(target, &abstractcs); int result = wait_for_idle(target, &abstractcs);
info->cmderr = get_field(abstractcs, DMI_ABSTRACTCS_CMDERR); info->cmderr = get_field(abstractcs, DMI_ABSTRACTCS_CMDERR);
if (info->cmderr != 0) { if (info->cmderr != 0 || result != ERROR_OK) {
LOG_DEBUG("command 0x%x failed; abstractcs=0x%x", command, abstractcs); LOG_DEBUG("command 0x%x failed; abstractcs=0x%x", command, abstractcs);
/* Clear the error. */ /* Clear the error. */
dmi_write(target, DMI_ABSTRACTCS, set_field(0, DMI_ABSTRACTCS_CMDERR, dmi_write(target, DMI_ABSTRACTCS, set_field(0, DMI_ABSTRACTCS_CMDERR,