Skip to content

Commit 3fa5351

Browse files
nxpfranklivinodkoul
authored andcommitted
dmaengine: fsl-edma: fix all channels requested when call fsl_edma3_xlate()
dma_get_slave_channel() increases client_count for all channels. It should only be called when a matched channel is found in fsl_edma3_xlate(). Move dma_get_slave_channel() after checking for a matched channel. Cc: stable@vger.kernel.org Fixes: 72f5801 ("dmaengine: fsl-edma: integrate v3 support") Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20231004142911.838916-1-Frank.Li@nxp.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 67e13e8 commit 3fa5351

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/dma/fsl-edma-main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,20 @@ static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec,
154154
fsl_chan = to_fsl_edma_chan(chan);
155155
i = fsl_chan - fsl_edma->chans;
156156

157-
chan = dma_get_slave_channel(chan);
158-
chan->device->privatecnt++;
159157
fsl_chan->priority = dma_spec->args[1];
160158
fsl_chan->is_rxchan = dma_spec->args[2] & ARGS_RX;
161159
fsl_chan->is_remote = dma_spec->args[2] & ARGS_REMOTE;
162160
fsl_chan->is_multi_fifo = dma_spec->args[2] & ARGS_MULTI_FIFO;
163161

164162
if (!b_chmux && i == dma_spec->args[0]) {
163+
chan = dma_get_slave_channel(chan);
164+
chan->device->privatecnt++;
165165
mutex_unlock(&fsl_edma->fsl_edma_mutex);
166166
return chan;
167167
} else if (b_chmux && !fsl_chan->srcid) {
168168
/* if controller support channel mux, choose a free channel */
169+
chan = dma_get_slave_channel(chan);
170+
chan->device->privatecnt++;
169171
fsl_chan->srcid = dma_spec->args[0];
170172
mutex_unlock(&fsl_edma->fsl_edma_mutex);
171173
return chan;

0 commit comments

Comments
 (0)