summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-24 15:48:26 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-31 18:43:53 +0200
commit95e2e0e487a083a4c9bf13a1918120fbc2a9cd2b (patch)
tree545b17e36f26672a467efdbaac4ab7812702fd14
parenta3764c0b45765a5e7392a3b9a388aa9d9a424b1f (diff)
downloadbarebox-95e2e0e487a083a4c9bf13a1918120fbc2a9cd2b.tar.gz
barebox-95e2e0e487a083a4c9bf13a1918120fbc2a9cd2b.tar.xz
state: backend_circular: Set minumum writesize to 8
NOR flashes have a write size of 1. With this the metadata may end up on non-4-byte-aligned offsets. Force the minimum writesize to 8 so that the metadata is always at aligned offsets. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/state/backend_bucket_circular.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
index 58fffd18e3..5a525f68e1 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -475,6 +475,9 @@ int state_backend_bucket_circular_create(struct device_d *dev, const char *path,
struct state_backend_storage_bucket_circular *circ;
int ret;
+ if (writesize < 8)
+ writesize = 8;
+
circ = xzalloc(sizeof(*circ));
circ->eraseblock = eraseblock;
circ->writesize = writesize;