scsi: qla2xxx: Cleanup fcport memory to prevent leak

Clean up fcport list and loopid in one place and iterate through for loop.

Signed-off-by: Quinn Tran <qtran@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Quinn Tran 2019-04-02 14:24:29 -07:00 committed by Martin K. Petersen
parent a6b95d1c71
commit ffbc647666
2 changed files with 4 additions and 5 deletions

View File

@ -4821,6 +4821,8 @@ qla2x00_free_fcport(fc_port_t *fcport)
fcport->ct_desc.ct_sns = NULL;
}
list_del(&fcport->list);
qla2x00_clear_loop_id(fcport);
kfree(fcport);
}

View File

@ -3907,11 +3907,8 @@ void qla2x00_free_fcports(struct scsi_qla_host *vha)
{
fc_port_t *fcport, *tfcport;
list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) {
list_del(&fcport->list);
qla2x00_clear_loop_id(fcport);
kfree(fcport);
}
list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list)
qla2x00_free_fcport(fcport);
}
static inline void