[3/5] adu: Set default blocksize for adu

Message ID 20190107043020.145107-4-amitay@ozlabs.org
State Accepted
Headers show
Series
  • Introduce new api mem_read/mem_write
Related show

Checks

Context Check Description
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied

Commit Message

Amitay Isaacs Jan. 7, 2019, 4:30 a.m.
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 libpdbg/adu.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch

diff --git a/libpdbg/adu.c b/libpdbg/adu.c
index bc01625..650ec6b 100644
--- a/libpdbg/adu.c
+++ b/libpdbg/adu.c
@@ -117,6 +117,9 @@  static int adu_read(struct adu *adu, uint64_t start_addr, uint8_t *output,
 	int rc = 0;
 	uint64_t addr0, addr;
 
+	if (!block_size)
+		block_size = 8;
+
 	output0 = output;
 
 	/* Align start address to block_sized boundary */
@@ -209,6 +212,9 @@  static int adu_write(struct adu *adu, uint64_t start_addr, uint8_t *input,
 	int rc = 0, tsize;
 	uint64_t addr, data, end_addr;
 
+	if (!block_size)
+		block_size = 8;
+
 	end_addr = start_addr + size;
 	for (addr = start_addr; addr < end_addr; addr += tsize, input += tsize) {
 		if ((addr % block_size) || (addr + block_size > end_addr)) {