diff options
| -rw-r--r-- | drivers/spi/omap2_mcspi.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index 6df85537bd19..b3a94ca0a75a 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c | |||
| @@ -834,7 +834,6 @@ static void omap2_mcspi_cleanup(struct spi_device *spi) | |||
| 834 | struct omap2_mcspi_cs *cs; | 834 | struct omap2_mcspi_cs *cs; |
| 835 | 835 | ||
| 836 | mcspi = spi_master_get_devdata(spi->master); | 836 | mcspi = spi_master_get_devdata(spi->master); |
| 837 | mcspi_dma = &mcspi->dma_channels[spi->chip_select]; | ||
| 838 | 837 | ||
| 839 | if (spi->controller_state) { | 838 | if (spi->controller_state) { |
| 840 | /* Unlink controller state from context save list */ | 839 | /* Unlink controller state from context save list */ |
| @@ -844,13 +843,17 @@ static void omap2_mcspi_cleanup(struct spi_device *spi) | |||
| 844 | kfree(spi->controller_state); | 843 | kfree(spi->controller_state); |
| 845 | } | 844 | } |
| 846 | 845 | ||
| 847 | if (mcspi_dma->dma_rx_channel != -1) { | 846 | if (spi->chip_select < spi->master->num_chipselect) { |
| 848 | omap_free_dma(mcspi_dma->dma_rx_channel); | 847 | mcspi_dma = &mcspi->dma_channels[spi->chip_select]; |
| 849 | mcspi_dma->dma_rx_channel = -1; | 848 | |
| 850 | } | 849 | if (mcspi_dma->dma_rx_channel != -1) { |
| 851 | if (mcspi_dma->dma_tx_channel != -1) { | 850 | omap_free_dma(mcspi_dma->dma_rx_channel); |
| 852 | omap_free_dma(mcspi_dma->dma_tx_channel); | 851 | mcspi_dma->dma_rx_channel = -1; |
| 853 | mcspi_dma->dma_tx_channel = -1; | 852 | } |
| 853 | if (mcspi_dma->dma_tx_channel != -1) { | ||
| 854 | omap_free_dma(mcspi_dma->dma_tx_channel); | ||
| 855 | mcspi_dma->dma_tx_channel = -1; | ||
| 856 | } | ||
| 854 | } | 857 | } |
| 855 | } | 858 | } |
| 856 | 859 | ||
