lkml.org 
[lkml]   [2018]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] spi: dw: fix buffer end address
Date
Buffer address can be NULL, if user does not want to receive TX/RX data.
In this case, driver should not set the rx/tx_end value with len.

Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
---
drivers/spi/spi-dw.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index b705f2b..34e6fca 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -293,9 +293,13 @@ static int dw_spi_transfer_one(struct spi_controller *master,
dws->dma_mapped = 0;

dws->tx = (void *)transfer->tx_buf;
- dws->tx_end = dws->tx + transfer->len;
+ dws->tx_end = dws->tx;
+ if (dws->tx)
+ dws->tx_end += transfer->len;
dws->rx = transfer->rx_buf;
- dws->rx_end = dws->rx + transfer->len;
+ dws->rx_end = dws->rx;
+ if (dws->rx)
+ dws->rx_end += transfer->len;
dws->len = transfer->len;

spi_enable_chip(dws, 0);
--
2.7.4
\
 
 \ /
  Last update: 2018-10-24 17:37    [W:0.038 / U:2.704 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site