It's easier to see what this loop is doing when the decrement is in the normal place. Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> --- fs/erofs/zdata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 601cfcb07c50..2691100eb231 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -419,8 +419,8 @@ static bool z_erofs_try_inplace_io(struct z_erofs_decompress_frontend *fe, { struct z_erofs_pcluster *const pcl = fe->pcl; - while (fe->icur > 0) { - if (!cmpxchg(&pcl->compressed_bvecs[--fe->icur].page, + while (fe->icur--) { + if (!cmpxchg(&pcl->compressed_bvecs[fe->icur].page, NULL, bvec->page)) { pcl->compressed_bvecs[fe->icur] = *bvec; return true; -- 2.35.1