Skip to content

Commit 976c1de

Browse files
tmlindbroonie
authored andcommitted
spi: spi-pic32: Fix issue with uninitialized dma_slave_config
Depending on the DMA driver being used, the struct dma_slave_config may need to be initialized to zero for the unused data. For example, we have three DMA drivers using src_port_window_size and dst_port_window_size. If these are left uninitialized, it can cause DMA failures. For spi-pic32, this is probably not currently an issue but is still good to fix though. Fixes: 1bcb9f8 ("spi: spi-pic32: Add PIC32 SPI master driver") Cc: Purna Chandra Mandal <[email protected]> Cc: Peter Ujfalusi <[email protected]> Cc: Vinod Koul <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 209ab22 commit 976c1de

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/spi/spi-pic32.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ static int pic32_spi_dma_config(struct pic32_spi *pic32s, u32 dma_width)
361361
struct dma_slave_config cfg;
362362
int ret;
363363

364+
memset(&cfg, 0, sizeof(cfg));
364365
cfg.device_fc = true;
365366
cfg.src_addr = pic32s->dma_base + buf_offset;
366367
cfg.dst_addr = pic32s->dma_base + buf_offset;

0 commit comments

Comments
 (0)