diff --git a/spinand.c b/spinand.c index ddab7e0..35a8594 100644 --- a/spinand.c +++ b/spinand.c @@ -609,7 +609,8 @@ int spinand_splwrite(struct xfel_ctx_t * ctx, uint32_t splitsz, uint64_t addr, v } uint8_t * pnbuf = nbuf; base = 0 & ~emask; - cnt = ((0 + nlen + esize - 1) & ~emask) - base; + cnt = (0 & emask) + nlen; + cnt = (cnt + ((cnt & emask) ? esize : 0)) & ~emask; progress_start(&p, cnt); while(cnt > 0) {