Skip to contentSkip to conversation

spi: pxa2xx: handle error of pxa2xx_spi_dma_prepare()

PATCH In review Andy Shevchenko 2 participants 2 messages Dec 23, 2015 – Jan 20, 2016 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Cc Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/[email protected]>
---
 drivers/spi/spi-pxa2xx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-pxa2xx.c +7 -1
index 267a3a2..2e6915c 100644
@@ -890,6 +890,7 @@ static void pump_transfers(unsigned long data)
 	u32 dma_thresh = drv_data->cur_chip->dma_threshold;
 	u32 dma_burst = drv_data->cur_chip->dma_burst_size;
 	u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data);
+	int err;
 
 	/* Get current state information */
 	message = drv_data->cur_msg;
@@ -1024,7 +1025,12 @@ static void pump_transfers(unsigned long data)
 		/* Ensure we have the correct interrupt handler */
 		drv_data->transfer_handler = pxa2xx_spi_dma_transfer;
 
-		pxa2xx_spi_dma_prepare(drv_data, dma_burst);
+		err = pxa2xx_spi_dma_prepare(drv_data, dma_burst);
+		if (err) {
+			message->status = err;
+			giveback(drv_data);
+			return;
+		}
 
 		/* Clear status and start DMA engine */
 		cr1 = chip->cr1 | dma_thresh | drv_data->dma_cr1;
Signature · 6 lines
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1450900200-120644-1-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]

Acked-by
#2 lore raw
Quoted 23 lines · Andy Shevchenko

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.

Cc Jarkko Nikula <jarkko.nikula-VuQAYsv1563Yd54FQh9/[email protected]>
---
  drivers/spi/spi-pxa2xx.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-pxa2xx.c +1 -0
index 267a3a2..2e6915c 100644
@@ -890,6 +890,7 @@ static void pump_transfers(unsigned long data)
  	u32 dma_thresh = drv_data->cur_chip->dma_threshold;
  	u32 dma_burst = drv_data->cur_chip->dma_burst_size;
  	u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data);
+	int err;
 
  	/* Get current state information */
  	message = drv_data->cur_msg;
@@ -1024,7 +1025,12 @@ static void pump_transfers(unsigned long data)
  		/* Ensure we have the correct interrupt handler */

drivers/spi/spi-pxa2xx.c static void pump_transfers(unsigned long data) · line 1034

Quoted 10 lines
drivers/spi/spi-pxa2xx.c +6 -1
  		drv_data->transfer_handler = pxa2xx_spi_dma_transfer;
 
-		pxa2xx_spi_dma_prepare(drv_data, dma_burst);
+		err = pxa2xx_spi_dma_prepare(drv_data, dma_burst);
+		if (err) {
+			message->status = err;
+			giveback(drv_data);
+			return;
+		}
 

Hmm, I've managed to read this patch but not acked it. Luckily noticed it now.

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html