linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] small pm80xx cleanups and fixes
@ 2021-11-01 23:28 Igor Pylypiv
  2021-11-01 23:28 ` [PATCH 1/4] scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp() Igor Pylypiv
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Igor Pylypiv @ 2021-11-01 23:28 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Martin K. Petersen
  Cc: Vishakha Channapattan, Changyuan Lyu, linux-scsi, Igor Pylypiv

Igor Pylypiv (4):
  scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp()
  scsi: pm80xx: Do not check the address-of value for NULL
  scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd()
  scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation

 drivers/scsi/pm8001/pm8001_hwi.c  | 28 +++++++---------------------
 drivers/scsi/pm8001/pm8001_init.c |  4 ++--
 drivers/scsi/pm8001/pm80xx_hwi.c  | 31 +++++++++----------------------
 3 files changed, 18 insertions(+), 45 deletions(-)

-- 
2.33.1.1089.g2158813163f-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/4] scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp()
  2021-11-01 23:28 [PATCH 0/4] small pm80xx cleanups and fixes Igor Pylypiv
@ 2021-11-01 23:28 ` Igor Pylypiv
  2021-11-02  7:04   ` Jinpu Wang
  2021-11-01 23:28 ` [PATCH 2/4] scsi: pm80xx: Do not check the address-of value for NULL Igor Pylypiv
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Igor Pylypiv @ 2021-11-01 23:28 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Martin K. Petersen
  Cc: Vishakha Channapattan, Changyuan Lyu, linux-scsi, Igor Pylypiv

Phy id is located in the least significant byte of the 4-byte field.
mpi_phy_stop_resp() already applies such mask.

Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index 6ffe17b849ae..4f887925c9d2 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -3481,7 +3481,7 @@ static int mpi_phy_start_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
 	u32 status =
 		le32_to_cpu(pPayload->status);
 	u32 phy_id =
-		le32_to_cpu(pPayload->phyid);
+		le32_to_cpu(pPayload->phyid) & 0xFF;
 	struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
 
 	pm8001_dbg(pm8001_ha, INIT,
-- 
2.33.1.1089.g2158813163f-goog


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/4] scsi: pm80xx: Do not check the address-of value for NULL
  2021-11-01 23:28 [PATCH 0/4] small pm80xx cleanups and fixes Igor Pylypiv
  2021-11-01 23:28 ` [PATCH 1/4] scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp() Igor Pylypiv
@ 2021-11-01 23:28 ` Igor Pylypiv
  2021-11-02  7:06   ` Jinpu Wang
  2021-11-01 23:28 ` [PATCH 3/4] scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd() Igor Pylypiv
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Igor Pylypiv @ 2021-11-01 23:28 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Martin K. Petersen
  Cc: Vishakha Channapattan, Changyuan Lyu, linux-scsi, Igor Pylypiv

Address-of operator cannot return NULL.

Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
---
 drivers/scsi/pm8001/pm8001_hwi.c | 24 ++++--------------------
 drivers/scsi/pm8001/pm80xx_hwi.c | 29 ++++++++---------------------
 2 files changed, 12 insertions(+), 41 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 63690508313b..1a593f2b2c87 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -2304,21 +2304,17 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
 
 	psataPayload = (struct sata_completion_resp *)(piomb + 4);
 	status = le32_to_cpu(psataPayload->status);
+	param = le32_to_cpu(psataPayload->param);
 	tag = le32_to_cpu(psataPayload->tag);
 
 	if (!tag) {
 		pm8001_dbg(pm8001_ha, FAIL, "tag null\n");
 		return;
 	}
+
 	ccb = &pm8001_ha->ccb_info[tag];
-	param = le32_to_cpu(psataPayload->param);
-	if (ccb) {
-		t = ccb->task;
-		pm8001_dev = ccb->device;
-	} else {
-		pm8001_dbg(pm8001_ha, FAIL, "ccb null\n");
-		return;
-	}
+	t = ccb->task;
+	pm8001_dev = ccb->device;
 
 	if (t) {
 		if (t->dev && (t->dev->lldd_dev))
@@ -2335,10 +2331,6 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
 	}
 
 	ts = &t->task_status;
