On Thu, Feb 17, 2022 at 2:30 PM Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx> wrote: > > If pm8001_mpi_build_cmd() fails, the allocated tag should be freed. > > Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx> Reviewed-by: Jack Wang <jinpu.wang@xxxxxxxxx> > --- > drivers/scsi/pm8001/pm80xx_hwi.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c > index 76260d06b6be..a5a99d23cfbe 100644 > --- a/drivers/scsi/pm8001/pm80xx_hwi.c > +++ b/drivers/scsi/pm8001/pm80xx_hwi.c > @@ -4920,8 +4920,13 @@ static int pm80xx_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha, > payload.tag = cpu_to_le32(tag); > payload.phyop_phyid = > cpu_to_le32(((phy_op & 0xFF) << 8) | (phyId & 0xFF)); > - return pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, > - sizeof(payload), 0); > + > + rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, > + sizeof(payload), 0); > + if (rc) > + pm8001_tag_free(pm8001_ha, tag); > + > + return rc; > } > > static u32 pm80xx_chip_is_our_interrupt(struct pm8001_hba_info *pm8001_ha) > -- > 2.34.1 >