diff options
author | Harish Zunjarrao <harish.zunjarrao@qlogic.com> | 2010-03-19 20:04:00 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 10:45:50 -0400 |
commit | d5459083af5b6e01796797edd12555ab586c6092 (patch) | |
tree | 5384b2bd1bc40ea0e5ec6aefc0b9d6e74f9ae36a /drivers/scsi | |
parent | 09ff701a177b116c6c15b6e501e58fbfb306b424 (diff) |
[SCSI] qla2xxx: Free DMA memory only if it is allocated in vendor specific BSG command
The qla84xx_mgmt_cmd function supports multiple subcommands.
Some subcommands require DMA memory and some do not.
Therefore check before freeing DMA memory whether it is allocated or not.
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_bsg.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index 3c3a86ca6cbd..584c52d134fa 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c | |||
@@ -804,7 +804,7 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) | |||
804 | int rval = 0; | 804 | int rval = 0; |
805 | struct qla_bsg_a84_mgmt *ql84_mgmt; | 805 | struct qla_bsg_a84_mgmt *ql84_mgmt; |
806 | uint32_t sg_cnt; | 806 | uint32_t sg_cnt; |
807 | uint32_t data_len; | 807 | uint32_t data_len = 0; |
808 | uint32_t dma_direction = DMA_NONE; | 808 | uint32_t dma_direction = DMA_NONE; |
809 | 809 | ||
810 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | 810 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || |
@@ -980,9 +980,11 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) | |||
980 | } | 980 | } |
981 | 981 | ||
982 | bsg_job->job_done(bsg_job); | 982 | bsg_job->job_done(bsg_job); |
983 | dma_free_coherent(&ha->pdev->dev, data_len, mgmt_b, mgmt_dma); | ||
984 | 983 | ||
985 | done_unmap_sg: | 984 | done_unmap_sg: |
985 | if (mgmt_b) | ||
986 | dma_free_coherent(&ha->pdev->dev, data_len, mgmt_b, mgmt_dma); | ||
987 | |||
986 | if (dma_direction == DMA_TO_DEVICE) | 988 | if (dma_direction == DMA_TO_DEVICE) |
987 | dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, | 989 | dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, |
988 | bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); | 990 | bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); |