From dd890d4cad7c62a65d0efd04c5e0b700eeb5928d Mon Sep 17 00:00:00 2001 From: Tomas Vanek Date: Thu, 18 Jan 2018 09:58:55 +0100 Subject: [PATCH] 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 Suggested-by: Matthias Welwarsky Reviewed-on: http://openocd.zylin.com/4357 Tested-by: jenkins Reviewed-by: Matthias Welwarsky --- src/target/arm_adi_v5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index aa7f4cf6..dfbc5ade 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. -- 2.39.5