summaryrefslogtreecommitdiff
path: root/drivers/scsi/pm8001
diff options
context:
space:
mode:
authorIgor Pylypiv <ipylypiv@google.com>2021-11-02 02:28:24 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2021-11-19 06:26:58 +0300
commit606c54ae975ad3af540b505b46b55a687501711f (patch)
tree6f929f63f1bed26ea8dd1fb7d2b36708f0586baf /drivers/scsi/pm8001
parent60de1a67d66db11319a82bd95f11c2b12b75dee0 (diff)
downloadlinux-606c54ae975ad3af540b505b46b55a687501711f.tar.xz
scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd()
Starting from commit 05c6c029a44d ("scsi: pm80xx: Increase number of supported queues") driver initializes only max_q_num queues. Do not use an invalid queue if the WARN_ON condition is true. Link: https://lore.kernel.org/r/20211101232825.2350233-4-ipylypiv@google.com Fixes: 7640e1eb8c5d ("scsi: pm80xx: Make mpi_build_cmd locking consistent") Reviewed-by: Vishakha Channapattan <vishakhavc@google.com> Acked-by: Jack Wang <jinpu.wang@ionos.com> Signed-off-by: Igor Pylypiv <ipylypiv@google.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/pm8001')
-rw-r--r--drivers/scsi/pm8001/pm8001_hwi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 9f95369bfe7b..f8e29d588f95 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -1325,7 +1325,9 @@ int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
int q_index = circularQ - pm8001_ha->inbnd_q_tbl;
int rv;
- WARN_ON(q_index >= PM8001_MAX_INB_NUM);
+ if (WARN_ON(q_index >= pm8001_ha->max_q_num))
+ return -EINVAL;
+
spin_lock_irqsave(&circularQ->iq_lock, flags);
rv = pm8001_mpi_msg_free_get(circularQ, pm8001_ha->iomb_size,
&pMessage);