diff mbox

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

Message ID 1498321485-21677-1-git-send-email-chris.gekas@gmail.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Christos Gkekas June 24, 2017, 4:24 p.m. UTC
Variable idx is defined as u16 thus statement (idx < 0) is
always false and should be removed.

Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
---
 drivers/scsi/qedi/qedi_fw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Rangankar, Manish June 26, 2017, 7:17 a.m. UTC | #1
On 24/06/17 9:54 PM, "Christos Gkekas" <chris.gekas@gmail.com> wrote:

>Variable idx is defined as u16 thus statement (idx < 0) is
>always false and should be removed.
>
>Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
>---
> drivers/scsi/qedi/qedi_fw.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c
>index e937490..19254bd 100644
>--- a/drivers/scsi/qedi/qedi_fw.c
>+++ b/drivers/scsi/qedi/qedi_fw.c
>@@ -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);
>-- 
>2.7.4

Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
Martin K. Petersen June 26, 2017, 5:43 p.m. UTC | #2
Christos,

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

Applied to 4.13/scsi-queue, thanks!
diff mbox

Patch

diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c
index e937490..19254bd 100644
--- a/drivers/scsi/qedi/qedi_fw.c
+++ b/drivers/scsi/qedi/qedi_fw.c
@@ -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);