public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] dmaengine: fsl-edma: fix all channels requested when call fsl_edma3_xlate()
@ 2023-09-14 22:22 Frank Li
  2023-09-28 14:18 ` Frank Li
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Li @ 2023-09-14 22:22 UTC (permalink / raw)
  To: Vinod Koul, open list:FREESCALE eDMA DRIVER,
	open list:FREESCALE eDMA DRIVER, open list
  Cc: imx

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: 72f5801a4e2b ("dmaengine: fsl-edma: integrate v3 support")
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/dma/fsl-edma-main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 029a72872821d..2c20460e53aa9 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -154,18 +154,20 @@ static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec,
 		fsl_chan = to_fsl_edma_chan(chan);
 		i = fsl_chan - fsl_edma->chans;
 
-		chan = dma_get_slave_channel(chan);
-		chan->device->privatecnt++;
 		fsl_chan->priority = dma_spec->args[1];
 		fsl_chan->is_rxchan = dma_spec->args[2] & ARGS_RX;
 		fsl_chan->is_remote = dma_spec->args[2] & ARGS_REMOTE;
 		fsl_chan->is_multi_fifo = dma_spec->args[2] & ARGS_MULTI_FIFO;
 
 		if (!b_chmux && i == dma_spec->args[0]) {
+			chan = dma_get_slave_channel(chan);
+			chan->device->privatecnt++;
 			mutex_unlock(&fsl_edma->fsl_edma_mutex);
 			return chan;
 		} else if (b_chmux && !fsl_chan->srcid) {
 			/* if controller support channel mux, choose a free channel */
+			chan = dma_get_slave_channel(chan);
+			chan->device->privatecnt++;
 			fsl_chan->srcid = dma_spec->args[0];
 			mutex_unlock(&fsl_edma->fsl_edma_mutex);
 			return chan;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] dmaengine: fsl-edma: fix all channels requested when call fsl_edma3_xlate()
  2023-09-14 22:22 [PATCH 1/1] dmaengine: fsl-edma: fix all channels requested when call fsl_edma3_xlate() Frank Li
@ 2023-09-28 14:18 ` Frank Li
  2023-10-04  7:32   ` Vinod Koul
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Li @ 2023-09-28 14:18 UTC (permalink / raw)
  To: Vinod Koul, open list:FREESCALE eDMA DRIVER,
	open list:FREESCALE eDMA DRIVER, open list

On Thu, Sep 14, 2023 at 06:22:04PM -0400, Frank Li wrote:
> 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.

@Vinod
	ping

Frank

> 
> Cc: <stable@vger.kernel.org>
> Fixes: 72f5801a4e2b ("dmaengine: fsl-edma: integrate v3 support")
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
>  drivers/dma/fsl-edma-main.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> index 029a72872821d..2c20460e53aa9 100644
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
> @@ -154,18 +154,20 @@ static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec,
>  		fsl_chan = to_fsl_edma_chan(chan);
>  		i = fsl_chan - fsl_edma->chans;
>  
> -		chan = dma_get_slave_channel(chan);
> -		chan->device->privatecnt++;
>  		fsl_chan->priority = dma_spec->args[1];
>  		fsl_chan->is_rxchan = dma_spec->args[2] & ARGS_RX;
>  		fsl_chan->is_remote = dma_spec->args[2] & ARGS_REMOTE;
>  		fsl_chan->is_multi_fifo = dma_spec->args[2] & ARGS_MULTI_FIFO;
>  
>  		if (!b_chmux && i == dma_spec->args[0]) {
> +			chan = dma_get_slave_channel(chan);
> +			chan->device->privatecnt++;
>  			mutex_unlock(&fsl_edma->fsl_edma_mutex);
>  			return chan;
>  		} else if (b_chmux && !fsl_chan->srcid) {
>  			/* if controller support channel mux, choose a free channel */
> +			chan = dma_get_slave_channel(chan);
> +			chan->device->privatecnt++;
>  			fsl_chan->srcid = dma_spec->args[0];
>  			mutex_unlock(&fsl_edma->fsl_edma_mutex);
>  			return chan;
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] dmaengine: fsl-edma: fix all channels requested when call fsl_edma3_xlate()
  2023-09-28 14:18 ` Frank Li
@ 2023-10-04  7:32   ` Vinod Koul
  0 siblings, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2023-10-04  7:32 UTC (permalink / raw)
  To: Frank Li
  Cc: open list:FREESCALE eDMA DRIVER, open list:FREESCALE eDMA DRIVER,
	open list

On 28-09-23, 10:18, Frank Li wrote:
> On Thu, Sep 14, 2023 at 06:22:04PM -0400, Frank Li wrote:
> > 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.
> 
> @Vinod
> 	ping

Can you please resend

-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-04  7:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-14 22:22 [PATCH 1/1] dmaengine: fsl-edma: fix all channels requested when call fsl_edma3_xlate() Frank Li
2023-09-28 14:18 ` Frank Li
2023-10-04  7:32   ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox