]> xenbits.xensource.com Git - seabios.git/commitdiff
nvme: fix reversed loop condition in cmd_readwrite
authorDaniel Verkamp <daniel@drv.nu>
Fri, 24 Feb 2017 06:27:55 +0000 (23:27 -0700)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 2 Mar 2017 14:46:45 +0000 (09:46 -0500)
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>
src/hw/nvme.c

index c194f9f9745063a4ff23705cdc95e809ada38db1..97b05cb74841be8b6c473a26c27e10073f882629 100644 (file)
@@ -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;