Skip to content

Commit f91b0c8

Browse files
committed
misc: rp1-pio: Don't just reuse the same DMA buf
A missing pointer increment meant that not only was the same buffer being reused again and again, there was also no protection against using it simultaneously for multiple transfers. Fix that basic bug, and also move a similar increment to before the transfer is started, which feels less racy. See: #6919 Signed-off-by: Phil Elwell <[email protected]>
1 parent 6db63e8 commit f91b0c8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/misc/rp1-pio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,9 +850,9 @@ static int rp1_pio_sm_rx_user(struct rp1_pio_device *pio, struct dma_info *dma,
850850
if (ret < 0)
851851
break;
852852

853+
dma->head_idx++;
853854
dma_async_issue_pending(dma->chan);
854855

855-
dma->head_idx++;
856856
bytes -= copy_bytes;
857857
}
858858

@@ -964,6 +964,7 @@ int rp1_pio_sm_xfer_data(struct rp1_pio_client *client, uint sm, uint dir,
964964
return ret;
965965
}
966966

967+
dma->head_idx++;
967968
dma_async_issue_pending(dma->chan);
968969

969970
return 0;

0 commit comments

Comments
 (0)