diff options
Diffstat (limited to 'drivers/mmc/host/atmel-mci.c')
| -rw-r--r-- | drivers/mmc/host/atmel-mci.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 065fa818be57..fc25586b7ee1 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
| @@ -599,6 +599,7 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
| 599 | struct scatterlist *sg; | 599 | struct scatterlist *sg; |
| 600 | unsigned int i; | 600 | unsigned int i; |
| 601 | enum dma_data_direction direction; | 601 | enum dma_data_direction direction; |
| 602 | unsigned int sglen; | ||
| 602 | 603 | ||
| 603 | /* | 604 | /* |
| 604 | * We don't do DMA on "complex" transfers, i.e. with | 605 | * We don't do DMA on "complex" transfers, i.e. with |
| @@ -628,11 +629,14 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
| 628 | else | 629 | else |
| 629 | direction = DMA_TO_DEVICE; | 630 | direction = DMA_TO_DEVICE; |
| 630 | 631 | ||
| 632 | sglen = dma_map_sg(&host->pdev->dev, data->sg, data->sg_len, direction); | ||
| 633 | if (sglen != data->sg_len) | ||
| 634 | goto unmap_exit; | ||
| 631 | desc = chan->device->device_prep_slave_sg(chan, | 635 | desc = chan->device->device_prep_slave_sg(chan, |
| 632 | data->sg, data->sg_len, direction, | 636 | data->sg, data->sg_len, direction, |
| 633 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 637 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 634 | if (!desc) | 638 | if (!desc) |
| 635 | return -ENOMEM; | 639 | goto unmap_exit; |
| 636 | 640 | ||
| 637 | host->dma.data_desc = desc; | 641 | host->dma.data_desc = desc; |
| 638 | desc->callback = atmci_dma_complete; | 642 | desc->callback = atmci_dma_complete; |
| @@ -643,6 +647,9 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
| 643 | chan->device->device_issue_pending(chan); | 647 | chan->device->device_issue_pending(chan); |
| 644 | 648 | ||
| 645 | return 0; | 649 | return 0; |
| 650 | unmap_exit: | ||
| 651 | dma_unmap_sg(&host->pdev->dev, data->sg, sglen, direction); | ||
| 652 | return -ENOMEM; | ||
| 646 | } | 653 | } |
| 647 | 654 | ||
| 648 | #else /* CONFIG_MMC_ATMELMCI_DMA */ | 655 | #else /* CONFIG_MMC_ATMELMCI_DMA */ |
