From 8b381e21640d38ce196f82a83b6414b7040fc319 Mon Sep 17 00:00:00 2001 From: Jianjun Jiang <8192542@qq.com> Date: Fri, 3 Jun 2022 10:29:27 +0800 Subject: [PATCH] [spinand]fix splwrite calc erase start and end range --- spinand.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) {