[SeaBIOS] [PATCH 4/5] nvme: fix extraction of status code bits

Daniel Verkamp daniel at drv.nu
Fri Feb 24 07:27:56 CET 2017


The status code field is 8 bits wide starting at bit 1; the previous
code would truncate the top bit.

Signed-off-by: Daniel Verkamp <daniel at drv.nu>
---
 src/hw/nvme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hw/nvme.c b/src/hw/nvme.c
index 97b05cb..9fda011 100644
--- a/src/hw/nvme.c
+++ b/src/hw/nvme.c
@@ -74,7 +74,7 @@ nvme_poll_cq(struct nvme_cq *cq)
 static int
 nvme_is_cqe_success(struct nvme_cqe const *cqe)
 {
-    return (cqe->status & 0xFF) >> 1 == 0;
+    return ((cqe->status >> 1) & 0xFF) == 0;
 }
 
 
-- 
2.11.1




More information about the SeaBIOS mailing list