scsi: Drop useless null test in scsi_unit_attention()
authorMarkus Armbruster <armbru@redhat.com>
Thu, 17 Jan 2013 12:07:47 +0000 (13:07 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 22 Jan 2013 14:07:03 +0000 (15:07 +0100)
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 <armbru@redhat.com>
hw/scsi-bus.c

index 267a942f762fd4fc900a4f678bbc342cbf826431..a97f1cdc1c74d7d6ce55dad659be1495eacd64be 100644 (file)
@@ -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);