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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

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

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



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux