Skip to content

Commit

Permalink
scsi: bfa: release allocated memory in case of error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Navidem authored and martinkpetersen committed Oct 1, 2019
1 parent 69be926 commit 0e62395
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/scsi/bfa/bfad_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 0e62395

Please sign in to comment.