aboutsummaryrefslogtreecommitdiff
path: root/src/target/arm_adi_v5.c
diff options
context:
space:
mode:
authorTomas Vanek <vanekt@fbl.cz>2018-01-18 09:58:55 +0100
committerTomas Vanek <vanekt@fbl.cz>2018-01-29 14:47:40 +0000
commitdd890d4cad7c62a65d0efd04c5e0b700eeb5928d (patch)
treedf1ede1bfe3260370fd35f7ca679f9bb78dc685f /src/target/arm_adi_v5.c
parent1ac0f5d4937ef573a4adb3eafe883ad327c440ce (diff)
downloadriscv-openocd-dd890d4cad7c62a65d0efd04c5e0b700eeb5928d.zip
riscv-openocd-dd890d4cad7c62a65d0efd04c5e0b700eeb5928d.tar.gz
riscv-openocd-dd890d4cad7c62a65d0efd04c5e0b700eeb5928d.tar.bz2
arm_adi_v5: fix return value of mem_ap_read/write for size 0
Unhandled marginal case produced a warning in Clang static analyzer. Change-Id: I3e2fc4182fa4f863acfb972b1e7a512fce5bf33a Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Suggested-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-on: http://openocd.zylin.com/4357 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Diffstat (limited to 'src/target/arm_adi_v5.c')
-rw-r--r--src/target/arm_adi_v5.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index aa7f4cf..dfbc5ad 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -325,7 +325,7 @@ static int mem_ap_write(struct adiv5_ap *ap, const uint8_t *buffer, uint32_t siz
const uint32_t csw_addrincr = addrinc ? CSW_ADDRINC_SINGLE : CSW_ADDRINC_OFF;
uint32_t csw_size;
uint32_t addr_xor;
- int retval;
+ int retval = ERROR_OK;
/* TI BE-32 Quirks mode:
* Writes on big-endian TMS570 behave very strangely. Observed behavior:
@@ -455,7 +455,7 @@ static int mem_ap_read(struct adiv5_ap *ap, uint8_t *buffer, uint32_t size, uint
const uint32_t csw_addrincr = addrinc ? CSW_ADDRINC_SINGLE : CSW_ADDRINC_OFF;
uint32_t csw_size;
uint32_t address = adr;
- int retval;
+ int retval = ERROR_OK;
/* TI BE-32 Quirks mode:
* Reads on big-endian TMS570 behave strangely differently than writes.