summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2019-09-11 01:44:15 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2019-10-01 04:54:15 +0200
commit0e62395da2bd5166d7c9e14cbc7503b256a34cb0 (patch)
treee709cd84ee093aab566bf824a567d65e0014e413 /drivers/scsi/bfa
parentscsi: ufs-hisi: Use PTR_ERR_OR_ZERO() in ufs_hisi_get_resource() (diff)
downloadlinux-0e62395da2bd5166d7c9e14cbc7503b256a34cb0.tar.xz
linux-0e62395da2bd5166d7c9e14cbc7503b256a34cb0.zip
scsi: bfa: release allocated memory in case of error
In bfad_im_get_stats if bfa_port_get_stats fails, allocated memory needs to be released. Link: https://lore.kernel.org/r/20190910234417.22151-1-navid.emamdoost@gmail.com Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r--drivers/scsi/bfa/bfad_attr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index 29ab81df75c0..fbfce02e5b93 100644
--- a/drivers/scsi/bfa/bfad_attr.c
+++ b/drivers/scsi/bfa/bfad_attr.c
@@ -275,8 +275,10 @@ bfad_im_get_stats(struct Scsi_Host *shost)
rc = bfa_port_get_stats(BFA_FCPORT(&bfad->bfa),
fcstats, bfad_hcb_comp, &fcomp);
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
- if (rc != BFA_STATUS_OK)
+ if (rc != BFA_STATUS_OK) {
+ kfree(fcstats);
return NULL;
+ }
wait_for_completion(&fcomp.comp);