[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200508132943.9826-13-Sergey.Semin@baikalelectronics.ru>
Date: Fri, 8 May 2020 16:29:37 +0300
From: Serge Semin <Sergey.Semin@...kalelectronics.ru>
To: Mark Brown <broonie@...nel.org>
CC: Serge Semin <Sergey.Semin@...kalelectronics.ru>,
Serge Semin <fancer.lancer@...il.com>,
Georgy Vlasov <Georgy.Vlasov@...kalelectronics.ru>,
Ramil Zaripov <Ramil.Zaripov@...kalelectronics.ru>,
Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Paul Burton <paulburton@...nel.org>,
Ralf Baechle <ralf@...ux-mips.org>,
Arnd Bergmann <arnd@...db.de>,
Allison Randal <allison@...utok.net>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Gareth Williams <gareth.williams.jx@...esas.com>,
Rob Herring <robh+dt@...nel.org>, <linux-mips@...r.kernel.org>,
<devicetree@...r.kernel.org>, Thomas Gleixner <tglx@...utronix.de>,
<linux-spi@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH 12/17] spi: dw: Fix dma_slave_config used partly uninitialized
Since the TX and RX DMA-slave config structures are declared on the
stack and only a part of their fields is initialized further in the
prepare Tx/Rx methods, the next dmaengine_slave_config() calls may
randomly perform an incorrect DMA channels setup depending on the
stack initial values. Lets fix this by zeroing the config-structures
before using them.
Co-developed-by: Georgy Vlasov <Georgy.Vlasov@...kalelectronics.ru>
Signed-off-by: Georgy Vlasov <Georgy.Vlasov@...kalelectronics.ru>
Signed-off-by: Serge Semin <Sergey.Semin@...kalelectronics.ru>
Cc: Ramil Zaripov <Ramil.Zaripov@...kalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc: Paul Burton <paulburton@...nel.org>
Cc: Ralf Baechle <ralf@...ux-mips.org>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Allison Randal <allison@...utok.net>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Gareth Williams <gareth.williams.jx@...esas.com>
Cc: Rob Herring <robh+dt@...nel.org>
Cc: linux-mips@...r.kernel.org
Cc: devicetree@...r.kernel.org
---
drivers/spi/spi-dw-dma.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-dw-dma.c b/drivers/spi/spi-dw-dma.c
index d89a00fb705e..3802d2cafe91 100644
--- a/drivers/spi/spi-dw-dma.c
+++ b/drivers/spi/spi-dw-dma.c
@@ -166,7 +166,7 @@ static void dw_spi_dma_tx_done(void *arg)
static struct dma_async_tx_descriptor *dw_spi_dma_prepare_tx(struct dw_spi *dws,
struct spi_transfer *xfer)
{
- struct dma_slave_config txconf;
+ struct dma_slave_config txconf = {0};
struct dma_async_tx_descriptor *txdesc;
if (!xfer->tx_buf)
@@ -238,7 +238,7 @@ static void dw_spi_dma_rx_done(void *arg)
static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws,
struct spi_transfer *xfer)
{
- struct dma_slave_config rxconf;
+ struct dma_slave_config rxconf = {0};
struct dma_async_tx_descriptor *rxdesc;
if (!xfer->rx_buf)
--
2.25.1
Powered by blists - more mailing lists