qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 6/6] scsi: Drop useless null test in scsi_unit_atten


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH 6/6] scsi: Drop useless null test in scsi_unit_attention()
Date: Tue, 22 Jan 2013 15:19:56 +0100

From: Markus Armbruster <address@hidden>

req was created by scsi_req_alloc(), which initializes req->dev to a
value it dereferences.  req->dev isn't changed anywhere else.
Therefore, req->dev can't be null.

Drop the useless null test; it spooks Coverity.

Signed-off-by: Markus Armbruster <address@hidden>
---
 hw/scsi-bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 267a942..a97f1cd 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -282,7 +282,7 @@ static const struct SCSIReqOps reqops_invalid_opcode = {
 
 static int32_t scsi_unit_attention(SCSIRequest *req, uint8_t *buf)
 {
-    if (req->dev && req->dev->unit_attention.key == UNIT_ATTENTION) {
+    if (req->dev->unit_attention.key == UNIT_ATTENTION) {
         scsi_req_build_sense(req, req->dev->unit_attention);
     } else if (req->bus->unit_attention.key == UNIT_ATTENTION) {
         scsi_req_build_sense(req, req->bus->unit_attention);
-- 
1.8.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]