Patchwork usb-storage: Drop useless null test in usb_msd_handle_data()

login
register
mail settings
Submitter Markus Armbruster
Date Jan. 16, 2013, 5:20 p.m.
Message ID <1358356825-28957-1-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/212846/
State New
Headers show

Comments

Markus Armbruster - Jan. 16, 2013, 5:20 p.m.
scsi_req_new() never returns null, and scsi_req_enqueue() dereferences
the pointer, so checking for null is useless.

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/usb/dev-storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Anthony Liguori - Jan. 16, 2013, 9:13 p.m.
Applied.  Thanks.

Regards,

Anthony Liguori

Patch

diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 1b87352..b839798 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -427,7 +427,7 @@  static void usb_msd_handle_data(USBDevice *dev, USBPacket *p)
             scsi_req_print(s->req);
 #endif
             scsi_req_enqueue(s->req);
-            if (s->req && s->req->cmd.xfer != SCSI_XFER_NONE) {
+            if (s->req->cmd.xfer != SCSI_XFER_NONE) {
                 scsi_req_continue(s->req);
             }
             break;