It looks like the intent was to exit the loop if a command failed, but
the current code would actually continue looping in that case.
Signed-off-by: Daniel Verkamp <daniel@drv.nu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
u16 const max_blocks = NVME_PAGE_SIZE / ns->block_size;
u16 i;
- for (i = 0; i < op->count || res != DISK_RET_SUCCESS;) {
+ for (i = 0; i < op->count && res == DISK_RET_SUCCESS;) {
u16 blocks_remaining = op->count - i;
u16 blocks = blocks_remaining < max_blocks ? blocks_remaining
: max_blocks;