From 6020779b118f6221e5d067bd1e6b44bab6fc0276 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Sun, 10 Nov 2013 17:00:42 -0800 Subject: [PATCH 1/3] ASoC: rcar: fixup mod access before checking rsnd_dai_connect() is using mod before NULL checking. This patch fixes it up Reported-by: Dan Carpenter Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/rcar/core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index b234ed663073..2e09ee8d2500 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -279,15 +279,13 @@ int rsnd_dai_connect(struct rsnd_dai *rdai, struct rsnd_mod *mod, struct rsnd_dai_stream *io) { - struct rsnd_priv *priv = rsnd_mod_to_priv(mod); - struct device *dev = rsnd_priv_to_dev(priv); - - if (!mod) { - dev_err(dev, "NULL mod\n"); + if (!mod) return -EIO; - } if (!list_empty(&mod->list)) { + struct rsnd_priv *priv = rsnd_mod_to_priv(mod); + struct device *dev = rsnd_priv_to_dev(priv); + dev_err(dev, "%s%d is not empty\n", rsnd_mod_name(mod), rsnd_mod_id(mod)); From b5f3d7af286a28e2fcc92debaba40844cb32bfb4 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 8 Nov 2013 12:46:10 +0300 Subject: [PATCH 2/3] ASoC: rcar: off by one in rsnd_scu_set_route() If "id == ARRAY_SIZE(routes)" then we read one space beyond the end of the routes[] array. Signed-off-by: Dan Carpenter Acked-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/rcar/scu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c index 1ab1bce6be7f..5e46ef2e8bb8 100644 --- a/sound/soc/sh/rcar/scu.c +++ b/sound/soc/sh/rcar/scu.c @@ -68,7 +68,7 @@ static int rsnd_scu_set_route(struct rsnd_priv *priv, return 0; id = rsnd_mod_id(mod); - if (id < 0 || id > ARRAY_SIZE(routes)) + if (id < 0 || id >= ARRAY_SIZE(routes)) return -EIO; /* From a0d32bca511fd6b570e964ca38a0c3dcd9eacafb Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Sun, 17 Nov 2013 18:45:16 -0800 Subject: [PATCH 3/3] ASoC: rcar: fixup dma_async_issue_pending() timing DMAEngine will stall without this patch Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/rcar/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 2e09ee8d2500..4e55f9d9ef43 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -199,9 +199,8 @@ static void rsnd_dma_do_work(struct work_struct *work) return; } + dma_async_issue_pending(dma->chan); } - - dma_async_issue_pending(dma->chan); } int rsnd_dma_available(struct rsnd_dma *dma)