From: Daniel Verkamp Date: Fri, 24 Feb 2017 06:27:55 +0000 (-0700) Subject: nvme: fix reversed loop condition in cmd_readwrite X-Git-Tag: rel-1.11.0~54 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=2e82b465fbdb46efdc2ebb638aef17fa7f665dc5;p=seabios.git nvme: fix reversed loop condition in cmd_readwrite 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 Reviewed-by: Philippe Mathieu-Daudé --- diff --git a/src/hw/nvme.c b/src/hw/nvme.c index c194f9f..97b05cb 100644 --- a/src/hw/nvme.c +++ b/src/hw/nvme.c @@ -571,7 +571,7 @@ nvme_cmd_readwrite(struct nvme_namespace *ns, struct disk_op_s *op, int write) 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;