linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: Fix return value for dma_requrest_chan() in case of failure
       [not found] <CGME20200129163716eucas1p19550fcbfff81ca8586df28782399cff0@eucas1p1.samsung.com>
@ 2020-01-29 16:35 ` Marek Szyprowski
  2020-01-29 19:51   ` Peter Ujfalusi
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Szyprowski @ 2020-01-29 16:35 UTC (permalink / raw)
  To: dmaengine, alsa-devel, linux-kernel, linux-samsung-soc
  Cc: Marek Szyprowski, Mark Brown, Geert Uytterhoeven, Vinod Koul,
	Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Commit 71723a96b8b1 ("dmaengine: Create symlinks between DMA channels and
slaves") changed the dma_request_chan() function flow in such a way that
it always returns EPROBE_DEFER in case of channels that cannot be found.
This break the operation of the devices which have optional DMA channels
as it puts their drivers in endless deferred probe loop. Fix this by
propagating the proper error value.

Fixes: 71723a96b8b1 ("dmaengine: Create symlinks between DMA channels and slaves")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/dma/dmaengine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index f3ef4edd4de1..27b64a665347 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -759,7 +759,7 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
 	if (!IS_ERR_OR_NULL(chan))
 		goto found;
 
-	return ERR_PTR(-EPROBE_DEFER);
+	return chan;
 
 found:
 	chan->slave = dev;
-- 
2.17.1


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

* Re: [PATCH] dmaengine: Fix return value for dma_requrest_chan() in case of failure
  2020-01-29 16:35 ` [PATCH] dmaengine: Fix return value for dma_requrest_chan() in case of failure Marek Szyprowski
@ 2020-01-29 19:51   ` Peter Ujfalusi
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Ujfalusi @ 2020-01-29 19:51 UTC (permalink / raw)
  To: Marek Szyprowski, dmaengine, alsa-devel, linux-kernel, linux-samsung-soc
  Cc: Mark Brown, Geert Uytterhoeven, Vinod Koul, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz



On 29/01/2020 18.35, Marek Szyprowski wrote:
> Commit 71723a96b8b1 ("dmaengine: Create symlinks between DMA channels and
> slaves") changed the dma_request_chan() function flow in such a way that
> it always returns EPROBE_DEFER in case of channels that cannot be found.
> This break the operation of the devices which have optional DMA channels
> as it puts their drivers in endless deferred probe loop. Fix this by
> propagating the proper error value.
> 
> Fixes: 71723a96b8b1 ("dmaengine: Create symlinks between DMA channels and slaves")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/dma/dmaengine.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index f3ef4edd4de1..27b64a665347 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -759,7 +759,7 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
>  	if (!IS_ERR_OR_NULL(chan))
>  		goto found;
>  
> -	return ERR_PTR(-EPROBE_DEFER);
> +	return chan;

It should be:
return chan ? chan : ERR_PTR(-EPROBE_DEFER);

dma_request_chan() should never return NULL, it either returns the
dma_chan, or ERR_PTR().

>  
>  found:
>  	chan->slave = dev;
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

end of thread, other threads:[~2020-01-29 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200129163716eucas1p19550fcbfff81ca8586df28782399cff0@eucas1p1.samsung.com>
2020-01-29 16:35 ` [PATCH] dmaengine: Fix return value for dma_requrest_chan() in case of failure Marek Szyprowski
2020-01-29 19:51   ` Peter Ujfalusi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).