aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Verkamp <daniel@drv.nu>2017-02-23 23:27:55 -0700
committerKevin O'Connor <kevin@koconnor.net>2017-03-02 09:46:45 -0500
commit2e82b465fbdb46efdc2ebb638aef17fa7f665dc5 (patch)
tree1a8811f4e3104984bacd7af68e1a3660f4cc9a67
parent21de72ffe8dcddf126c136918951c441edf85929 (diff)
downloadseabios-2e82b465fbdb46efdc2ebb638aef17fa7f665dc5.tar.gz
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 <daniel@drv.nu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
-rw-r--r--src/hw/nvme.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hw/nvme.c b/src/hw/nvme.c
index c194f9f9..97b05cb7 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;