retention: Increase read size variables to 16-bit

Increases 2 variables to be 16-bits instead of 8-bits to allow
for target read sizes, this would only be an issue if someone
changed the default retention block size from the default value
of 16 to a value over 256

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
Jamie McCrae 2023-12-14 13:24:48 +00:00 committed by Fabio Baltieri
parent bf2bdcf6f7
commit bfb4794c36
1 changed files with 2 additions and 2 deletions

View File

@ -96,7 +96,7 @@ static int retention_checksum(const struct device *dev, uint32_t *output)
*output = 0;
while (pos < end) {
uint8_t read_size = MIN((end - pos), sizeof(buffer));
uint16_t read_size = MIN((end - pos), sizeof(buffer));
rc = retained_mem_read(config->parent, pos, buffer, read_size);
@ -188,7 +188,7 @@ int retention_is_valid(const struct device *dev)
off_t pos = 0;
while (pos < config->prefix_len) {
uint8_t read_size = MIN((config->prefix_len - pos), sizeof(buffer));
uint16_t read_size = MIN((config->prefix_len - pos), sizeof(buffer));
rc = retained_mem_read(config->parent, (config->offset + pos), buffer,
read_size);