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 7b603e4b41db..5e10d3663ab5 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -576,6 +576,7 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
576 | struct scatterlist *sg; | 576 | struct scatterlist *sg; |
577 | unsigned int i; | 577 | unsigned int i; |
578 | enum dma_data_direction direction; | 578 | enum dma_data_direction direction; |
579 | unsigned int sglen; | ||
579 | 580 | ||
580 | /* | 581 | /* |
581 | * We don't do DMA on "complex" transfers, i.e. with | 582 | * We don't do DMA on "complex" transfers, i.e. with |
@@ -605,11 +606,14 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
605 | else | 606 | else |
606 | direction = DMA_TO_DEVICE; | 607 | direction = DMA_TO_DEVICE; |
607 | 608 | ||
609 | sglen = dma_map_sg(&host->pdev->dev, data->sg, data->sg_len, direction); | ||
610 | if (sglen != data->sg_len) | ||
611 | goto unmap_exit; | ||
608 | desc = chan->device->device_prep_slave_sg(chan, | 612 | desc = chan->device->device_prep_slave_sg(chan, |
609 | data->sg, data->sg_len, direction, | 613 | data->sg, data->sg_len, direction, |
610 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 614 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
611 | if (!desc) | 615 | if (!desc) |
612 | return -ENOMEM; | 616 | goto unmap_exit; |
613 | 617 | ||
614 | host->dma.data_desc = desc; | 618 | host->dma.data_desc = desc; |
615 | desc->callback = atmci_dma_complete; | 619 | desc->callback = atmci_dma_complete; |
@@ -620,6 +624,9 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
620 | chan->device->device_issue_pending(chan); | 624 | chan->device->device_issue_pending(chan); |
621 | 625 | ||
622 | return 0; | 626 | return 0; |
627 | unmap_exit: | ||
628 | dma_unmap_sg(&host->pdev->dev, data->sg, sglen, direction); | ||
629 | return -ENOMEM; | ||
623 | } | 630 | } |
624 | 631 | ||
625 | #else /* CONFIG_MMC_ATMELMCI_DMA */ | 632 | #else /* CONFIG_MMC_ATMELMCI_DMA */ |