All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: pm80xx: Free allocated tags after failure
@ 2025-06-17 21:04 Francisco Gutierrez
  2025-06-18 15:17 ` Jinpu Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Francisco Gutierrez @ 2025-06-17 21:04 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Martin K. Petersen
  Cc: linux-scsi, linux-kernel, Francisco Gutierrez

This change frees resources after an error is detected.

Signed-off-by: Francisco Gutierrez <frankramirez@google.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index 5b373c53c0369..c4074f062d931 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -4677,8 +4677,12 @@ pm80xx_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id)
 		&pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE);
 	payload.sas_identify.phy_id = phy_id;
 
-	return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
+	ret = pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
 				    sizeof(payload), 0);
+	if (ret < 0)
+		pm8001_tag_free(pm8001_ha, tag);
+
+	return ret;
 }
 
 /**
@@ -4704,8 +4708,12 @@ static int pm80xx_chip_phy_stop_req(struct pm8001_hba_info *pm8001_ha,
 	payload.tag = cpu_to_le32(tag);
 	payload.phy_id = cpu_to_le32(phy_id);
 
-	return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
+	ret = pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
 				    sizeof(payload), 0);
+	if (ret < 0)
+		pm8001_tag_free(pm8001_ha, tag);
+
+	return ret;
 }
 
 /*
-- 
2.50.0.rc2.696.g1fc2a0284f-goog


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

* Re: [PATCH] scsi: pm80xx: Free allocated tags after failure
  2025-06-17 21:04 [PATCH] scsi: pm80xx: Free allocated tags after failure Francisco Gutierrez
@ 2025-06-18 15:17 ` Jinpu Wang
  2025-06-20  2:57 ` Martin K. Petersen
  2025-06-25  1:44 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Jinpu Wang @ 2025-06-18 15:17 UTC (permalink / raw)
  To: Francisco Gutierrez
  Cc: Jack Wang, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel

On Tue, Jun 17, 2025 at 11:05 PM Francisco Gutierrez
<frankramirez@google.com> wrote:
>
> This change frees resources after an error is detected.
>
> Signed-off-by: Francisco Gutierrez <frankramirez@google.com>
lgtm.
Acked-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/scsi/pm8001/pm80xx_hwi.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
> index 5b373c53c0369..c4074f062d931 100644
> --- a/drivers/scsi/pm8001/pm80xx_hwi.c
> +++ b/drivers/scsi/pm8001/pm80xx_hwi.c
> @@ -4677,8 +4677,12 @@ pm80xx_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id)
>                 &pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE);
>         payload.sas_identify.phy_id = phy_id;
>
> -       return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
> +       ret = pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
>                                     sizeof(payload), 0);
> +       if (ret < 0)
> +               pm8001_tag_free(pm8001_ha, tag);
> +
> +       return ret;
>  }
>
>  /**
> @@ -4704,8 +4708,12 @@ static int pm80xx_chip_phy_stop_req(struct pm8001_hba_info *pm8001_ha,
>         payload.tag = cpu_to_le32(tag);
>         payload.phy_id = cpu_to_le32(phy_id);
>
> -       return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
> +       ret = pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
>                                     sizeof(payload), 0);
> +       if (ret < 0)
> +               pm8001_tag_free(pm8001_ha, tag);
> +
> +       return ret;
>  }
>
>  /*
> --
> 2.50.0.rc2.696.g1fc2a0284f-goog
>

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

* Re: [PATCH] scsi: pm80xx: Free allocated tags after failure
  2025-06-17 21:04 [PATCH] scsi: pm80xx: Free allocated tags after failure Francisco Gutierrez
  2025-06-18 15:17 ` Jinpu Wang
@ 2025-06-20  2:57 ` Martin K. Petersen
  2025-06-25  1:44 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-06-20  2:57 UTC (permalink / raw)
  To: Francisco Gutierrez
  Cc: Jack Wang, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel


Francisco,

> This change frees resources after an error is detected.

Applied to 6.17/scsi-staging, thanks!

-- 
Martin K. Petersen

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

* Re: [PATCH] scsi: pm80xx: Free allocated tags after failure
  2025-06-17 21:04 [PATCH] scsi: pm80xx: Free allocated tags after failure Francisco Gutierrez
  2025-06-18 15:17 ` Jinpu Wang
  2025-06-20  2:57 ` Martin K. Petersen
@ 2025-06-25  1:44 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-06-25  1:44 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Francisco Gutierrez
  Cc: Martin K . Petersen, linux-scsi, linux-kernel

On Tue, 17 Jun 2025 21:04:43 +0000, Francisco Gutierrez wrote:

> This change frees resources after an error is detected.
> 
> 

Applied to 6.17/scsi-queue, thanks!

[1/1] scsi: pm80xx: Free allocated tags after failure
      https://git.kernel.org/mkp/scsi/c/258a0a196217

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2025-06-25  1:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 21:04 [PATCH] scsi: pm80xx: Free allocated tags after failure Francisco Gutierrez
2025-06-18 15:17 ` Jinpu Wang
2025-06-20  2:57 ` Martin K. Petersen
2025-06-25  1:44 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.