Skip to content

Commit

Permalink
ste_dma40: Move two assignments in d40_prep_sg()
Browse files Browse the repository at this point in the history
Move assignments for two local variables so that their setting
will only be performed after corresponding data processing succeeded
by this function.

Signed-off-by: Markus Elfring <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
elfring authored and Vinod Koul committed Sep 26, 2016
1 parent 78c6e1a commit 444fa14
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/dma/ste_dma40.c
Original file line number Diff line number Diff line change
Expand Up @@ -2238,8 +2238,8 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
enum dma_transfer_direction direction, unsigned long dma_flags)
{
struct d40_chan *chan = container_of(dchan, struct d40_chan, chan);
dma_addr_t src_dev_addr = 0;
dma_addr_t dst_dev_addr = 0;
dma_addr_t src_dev_addr;
dma_addr_t dst_dev_addr;
struct d40_desc *desc;
unsigned long flags;
int ret;
Expand All @@ -2258,6 +2258,8 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
if (sg_next(&sg_src[sg_len - 1]) == sg_src)
desc->cyclic = true;

src_dev_addr = 0;
dst_dev_addr = 0;
if (direction == DMA_DEV_TO_MEM)
src_dev_addr = chan->runtime_addr;
else if (direction == DMA_MEM_TO_DEV)
Expand Down

0 comments on commit 444fa14

Please sign in to comment.