[alsa-devel] [PATCH] ASoC: rsnd: return -EIO if rsnd_dmaen_request_channel() failed

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Nov 6 02:07:27 CET 2017


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

PTR_ERR(NULL) is success. Normally when a function returns both NULL
and error pointers, it means that NULL is not a error.
But, rsnd_dmaen_request_channel() returns NULL if requested resource
was failed.
Let's return -EIO if rsnd_dmaen_request_channel() was failed on
rsnd_dmaen_nolock_start().
This patch fixes commit edce5c496c6a ("ASoC: rsnd: Request/Release DMA
channel eachtime")

Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 sound/soc/sh/rcar/dma.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 5bc9ec1..fd557ab 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -219,11 +219,9 @@ static int rsnd_dmaen_nolock_start(struct rsnd_mod *mod,
 						 dma->mod_from,
 						 dma->mod_to);
 	if (IS_ERR_OR_NULL(dmaen->chan)) {
-		int ret = PTR_ERR(dmaen->chan);
-
 		dmaen->chan = NULL;
 		dev_err(dev, "can't get dma channel\n");
-		return ret;
+		return -EIO;
 	}
 
 	return 0;
-- 
1.9.1



More information about the Alsa-devel mailing list