Skip to content

Commit 9703c00

Browse files
committed
Moved comment and added initial buffer clearing
1 parent 20db7af commit 9703c00

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/target/riscv/riscv-013.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,6 +2249,8 @@ static int read_memory_progbuf(struct target *target, target_addr_t address,
22492249

22502250
select_dmi(target);
22512251

2252+
memset(buffer, 0, count*size);
2253+
22522254
/* s0 holds the next address to write to
22532255
* s1 holds the next data value to write
22542256
*/
@@ -2286,10 +2288,10 @@ static int read_memory_progbuf(struct target *target, target_addr_t address,
22862288

22872289
result = read_memory_progbuf_inner(target, address, size, count, buffer);
22882290

2289-
/* The full read did not succeed, so we will try to read each word individually. */
2290-
/* This will not be fast, but reading outside actual memory is a special case anyway. */
2291-
/* It will make the toolchain happier, especially Eclipse Memory View as it reads ahead. */
22922291
if (result != ERROR_OK) {
2292+
/* The full read did not succeed, so we will try to read each word individually. */
2293+
/* This will not be fast, but reading outside actual memory is a special case anyway. */
2294+
/* It will make the toolchain happier, especially Eclipse Memory View as it reads ahead. */
22932295
target_addr_t address_i = address;
22942296
uint32_t size_i = size;
22952297
uint32_t count_i = 1;

0 commit comments

Comments
 (0)