From: OpenOCD-Gerrit <ope...@us...> - 2022-09-23 21:23:11
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via aa57890554cb4f8b4ccf35a69598238a12a79069 (commit) via 8db6dff333c2803d339086c7d5694eac4da11d0a (commit) from 8683526af7a9ca23115d26deb5b4835cd6be05d8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit aa57890554cb4f8b4ccf35a69598238a12a79069 Author: Antonio Borneo <bor...@gm...> Date: Mon Sep 19 14:50:26 2022 +0200 target/riscv-013: fix unused initialization Scan-build reports: Unused code: Dead initialization riscv-013.c:2362 Value stored to 'control' during its initialization is never read Remove the initialization of variable 'control'. Change-Id: I548f8175530b9a2aa4c1788549d6467bf9824584 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/7206 Reviewed-by: Tim Newsome <ti...@si...> Reviewed-by: Jan Matyas <ma...@co...> Tested-by: jenkins diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 1f4c34346..99d3873de 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -2359,9 +2359,7 @@ static int assert_reset(struct target *target) /* TODO: Try to use hasel in dmcontrol */ /* Set haltreq for each hart. */ - uint32_t control = control_base; - - control = set_hartsel(control_base, target->coreid); + uint32_t control = set_hartsel(control_base, target->coreid); control = set_field(control, DM_DMCONTROL_HALTREQ, target->reset_halt ? 1 : 0); dmi_write(target, DM_DMCONTROL, control); commit 8db6dff333c2803d339086c7d5694eac4da11d0a Author: Antonio Borneo <bor...@gm...> Date: Mon Sep 19 14:37:24 2022 +0200 target/riscv-013: fix unchecked return code Scan-build complains about variable 'sbcs_orig' that can be used not initialized. Logic error: Assigned value is garbage or undefined riscv-013.c:4468 Assigned value is garbage or undefined This is caused by not checking the return value of the call riscv-013.c:4466 dmi_read(target, &sbcs_orig, DM_SBCS); In fact when dmi_read() returns error, the variable 'sbcs_orig' is not assigned. Check the returned value. Change-Id: Ia9032a0229aa243138f95f4e13f765726a4ceae9 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/7205 Reviewed-by: Tim Newsome <ti...@si...> Reviewed-by: Jan Matyas <ma...@co...> Tested-by: jenkins diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 2c762e337..1f4c34346 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -4463,7 +4463,9 @@ static int riscv013_test_sba_config_reg(struct target *target, uint32_t rd_val; uint32_t sbcs_orig; - dmi_read(target, &sbcs_orig, DM_SBCS); + int retval = dmi_read(target, &sbcs_orig, DM_SBCS); + if (retval != ERROR_OK) + return retval; uint32_t sbcs = sbcs_orig; bool test_passed; ----------------------------------------------------------------------- Summary of changes: src/target/riscv/riscv-013.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- Main OpenOCD repository |