-	if (!ts) {
-		pm8001_dbg(pm8001_ha, FAIL, "ts null\n");
-		return;
-	}
 
 	if (status)
 		pm8001_dbg(pm8001_ha, IOERR,
@@ -2695,14 +2687,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
 	u32 dev_id = le32_to_cpu(psataPayload->device_id);
 	unsigned long flags;
 
-	ccb = &pm8001_ha->ccb_info[tag];
-
-	if (ccb) {
-		t = ccb->task;
-		pm8001_dev = ccb->device;
-	} else {
-		pm8001_dbg(pm8001_ha, FAIL, "No CCB !!!. returning\n");
-	}
 	if (event)
 		pm8001_dbg(pm8001_ha, FAIL, "SATA EVENT 0x%x\n", event);
 
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index 4f887925c9d2..f9e997b23d42 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -2399,21 +2399,17 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
 
 	psataPayload = (struct sata_completion_resp *)(piomb + 4);
 	status = le32_to_cpu(psataPayload->status);
+	param = le32_to_cpu(psataPayload->param);
 	tag = le32_to_cpu(psataPayload->tag);
 
 	if (!tag) {
 		pm8001_dbg(pm8001_ha, FAIL, "tag null\n");
 		return;
 	}
+
 	ccb = &pm8001_ha->ccb_info[tag];
-	param = le32_to_cpu(psataPayload->param);
-	if (ccb) {
-		t = ccb->task;
-		pm8001_dev = ccb->device;
-	} else {
-		pm8001_dbg(pm8001_ha, FAIL, "ccb null\n");
-		return;
-	}
+	t = ccb->task;
+	pm8001_dev = ccb->device;
 
 	if (t) {
 		if (t->dev && (t->dev->lldd_dev))
@@ -2430,10 +2426,6 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
 	}
 
 	ts = &t->task_status;
-	if (!ts) {
-		pm8001_dbg(pm8001_ha, FAIL, "ts null\n");
-		return;
-	}
 
 	if (status != IO_SUCCESS) {
 		pm8001_dbg(pm8001_ha, FAIL,
@@ -2804,15 +2796,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
 	u32 dev_id = le32_to_cpu(psataPayload->device_id);
 	unsigned long flags;
 
-	ccb = &pm8001_ha->ccb_info[tag];
-
-	if (ccb) {
-		t = ccb->task;
-		pm8001_dev = ccb->device;
-	} else {
-		pm8001_dbg(pm8001_ha, FAIL, "No CCB !!!. returning\n");
-		return;
-	}
 	if (event)
 		pm8001_dbg(pm8001_ha, FAIL, "SATA EVENT 0x%x\n", event);
 
@@ -2826,6 +2809,10 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
 		return;
 	}
 
+	ccb = &pm8001_ha->ccb_info[tag];
+	t = ccb->task;
+	pm8001_dev = ccb->device;
+
 	if (unlikely(!t || !t->lldd_task || !t->dev)) {
 		pm8001_dbg(pm8001_ha, FAIL, "task or dev null\n");
 		return;
-- 
2.33.1.1089.g2158813163f-goog


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/4] scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd()
  2021-11-01 23:28 [PATCH 0/4] small pm80xx cleanups and fixes Igor Pylypiv
  2021-11-01 23:28 ` [PATCH 1/4] scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp() Igor Pylypiv
  2021-11-01 23:28 ` [PATCH 2/4] scsi: pm80xx: Do not check the address-of value for NULL Igor Pylypiv
@ 2021-11-01 23:28 ` Igor Pylypiv
  2021-11-02  7:07   ` Jinpu Wang
  2021-11-01 23:28 ` [PATCH 4/4] scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation Igor Pylypiv
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Igor Pylypiv @ 2021-11-01 23:28 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Martin K. Petersen
  Cc: Vishakha Channapattan, Changyuan Lyu, linux-scsi, Igor Pylypiv

Starting from commit 05c6c029a44d9 ("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.

Fixes: 7640e1eb8c5de ("scsi: pm80xx: Make mpi_build_cmd locking consistent")
Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
---
 drivers/scsi/pm8001/pm8001_hwi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 1a593f2b2c87..3d41f0ac6595 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);
-- 
2.33.1.1089.g2158813163f-goog


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/4] scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation
  2021-11-01 23:28 [PATCH 0/4] small pm80xx cleanups and fixes Igor Pylypiv
                   ` (2 preceding siblings ...)
  2021-11-01 23:28 ` [PATCH 3/4] scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd() Igor Pylypiv
@ 2021-11-01 23:28 ` Igor Pylypiv
  2021-11-02  7:08   ` Jinpu Wang
  2021-11-19  2:50 ` [PATCH 0/4] small pm80xx cleanups and fixes Martin K. Petersen
  2021-11-23  3:49 ` Martin K. Petersen
  5 siblings, 1 reply; 11+ messages in thread
From: Igor Pylypiv @ 2021-11-01 23:28 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Martin K. Petersen
  Cc: Vishakha Channapattan, Changyuan Lyu, linux-scsi, Igor Pylypiv

We used to allocate X bytes while we only need X bits.

Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
---
 drivers/scsi/pm8001/pm8001_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 47db7e0beae6..9935cf20b93d 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -178,7 +178,7 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha)
 	}
 	PM8001_CHIP_DISP->chip_iounmap(pm8001_ha);
 	flush_workqueue(pm8001_wq);
-	kfree(pm8001_ha->tags);
+	bitmap_free(pm8001_ha->tags);
 	kfree(pm8001_ha);
 }
 
@@ -1193,7 +1193,7 @@ pm8001_init_ccb_tag(struct pm8001_hba_info *pm8001_ha, struct Scsi_Host *shost,
 	can_queue = ccb_count - PM8001_RESERVE_SLOT;
 	shost->can_queue = can_queue;
 
-	pm8001_ha->tags = kzalloc(ccb_count, GFP_KERNEL);
+	pm8001_ha->tags = bitmap_zalloc(ccb_count, GFP_KERNEL);
 	if (!pm8001_ha->tags)
 		goto err_out;
 
-- 
2.33.1.1089.g2158813163f-goog


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp()
  2021-11-01 23:28 ` [PATCH 1/4] scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp() Igor Pylypiv
@ 2021-11-02  7:04   ` Jinpu Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Jinpu Wang @ 2021-11-02  7:04 UTC (permalink / raw)
  To: Igor Pylypiv
  Cc: Jack Wang, James E.J. Bottomley, Martin K. Petersen,
	Vishakha Channapattan, Changyuan Lyu, linux-scsi

On Tue, Nov 2, 2021 at 12:28 AM Igor Pylypiv <ipylypiv@google.com> wrote:
>
> Phy id is located in the least significant byte of the 4-byte field.
> mpi_phy_stop_resp() already applies such mask.
>
> Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Thanks
> ---
>  drivers/scsi/pm8001/pm80xx_hwi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
> index 6ffe17b849ae..4f887925c9d2 100644
> --- a/drivers/scsi/pm8001/pm80xx_hwi.c
> +++ b/drivers/scsi/pm8001/pm80xx_hwi.c
> @@ -3481,7 +3481,7 @@ static int mpi_phy_start_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
>         u32 status =
>                 le32_to_cpu(pPayload->status);
>         u32 phy_id =
> -               le32_to_cpu(pPayload->phyid);
> +               le32_to_cpu(pPayload->phyid) & 0xFF;
>         struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
>
>         pm8001_dbg(pm8001_ha, INIT,
> --
> 2.33.1.1089.g2158813163f-goog
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] scsi: pm80xx: Do not check the address-of value for NULL
  2021-11-01 23:28 ` [PATCH 2/4] scsi: pm80xx: Do not check the address-of value for NULL Igor Pylypiv
@ 2021-11-02  7:06   ` Jinpu Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Jinpu Wang @ 2021-11-02  7:06 UTC (permalink / raw)
  To: Igor Pylypiv
  Cc: Jack Wang, James E.J. Bottomley, Martin K. Petersen,
	Vishakha Channapattan, Changyuan Lyu, linux-scsi

On Tue, Nov 2, 2021 at 12:28 AM Igor Pylypiv <ipylypiv@google.com> wrote:
>
> Address-of operator cannot return NULL.
>
> Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Thanks
> ---
>  drivers/scsi/pm8001/pm8001_hwi.c | 24 ++++--------------------
>  drivers/scsi/pm8001/pm80xx_hwi.c | 29 ++++++++---------------------
>  2 files changed, 12 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
> index 63690508313b..1a593f2b2c87 100644
> --- a/drivers/scsi/pm8001/pm8001_hwi.c
> +++ b/drivers/scsi/pm8001/pm8001_hwi.c
> @@ -2304,21 +2304,17 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
>
>         psataPayload = (struct sata_completion_resp *)(piomb + 4);
>         status = le32_to_cpu(psataPayload->status);
> +       param = le32_to_cpu(psataPayload->param);
>         tag = le32_to_cpu(psataPayload->tag);
>
>         if (!tag) {
>                 pm8001_dbg(pm8001_ha, FAIL, "tag null\n");
>                 return;
>         }
> +
>         ccb = &pm8001_ha->ccb_info[tag];
> -       param = le32_to_cpu(psataPayload->param);
> -       if (ccb) {
> -               t = ccb->task;
> -               pm8001_dev = ccb->device;
> -       } else {
> -               pm8001_dbg(pm8001_ha, FAIL, "ccb null\n");
> -               return;
> -       }
> +       t = ccb->task;
> +       pm8001_dev = ccb->device;
>
>         if (t) {
>                 if (t->dev && (t->dev->lldd_dev))
> @@ -2335,10 +2331,6 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
>         }
>
>         ts = &t->task_status;
> -       if (!ts) {
> -               pm8001_dbg(pm8001_ha, FAIL, "ts null\n");
> -               return;
> -       }
>
>         if (status)
>                 pm8001_dbg(pm8001_ha, IOERR,
> @@ -2695,14 +2687,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
>         u32 dev_id = le32_to_cpu(psataPayload->device_id);
>         unsigned long flags;
>
> -       ccb = &pm8001_ha->ccb_info[tag];
> -
> -       if (ccb) {
> -               t = ccb->task;
> -               pm8001_dev = ccb->device;
> -       } else {
> -               pm8001_dbg(pm8001_ha, FAIL, "No CCB !!!. returning\n");
> -       }
>         if (event)
>                 pm8001_dbg(pm8001_ha, FAIL, "SATA EVENT 0x%x\n", event);
>
> diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
> index 4f887925c9d2..f9e997b23d42 100644
> --- a/drivers/scsi/pm8001/pm80xx_hwi.c
> +++ b/drivers/scsi/pm8001/pm80xx_hwi.c
> @@ -2399,21 +2399,17 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
>
>         psataPayload = (struct sata_completion_resp *)(piomb + 4);
>         status = le32_to_cpu(psataPayload->status);
> +       param = le32_to_cpu(psataPayload->param);
>         tag = le32_to_cpu(psataPayload->tag);
>
>         if (!tag) {
>                 pm8001_dbg(pm8001_ha, FAIL, "tag null\n");
>                 return;
>         }
> +
>         ccb = &pm8001_ha->ccb_info[tag];
> -       param = le32_to_cpu(psataPayload->param);
> -       if (ccb) {
> -               t = ccb->task;
> -               pm8001_dev = ccb->device;
> -       } else {
> -               pm8001_dbg(pm8001_ha, FAIL, "ccb null\n");
> -               return;
> -       }
> +       t = ccb->task;
> +       pm8001_dev = ccb->device;
>
>         if (t) {
>                 if (t->dev && (t->dev->lldd_dev))
> @@ -2430,10 +2426,6 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
>         }
>
>         ts = &t->task_status;
> -       if (!ts) {
> -               pm8001_dbg(pm8001_ha, FAIL, "ts null\n");
> -               return;
> -       }
>
>         if (status != IO_SUCCESS) {
>                 pm8001_dbg(pm8001_ha, FAIL,
> @@ -2804,15 +2796,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
>         u32 dev_id = le32_to_cpu(psataPayload->device_id);
>         unsigned long flags;
>
> -       ccb = &pm8001_ha->ccb_info[tag];
> -
> -       if (ccb) {
> -               t = ccb->task;
> -               pm8001_dev = ccb->device;
> -       } else {
> -               pm8001_dbg(pm8001_ha, FAIL, "No CCB !!!. returning\n");
> -               return;
> -       }
>         if (event)
>                 pm8001_dbg(pm8001_ha, FAIL, "SATA EVENT 0x%x\n", event);
>
> @@ -2826,6 +2809,10 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb)
>                 return;
>         }
>
> +       ccb = &pm8001_ha->ccb_info[tag];
> +       t = ccb->task;
> +       pm8001_dev = ccb->device;
> +
>         if (unlikely(!t || !t->lldd_task || !t->dev)) {
>                 pm8001_dbg(pm8001_ha, FAIL, "task or dev null\n");
>                 return;
> --
> 2.33.1.1089.g2158813163f-goog
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/4] scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd()
  2021-11-01 23:28 ` [PATCH 3/4] scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd() Igor Pylypiv
@ 2021-11-02  7:07   ` Jinpu Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Jinpu Wang @ 2021-11-02  7:07 UTC (permalink / raw)
  To: Igor Pylypiv
  Cc: Jack Wang, James E.J. Bottomley, Martin K. Petersen,
	Vishakha Channapattan, Changyuan Lyu, linux-scsi

On Tue, Nov 2, 2021 at 12:29 AM Igor Pylypiv <ipylypiv@google.com> wrote:
>
> Starting from commit 05c6c029a44d9 ("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.
>
> Fixes: 7640e1eb8c5de ("scsi: pm80xx: Make mpi_build_cmd locking consistent")
> Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Thanks
> ---
>  drivers/scsi/pm8001/pm8001_hwi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
> index 1a593f2b2c87..3d41f0ac6595 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);
> --
> 2.33.1.1089.g2158813163f-goog
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation
  2021-11-01 23:28 ` [PATCH 4/4] scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation Igor Pylypiv
@ 2021-11-02  7:08   ` Jinpu Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Jinpu Wang @ 2021-11-02  7:08 UTC (permalink / raw)
  To: Igor Pylypiv
  Cc: Jack Wang, James E.J. Bottomley, Martin K. Petersen,
	Vishakha Channapattan, Changyuan Lyu, linux-scsi

On Tue, Nov 2, 2021 at 12:29 AM Igor Pylypiv <ipylypiv@google.com> wrote:
>
> We used to allocate X bytes while we only need X bits.
>
> Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Thanks
> ---
>  drivers/scsi/pm8001/pm8001_init.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
> index 47db7e0beae6..9935cf20b93d 100644
> --- a/drivers/scsi/pm8001/pm8001_init.c
> +++ b/drivers/scsi/pm8001/pm8001_init.c
> @@ -178,7 +178,7 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha)
>         }
>         PM8001_CHIP_DISP->chip_iounmap(pm8001_ha);
>         flush_workqueue(pm8001_wq);
> -       kfree(pm8001_ha->tags);
> +       bitmap_free(pm8001_ha->tags);
>         kfree(pm8001_ha);
>  }
>
> @@ -1193,7 +1193,7 @@ pm8001_init_ccb_tag(struct pm8001_hba_info *pm8001_ha, struct Scsi_Host *shost,
>         can_queue = ccb_count - PM8001_RESERVE_SLOT;
>         shost->can_queue = can_queue;
>
> -       pm8001_ha->tags = kzalloc(ccb_count, GFP_KERNEL);
> +       pm8001_ha->tags = bitmap_zalloc(ccb_count, GFP_KERNEL);
>         if (!pm8001_ha->tags)
>                 goto err_out;
>
> --
> 2.33.1.1089.g2158813163f-goog
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/4] small pm80xx cleanups and fixes
  2021-11-01 23:28 [PATCH 0/4] small pm80xx cleanups and fixes Igor Pylypiv
                   ` (3 preceding siblings ...)
  2021-11-01 23:28 ` [PATCH 4/4] scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation Igor Pylypiv
@ 2021-11-19  2:50 ` Martin K. Petersen
  2021-11-23  3:49 ` Martin K. Petersen
  5 siblings, 0 replies; 11+ messages in thread
From: Martin K. Petersen @ 2021-11-19  2:50 UTC (permalink / raw)
  To: Igor Pylypiv
  Cc: Jack Wang, James E.J. Bottomley, Martin K. Petersen,
	Vishakha Channapattan, Changyuan Lyu, linux-scsi


Igor,

> Igor Pylypiv (4):
>   scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp()
>   scsi: pm80xx: Do not check the address-of value for NULL
>   scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd()
>   scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation

Applied to 5.17/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/4] small pm80xx cleanups and fixes
  2021-11-01 23:28 [PATCH 0/4] small pm80xx cleanups and fixes Igor Pylypiv
                   ` (4 preceding siblings ...)
  2021-11-19  2:50 ` [PATCH 0/4] small pm80xx cleanups and fixes Martin K. Petersen
@ 2021-11-23  3:49 ` Martin K. Petersen
  5 siblings, 0 replies; 11+ messages in thread
From: Martin K. Petersen @ 2021-11-23  3:49 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Igor Pylypiv
  Cc: Martin K . Petersen, Changyuan Lyu, linux-scsi, Vishakha Channapattan

On Mon, 1 Nov 2021 16:28:21 -0700, Igor Pylypiv wrote:

> Igor Pylypiv (4):
>   scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp()
>   scsi: pm80xx: Do not check the address-of value for NULL
>   scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd()
>   scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation
> 
> drivers/scsi/pm8001/pm8001_hwi.c  | 28 +++++++---------------------
>  drivers/scsi/pm8001/pm8001_init.c |  4 ++--
>  drivers/scsi/pm8001/pm80xx_hwi.c  | 31 +++++++++----------------------
>  3 files changed, 18 insertions(+), 45 deletions(-)
> 
> [...]

Applied to 5.17/scsi-queue, thanks!

[1/4] scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp()
      https://git.kernel.org/mkp/scsi/c/744798fcd2b3
[2/4] scsi: pm80xx: Do not check the address-of value for NULL
      https://git.kernel.org/mkp/scsi/c/60de1a67d66d
[3/4] scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd()
      https://git.kernel.org/mkp/scsi/c/606c54ae975a
[4/4] scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation
      https://git.kernel.org/mkp/scsi/c/853615582d6f

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-11-23  3:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01 23:28 [PATCH 0/4] small pm80xx cleanups and fixes Igor Pylypiv
2021-11-01 23:28 ` [PATCH 1/4] scsi: pm80xx: Apply byte mask for phy id in mpi_phy_start_resp() Igor Pylypiv
2021-11-02  7:04   ` Jinpu Wang
2021-11-01 23:28 ` [PATCH 2/4] scsi: pm80xx: Do not check the address-of value for NULL Igor Pylypiv
2021-11-02  7:06   ` Jinpu Wang
2021-11-01 23:28 ` [PATCH 3/4] scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd() Igor Pylypiv
2021-11-02  7:07   ` Jinpu Wang
2021-11-01 23:28 ` [PATCH 4/4] scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation Igor Pylypiv
2021-11-02  7:08   ` Jinpu Wang
2021-11-19  2:50 ` [PATCH 0/4] small pm80xx cleanups and fixes Martin K. Petersen
2021-11-23  3:49 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).