Skip to content

Commit 8856330

Browse files
rtg-canonicalvinodkoul
authored andcommitted
dmaengine: dw-axi-dmac: Fix uninitialized variable in axi_chan_block_xfer_start()
Coverity complains of an uninitialized variable: 5. uninit_use_in_call: Using uninitialized value config.dst_per when calling axi_chan_config_write. [show details] 6. uninit_use_in_call: Using uninitialized value config.hs_sel_src when calling axi_chan_config_write. [show details] CID 121164 (#1-3 of 3): Uninitialized scalar variable (UNINIT) 7. uninit_use_in_call: Using uninitialized value config.src_per when calling axi_chan_config_write. [show details] 418 axi_chan_config_write(chan, &config); Fix this by initializing the structure to 0 which should at least be benign in axi_chan_config_write(). Also fix what looks like a cut-n-paste error when initializing config.hs_sel_dst. Fixes: 8243516 ("dmaengine: dw-axi-dmac: support DMAX_NUM_CHANNELS > 8") Cc: Eugeniy Paltsev <[email protected]> Cc: Vinod Koul <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Tim Gardner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent fa55b7d commit 8856330

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ static void axi_chan_block_xfer_start(struct axi_dma_chan *chan,
373373
struct axi_dma_desc *first)
374374
{
375375
u32 priority = chan->chip->dw->hdata->priority[chan->id];
376-
struct axi_dma_chan_config config;
376+
struct axi_dma_chan_config config = {};
377377
u32 irq_mask;
378378
u8 lms = 0; /* Select AXI0 master for LLI fetching */
379379

@@ -391,7 +391,7 @@ static void axi_chan_block_xfer_start(struct axi_dma_chan *chan,
391391
config.tt_fc = DWAXIDMAC_TT_FC_MEM_TO_MEM_DMAC;
392392
config.prior = priority;
393393
config.hs_sel_dst = DWAXIDMAC_HS_SEL_HW;
394-
config.hs_sel_dst = DWAXIDMAC_HS_SEL_HW;
394+
config.hs_sel_src = DWAXIDMAC_HS_SEL_HW;
395395
switch (chan->direction) {
396396
case DMA_MEM_TO_DEV:
397397
dw_axi_dma_set_byte_halfword(chan, true);

0 commit comments

Comments
 (0)