diff mbox series

[v1,1/8] spi: dw: Zero DMA Tx and Rx configurations on stack

Message ID 20200506153025.21441-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Commit 3cb97e223d277f84171cc4ccecab31e08b2ee7b5
Headers show
Series [v1,1/8] spi: dw: Zero DMA Tx and Rx configurations on stack | expand

Commit Message

Andy Shevchenko May 6, 2020, 3:30 p.m. UTC
Some DMA controller drivers do not tolerate non-zero values in
the DMA configuration structures. Zero them to avoid issues with
such DMA controller drivers. Even despite above this is a good
practice per se.

Fixes: 7063c0d942a1 ("spi/dw_spi: add DMA support")
Cc: Feng Tang <feng.tang@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-dw-mid.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Feng Tang May 6, 2020, 3:38 p.m. UTC | #1
On Wed, May 06, 2020 at 06:30:18PM +0300, Andy Shevchenko wrote:
> Some DMA controller drivers do not tolerate non-zero values in
> the DMA configuration structures. Zero them to avoid issues with
> such DMA controller drivers. Even despite above this is a good
> practice per se.
> 
> Fixes: 7063c0d942a1 ("spi/dw_spi: add DMA support")
> Cc: Feng Tang <feng.tang@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Feng Tang <feng.tang@intel.com>

Thanks,
Feng

> ---
>  drivers/spi/spi-dw-mid.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c
> index 9cc010e9737e8..86d9f79267f05 100644
> --- a/drivers/spi/spi-dw-mid.c
> +++ b/drivers/spi/spi-dw-mid.c
> @@ -147,6 +147,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_tx(struct dw_spi *dws,
>  	if (!xfer->tx_buf)
>  		return NULL;
>  
> +	memset(&txconf, 0, sizeof(txconf));
>  	txconf.direction = DMA_MEM_TO_DEV;
>  	txconf.dst_addr = dws->dma_addr;
>  	txconf.dst_maxburst = 16;
> @@ -193,6 +194,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws,
>  	if (!xfer->rx_buf)
>  		return NULL;
>  
> +	memset(&rxconf, 0, sizeof(rxconf));
>  	rxconf.direction = DMA_DEV_TO_MEM;
>  	rxconf.src_addr = dws->dma_addr;
>  	rxconf.src_maxburst = 16;
> -- 
> 2.26.2
Mark Brown May 6, 2020, 5:11 p.m. UTC | #2
On Wed, 6 May 2020 18:30:18 +0300, Andy Shevchenko wrote:
> Some DMA controller drivers do not tolerate non-zero values in
> the DMA configuration structures. Zero them to avoid issues with
> such DMA controller drivers. Even despite above this is a good
> practice per se.
> 
> Fixes: 7063c0d942a1 ("spi/dw_spi: add DMA support")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Feng Tang <feng.tang@intel.com>
> Cc: Feng Tang <feng.tang@intel.com>
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.8

Thanks!

[1/8] spi: dw: Zero DMA Tx and Rx configurations on stack
      commit: 3cb97e223d277f84171cc4ccecab31e08b2ee7b5
[2/8] spi: dw: Remove unused variable in CR0 configuring hooks
      commit: d4dd6c0a404a2ed3843b4b685d6990c4438a64c0
[3/8] spi: dw: Move interrupt.h to spi-dw.h who is user of it
      commit: 0c2ce3fe4dd0b8f8dda07ea029f51ddf4c5190c2
[4/8] spi: dw: Downgrade interrupt.h to irqreturn.h where appropriate
      commit: e62a15d97b0adede829ba5b4f1c8e28f230bd8e8
[5/8] spi: dw: Move few headers under #ifdef CONFIG_SPI_DW_MID_DMA
      commit: e7940952644558e680033ae0450978445e53b423
[6/8] spi: dw: Add 'mfld' suffix to Intel Medfield related routines
      commit: 37aa8aa68492deb56f9e4c8b2d00aa5d9dae7da2
[7/8] spi: dw: Propagate struct device pointer to ->dma_init() callback
      commit: 6370ababce81911576d7c96663ae64fb84820c7b
[8/8] spi: dw: Add Elkhart Lake PSE DMA support
      commit: 22d48ad7bfacda05900c3f7b43510fc4d40d5d53

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c
index 9cc010e9737e8..86d9f79267f05 100644
--- a/drivers/spi/spi-dw-mid.c
+++ b/drivers/spi/spi-dw-mid.c
@@ -147,6 +147,7 @@  static struct dma_async_tx_descriptor *dw_spi_dma_prepare_tx(struct dw_spi *dws,
 	if (!xfer->tx_buf)
 		return NULL;
 
+	memset(&txconf, 0, sizeof(txconf));
 	txconf.direction = DMA_MEM_TO_DEV;
 	txconf.dst_addr = dws->dma_addr;
 	txconf.dst_maxburst = 16;
@@ -193,6 +194,7 @@  static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws,
 	if (!xfer->rx_buf)
 		return NULL;
 
+	memset(&rxconf, 0, sizeof(rxconf));
 	rxconf.direction = DMA_DEV_TO_MEM;
 	rxconf.src_addr = dws->dma_addr;
 	rxconf.src_maxburst = 16;