Skip to contentSkip to conversation

scsi: qedi: Remove comparison of u16 idx with zero.

PATCH Applied Christos Gkekas 3 participants 3 messages Jun 24, 2017 – Jun 26, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: qedi: Remove comparison of u16 idx with zero.

Variable idx is defined as u16 thus statement (idx < 0) is always false and should be removed.

---
 drivers/scsi/qedi/qedi_fw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qedi/qedi_fw.c +2 -2
index e937490..19254bd 100644
@@ -333,7 +333,7 @@ static void qedi_get_rq_bdq_buf(struct qedi_ctx *qedi,
 
 	/* Obtain buffer address from rqe_opaque */
 	idx = cqe->rqe_opaque.lo;
-	if ((idx < 0) || (idx > (QEDI_BDQ_NUM - 1))) {
+	if (idx > (QEDI_BDQ_NUM - 1)) {
 		QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
 			  "wrong idx %d returned by FW, dropping the unsolicited pkt\n",
 			  idx);
@@ -370,7 +370,7 @@ static void qedi_put_rq_bdq_buf(struct qedi_ctx *qedi,
 
 	/* Obtain buffer address from rqe_opaque */
 	idx = cqe->rqe_opaque.lo;
-	if ((idx < 0) || (idx > (QEDI_BDQ_NUM - 1))) {
+	if (idx > (QEDI_BDQ_NUM - 1)) {
 		QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
 			  "wrong idx %d returned by FW, dropping the unsolicited pkt\n",
 			  idx);
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 32 lines · Christos Gkekas

Variable idx is defined as u16 thus statement (idx < 0) is always false and should be removed.

---
drivers/scsi/qedi/qedi_fw.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qedi/qedi_fw.c +2 -2
index e937490..19254bd 100644
@@ -333,7 +333,7 @@ static void qedi_get_rq_bdq_buf(struct qedi_ctx *qedi,
 
 	/* Obtain buffer address from rqe_opaque */
 	idx = cqe->rqe_opaque.lo;
-	if ((idx < 0) || (idx > (QEDI_BDQ_NUM - 1))) {
+	if (idx > (QEDI_BDQ_NUM - 1)) {
 		QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
 			  "wrong idx %d returned by FW, dropping the unsolicited pkt\n",
 			  idx);
@@ -370,7 +370,7 @@ static void qedi_put_rq_bdq_buf(struct qedi_ctx *qedi,
 
 	/* Obtain buffer address from rqe_opaque */
 	idx = cqe->rqe_opaque.lo;
-	if ((idx < 0) || (idx > (QEDI_BDQ_NUM - 1))) {
+	if (idx > (QEDI_BDQ_NUM - 1)) {
 		QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
 			  "wrong idx %d returned by FW, dropping the unsolicited pkt\n",
 			  idx);
Signature · 1 line
2.7.4
#2 lore raw
In reply to Christos Gkekas

Christos,

Quoted 2 lines

Variable idx is defined as u16 thus statement (idx < 0) is always false and should be removed.

Applied to 4.13/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering