aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/aic94xx/aic94xx_task.c4
-rw-r--r--drivers/scsi/libsas/sas_discover.c14
2 files changed, 15 insertions, 3 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
index 6c12c0f19f39..d5d8caba3560 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -76,7 +76,7 @@ static inline int asd_map_scatterlist(struct sas_task *task,
76 76
77 /* STP tasks come from libata which has already mapped 77 /* STP tasks come from libata which has already mapped
78 * the SG list */ 78 * the SG list */
79 if (task->task_proto == SAS_PROTOCOL_STP) 79 if (sas_protocol_ata(task->task_proto))
80 num_sg = task->num_scatter; 80 num_sg = task->num_scatter;
81 else 81 else
82 num_sg = pci_map_sg(asd_ha->pcidev, task->scatter, 82 num_sg = pci_map_sg(asd_ha->pcidev, task->scatter,
@@ -125,7 +125,7 @@ static inline int asd_map_scatterlist(struct sas_task *task,
125 125
126 return 0; 126 return 0;
127err_unmap: 127err_unmap:
128 if (task->task_proto != SAS_PROTOCOL_STP) 128 if (sas_protocol_ata(task->task_proto))
129 pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter, 129 pci_unmap_sg(asd_ha->pcidev, task->scatter, task->num_scatter,
130 task->data_dir); 130 task->data_dir);
131 return res; 131 return res;
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index a18c0f6d6668..4d768db1b567 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -110,6 +110,13 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
110 task->total_xfer_len = size; 110 task->total_xfer_len = size;
111 task->data_dir = pci_dma_dir; 111 task->data_dir = pci_dma_dir;
112 task->task_done = sas_disc_task_done; 112 task->task_done = sas_disc_task_done;
113 if (pci_dma_dir != PCI_DMA_NONE &&
114 sas_protocol_ata(task->task_proto)) {
115 task->num_scatter = pci_map_sg(task->dev->port->ha->pcidev,
116 task->scatter,
117 task->num_scatter,
118 task->data_dir);
119 }
113 120
114 for (retries = 0; retries < 5; retries++) { 121 for (retries = 0; retries < 5; retries++) {
115 task->task_state_flags = SAS_TASK_STATE_PENDING; 122 task->task_state_flags = SAS_TASK_STATE_PENDING;
@@ -192,8 +199,13 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
192 } 199 }
193 } 200 }
194ex_err: 201ex_err:
195 if (pci_dma_dir != PCI_DMA_NONE) 202 if (pci_dma_dir != PCI_DMA_NONE) {
203 if (sas_protocol_ata(task->task_proto))
204 pci_unmap_sg(task->dev->port->ha->pcidev,
205 task->scatter, task->num_scatter,
206 task->data_dir);
196 kfree(scatter); 207 kfree(scatter);
208 }
197out: 209out:
198 return res; 210 return res;
199} 211}