The current logic is fairly confusing. We always add to_read to start and we always subtract it from blks. Even the place where blks is set to 0 is really just subtracting to_read. So move these additions and subtractions out of the if() logic and to the end of the loop. This is much easier to follow. Signed-off-by: Simon Glass <sjg@chromium.org>