[PATCH] qla2xxx: eliminate dead code in qla24xx_process_bidir_cmd

From: Steven J. Magnani
Date: Thu Jan 30 2014 - 09:24:17 EST


Coverity reports that the test of req_data_len vs. rsp_data_len is dead code.
This appears to be because the test occurs before any real assignment to
either variable.

Assuming that the sole in-tree execution path (QL_VND_DIAG_IO_CMD submitted
via FC pass-through on a host /dev/bsg/X) does not require the response to
have the same length as the request, all code related to the faulty test
can be removed. If this is not the case, the test should be moved much earlier
in the function since it does not depend on any resource acquitision.

Signed-off-by: Steven J. Magnani <steve@xxxxxxxxxxxxxxx>
---
--- linux-3.13/drivers/scsi/qla2xxx/qla_bsg.c 2014-01-29 13:50:02.050802907 -0600
+++ b/drivers/scsi/qla2xxx/qla_bsg.c 2014-01-29 13:53:15.856549874 -0600
@@ -1732,8 +1732,6 @@ qla24xx_process_bidir_cmd(struct fc_bsg_
uint16_t nextlid = 0;
uint32_t tot_dsds;
srb_t *sp = NULL;
- uint32_t req_data_len = 0;
- uint32_t rsp_data_len = 0;

/* Check the type of the adapter */
if (!IS_BIDI_CAPABLE(ha)) {
@@ -1840,17 +1838,6 @@ qla24xx_process_bidir_cmd(struct fc_bsg_
goto done_unmap_sg;
}

- if (req_data_len != rsp_data_len) {
- rval = EXT_STATUS_BUSY;
- ql_log(ql_log_warn, vha, 0x70aa,
- "req_data_len != rsp_data_len\n");
- goto done_unmap_sg;
- }
-
- req_data_len = bsg_job->request_payload.payload_len;
- rsp_data_len = bsg_job->reply_payload.payload_len;
-
-
/* Alloc SRB structure */
sp = qla2x00_get_sp(vha, &(vha->bidir_fcport), GFP_KERNEL);
if (!sp) {
--- linux-3.13/drivers/scsi/qla2xxx/qla_dbg.c 2014-01-29 13:50:49.435230824 -0600
+++ b/drivers/scsi/qla2xxx/qla_dbg.c 2014-01-29 13:53:43.960820829 -0600
@@ -38,7 +38,8 @@
* | | | 0x7073-0x7075, |
* | | | 0x707b,0x708c, |
* | | | 0x70a5,0x70a6, |
- * | | | 0x70a8,0x70ab, |
+ * | | | 0x70a8, |
+ * | | | 0x70aa-0x70ab, |
* | | | 0x70ad-0x70ae, |
* | | | 0x70d1-0x70db, |
* | | | 0x7047,0x703b |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/