aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/spi/omap2_mcspi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index 715c518b1b68..87d44eeaaa7b 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -751,11 +751,13 @@ static void omap2_mcspi_cleanup(struct spi_device *spi)
751 mcspi = spi_master_get_devdata(spi->master); 751 mcspi = spi_master_get_devdata(spi->master);
752 mcspi_dma = &mcspi->dma_channels[spi->chip_select]; 752 mcspi_dma = &mcspi->dma_channels[spi->chip_select];
753 753
754 /* Unlink controller state from context save list */ 754 if (spi->controller_state) {
755 cs = spi->controller_state; 755 /* Unlink controller state from context save list */
756 list_del(&cs->node); 756 cs = spi->controller_state;
757 list_del(&cs->node);
757 758
758 kfree(spi->controller_state); 759 kfree(spi->controller_state);
760 }
759 761
760 if (mcspi_dma->dma_rx_channel != -1) { 762 if (mcspi_dma->dma_rx_channel != -1) {
761 omap_free_dma(mcspi_dma->dma_rx_channel); 763 omap_free_dma(mcspi_dma->dma_rx_channel);