summaryrefslogtreecommitdiff
path: root/quantum/wear_leveling
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2022-07-02 15:18:50 +1000
committerGitHub <noreply@github.com>2022-07-02 15:18:50 +1000
commit5846b40f7444af96b0d8ddf3af9b558193c2475d (patch)
tree7bec13529ef3654ed290e68617eb1c659c05a49d /quantum/wear_leveling
parent9f1c4f304d0597b7024d079eb358bb0c71be3ce8 (diff)
RP2040 emulated EEPROM. (#17519)
Diffstat (limited to 'quantum/wear_leveling')
-rw-r--r--quantum/wear_leveling/wear_leveling.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/quantum/wear_leveling/wear_leveling.c b/quantum/wear_leveling/wear_leveling.c
index 0a519639ea..429df45df5 100644
--- a/quantum/wear_leveling/wear_leveling.c
+++ b/quantum/wear_leveling/wear_leveling.c
@@ -421,7 +421,7 @@ static wear_leveling_status_t wear_leveling_write_raw(uint32_t address, const vo
#if BACKING_STORE_WRITE_SIZE == 2
// Small-write optimizations - uint16_t, 0 or 1, address is even, address <16384:
if (remaining >= 2 && address % 2 == 0 && address < 16384) {
- const uint16_t v = *(const uint16_t *)p;
+ const uint16_t v = ((uint16_t)p[1]) << 8 | p[0]; // don't just dereference a uint16_t here -- if unaligned it generates faults on some MCUs
if (v == 0 || v == 1) {
const write_log_entry_t log = LOG_ENTRY_MAKE_WORD_01(address, v);
status = wear_leveling_append_raw(log.raw16[0]);
@@ -765,4 +765,4 @@ __attribute__((weak)) bool backing_store_write_bulk(uint32_t address, backing_st
}
}
return true;
-} \ No newline at end of file
+}