Skip to content

Commit 2b5df10

Browse files
committed
lr1110: don't try to return value from a void function
1 parent 6597fa1 commit 2b5df10

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lr1110/lr1110/src_changed/smtc_hal_flash.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <stdlib.h>
2+
13
#include <libtock-sync/storage/nonvolatile_storage.h>
24

35
#include "smtc_hal.h"
@@ -26,12 +28,16 @@ smtc_hal_status_t hal_flash_write_buffer( uint32_t addr, const uint8_t* buffer,
2628
void hal_flash_read_buffer( uint32_t addr, uint8_t* buffer, uint32_t size )
2729
{
2830
returncode_t ret;
29-
3031
int length_read = 0;
31-
ret = libtocksync_nonvolatile_storage_read(addr, size, buffer, size, &length_read);
32-
if (ret != RETURNCODE_SUCCESS) return SMTC_HAL_FAILURE;
33-
34-
return SMTC_HAL_SUCCESS;
32+
int max_tries = 3;
33+
34+
do {
35+
ret = libtocksync_nonvolatile_storage_read(addr, size, buffer, size, &length_read);
36+
max_tries--;
37+
if (max_tries == 0) {
38+
exit(ret);
39+
}
40+
} while (ret != RETURNCODE_SUCCESS);
3541
}
3642

3743
smtc_hal_status_t hal_flash_deinit( void )

0 commit comments

Comments
 (0)