aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx/ql4_mbx.c
diff options
context:
space:
mode:
authorPrasanna Mumbai <prasanna.mumbai@qlogic.com>2010-07-10 05:19:38 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:04:34 -0400
commitbeabe7c18338a5112fbca9a6dbcc921f9cce6325 (patch)
tree288d2d2e9013ff073ddd135e991eaced74b21887 /drivers/scsi/qla4xxx/ql4_mbx.c
parentb966346c344f592c8e6a84c9c274a7dedbc057ad (diff)
[SCSI] qla4xxx: Fix the freeing of the buffer allocated for DMA
Fixed the DMA allocated memory freeing which wasn't taken care in many cases. Signed-off-by: Prasanna Mumbai <prasanna.mumbai@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Signed-off-by: Ravi Anand <ravi.anand@qlogic.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_mbx.c')
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 75496fb0ae75..54db6cbbd942 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -317,7 +317,7 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
317 if (init_fw_cb == NULL) { 317 if (init_fw_cb == NULL) {
318 DEBUG2(printk("scsi%ld: %s: Unable to alloc init_cb\n", 318 DEBUG2(printk("scsi%ld: %s: Unable to alloc init_cb\n",
319 ha->host_no, __func__)); 319 ha->host_no, __func__));
320 return 10; 320 goto exit_init_fw_cb_no_free;
321 } 321 }
322 memset(init_fw_cb, 0, sizeof(struct addr_ctrl_blk)); 322 memset(init_fw_cb, 0, sizeof(struct addr_ctrl_blk));
323 323
@@ -373,7 +373,7 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
373exit_init_fw_cb: 373exit_init_fw_cb:
374 dma_free_coherent(&ha->pdev->dev, sizeof(struct addr_ctrl_blk), 374 dma_free_coherent(&ha->pdev->dev, sizeof(struct addr_ctrl_blk),
375 init_fw_cb, init_fw_cb_dma); 375 init_fw_cb, init_fw_cb_dma);
376 376exit_init_fw_cb_no_free:
377 return status; 377 return status;
378} 378}
379 379
@@ -394,7 +394,7 @@ int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha)
394 if (init_fw_cb == NULL) { 394 if (init_fw_cb == NULL) {
395 printk("scsi%ld: %s: Unable to alloc init_cb\n", ha->host_no, 395 printk("scsi%ld: %s: Unable to alloc init_cb\n", ha->host_no,
396 __func__); 396 __func__);
397 return 10; 397 return QLA_ERROR;
398 } 398 }
399 399
400 /* Get Initialize Firmware Control Block. */ 400 /* Get Initialize Firmware Control Block. */
@@ -1019,16 +1019,16 @@ int qla4xxx_send_tgts(struct scsi_qla_host *ha, char *ip, uint16_t port)
1019 DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n", 1019 DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n",
1020 ha->host_no, __func__)); 1020 ha->host_no, __func__));
1021 ret_val = QLA_ERROR; 1021 ret_val = QLA_ERROR;
1022 goto qla4xxx_send_tgts_exit; 1022 goto exit_send_tgts_no_free;
1023 } 1023 }
1024 1024
1025 ret_val = qla4xxx_get_default_ddb(ha, fw_ddb_entry_dma); 1025 ret_val = qla4xxx_get_default_ddb(ha, fw_ddb_entry_dma);
1026 if (ret_val != QLA_SUCCESS) 1026 if (ret_val != QLA_SUCCESS)
1027 goto qla4xxx_send_tgts_exit; 1027 goto exit_send_tgts;
1028 1028
1029 ret_val = qla4xxx_req_ddb_entry(ha, &ddb_index); 1029 ret_val = qla4xxx_req_ddb_entry(ha, &ddb_index);
1030 if (ret_val != QLA_SUCCESS) 1030 if (ret_val != QLA_SUCCESS)
1031 goto qla4xxx_send_tgts_exit; 1031 goto exit_send_tgts;
1032 1032
1033 memset(fw_ddb_entry->iscsi_alias, 0, 1033 memset(fw_ddb_entry->iscsi_alias, 0,
1034 sizeof(fw_ddb_entry->iscsi_alias)); 1034 sizeof(fw_ddb_entry->iscsi_alias));
@@ -1050,9 +1050,10 @@ int qla4xxx_send_tgts(struct scsi_qla_host *ha, char *ip, uint16_t port)
1050 1050
1051 ret_val = qla4xxx_set_ddb_entry(ha, ddb_index, fw_ddb_entry_dma); 1051 ret_val = qla4xxx_set_ddb_entry(ha, ddb_index, fw_ddb_entry_dma);
1052 1052
1053qla4xxx_send_tgts_exit: 1053exit_send_tgts:
1054 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), 1054 dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry),
1055 fw_ddb_entry, fw_ddb_entry_dma); 1055 fw_ddb_entry, fw_ddb_entry_dma);
1056exit_send_tgts_no_free:
1056 return ret_val; 1057 return ret_val;
1057} 1058}
1058 1059