aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-pxa2xx.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2016-03-24 09:35:42 -0400
committerMark Brown <broonie@kernel.org>2016-03-28 05:41:44 -0400
commit7d1f1bf699efc9b0f0e92c910dc667a4511943f5 (patch)
tree07cff0023ebbd3516e4a2f2e4898ecfe2602b0f7 /drivers/spi/spi-pxa2xx.c
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
spi: pxa2xx: handle error of pxa2xx_spi_dma_prepare()
If by some reason pxa2xx_spi_dma_prepare() fails we have not to ignore its error. In such case we abort the transfer and return the error to upper level. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> [Jarkko: Avoid leaking TX descriptors in case RX descriptor allocation fails. Noted by Robert Jarzmik <robert.jarzmik@free.fr>. Unmap also buffers in case of failure.] Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-pxa2xx.c')
-rw-r--r--drivers/spi/spi-pxa2xx.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 85e59a406a4c..47bdbd350a24 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -928,6 +928,7 @@ static void pump_transfers(unsigned long data)
928 u32 dma_thresh = drv_data->cur_chip->dma_threshold; 928 u32 dma_thresh = drv_data->cur_chip->dma_threshold;
929 u32 dma_burst = drv_data->cur_chip->dma_burst_size; 929 u32 dma_burst = drv_data->cur_chip->dma_burst_size;
930 u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data); 930 u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data);
931 int err;
931 932
932 /* Get current state information */ 933 /* Get current state information */
933 message = drv_data->cur_msg; 934 message = drv_data->cur_msg;
@@ -1047,7 +1048,12 @@ static void pump_transfers(unsigned long data)
1047 /* Ensure we have the correct interrupt handler */ 1048 /* Ensure we have the correct interrupt handler */
1048 drv_data->transfer_handler = pxa2xx_spi_dma_transfer; 1049 drv_data->transfer_handler = pxa2xx_spi_dma_transfer;
1049 1050
1050 pxa2xx_spi_dma_prepare(drv_data, dma_burst); 1051 err = pxa2xx_spi_dma_prepare(drv_data, dma_burst);
1052 if (err) {
1053 message->status = err;
1054 giveback(drv_data);
1055 return;
1056 }
1051 1057
1052 /* Clear status and start DMA engine */ 1058 /* Clear status and start DMA engine */
1053 cr1 = chip->cr1 | dma_thresh | drv_data->dma_cr1; 1059 cr1 = chip->cr1 | dma_thresh | drv_data->dma_cr1;