drivers/ch347: don't loose swd_read/write_reg errors

SWD read_reg() and write_reg() methods are declared with
void return. Save the error code to ch347_swd_context.queued_retval
(will be returned later by SWD run method) instead of ignoring it.

Change-Id: Ib95a1bc3398712ac2f8520c79d281633d75f0335
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8745
Reviewed-by: ZhiYuanNJ <871238103@qq.com>
Tested-by: jenkins
This commit is contained in:
Tomas Vanek
2025-02-08 22:00:40 +01:00
parent 0c575ced95
commit fe50eceaff
+6 -2
View File
@@ -2333,13 +2333,17 @@ static int ch347_swd_switch_seq(enum swd_special_seq seq)
static void ch347_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_delay_clk) static void ch347_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_delay_clk)
{ {
assert(cmd & SWD_CMD_RNW); assert(cmd & SWD_CMD_RNW);
ch347_swd_queue_cmd(cmd, value, 0, ap_delay_clk); int retval = ch347_swd_queue_cmd(cmd, value, 0, ap_delay_clk);
if (retval != ERROR_OK)
ch347_swd_context.queued_retval = retval;
} }
static void ch347_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay_clk) static void ch347_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay_clk)
{ {
assert(!(cmd & SWD_CMD_RNW)); assert(!(cmd & SWD_CMD_RNW));
ch347_swd_queue_cmd(cmd, NULL, value, ap_delay_clk); int retval = ch347_swd_queue_cmd(cmd, NULL, value, ap_delay_clk);
if (retval != ERROR_OK)
ch347_swd_context.queued_retval = retval;
} }
static const struct swd_driver ch347_swd = { static const struct swd_driver ch347_swd = {