isci: fix dma_unmap_sg usage

One bug and a cleanup:
1/ Fix cases where we were unmapping invalid addresses (smp requests were
   being unmapped)

[  604.662770] ------------[ cut here ]------------
[  604.668026] WARNING: at lib/dma-debug.c:800 check_unmap+0x418/0x740()
[  604.675315] Hardware name: SandyBridge Platform
[  604.680465] isci 0000:03:00.0: DMA-API: device driver tries to free an invalid DMA memory address

2/ The unmap routine is too large to be an inline function, and
   isci_request_io_request_get_next_sge is unused.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams
2011-06-17 10:40:43 -07:00
parent 5edc33480c
commit ddcc7e347a
2 changed files with 18 additions and 90 deletions

View File

@@ -2930,7 +2930,22 @@ static void isci_request_io_request_complete(struct isci_host *isci_host,
break;
}
isci_request_unmap_sgl(request, isci_host->pdev);
switch (task->task_proto) {
case SAS_PROTOCOL_SSP:
if (task->data_dir == DMA_NONE)
break;
if (task->num_scatter == 0)
/* 0 indicates a single dma address */
dma_unmap_single(&isci_host->pdev->dev,
request->zero_scatter_daddr,
task->total_xfer_len, task->data_dir);
else /* unmap the sgl dma addresses */
dma_unmap_sg(&isci_host->pdev->dev, task->scatter,
request->num_sg_entries, task->data_dir);
break;
default:
break;
}
/* Put the completed request on the correct list */
isci_task_save_for_upper_layer_completion(isci_host, request, response,