Skip to content

Commit 74ec529

Browse files
pcercueinunojsa
authored andcommitted
dmaengine: axi-dmac: Small code cleanup
Use a for() loop instead of a while() loop in axi_dmac_fill_linear_sg(). This makes the code leaner and cleaner overall, and does not introduce any functional change. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20231215131313.23840-2-paul@crapouillou.net Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 3f80b99 commit 74ec529

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/dma/dma-axi-dmac.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,16 +517,13 @@ static struct axi_dmac_sg *axi_dmac_fill_linear_sg(struct axi_dmac_chan *chan,
517517
segment_size = ((segment_size - 1) | chan->length_align_mask) + 1;
518518

519519
for (i = 0; i < num_periods; i++) {
520-
len = period_len;
521-
522-
while (len > segment_size) {
520+
for (len = period_len; len > segment_size; sg++) {
523521
if (direction == DMA_DEV_TO_MEM)
524522
sg->dest_addr = addr;
525523
else
526524
sg->src_addr = addr;
527525
sg->x_len = segment_size;
528526
sg->y_len = 1;
529-
sg++;
530527
addr += segment_size;
531528
len -= segment_size;
532529
}

0 commit comments

Comments
 (0)