summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2018-09-11 06:54:26 +0000
committerMark Brown <broonie@kernel.org>2018-09-11 17:18:23 +0100
commit2eda3cb108b699a6ff78a87e25143c153bc88e41 (patch)
treeabf89ed271958f469c7f80d157ad5759db352480
parenta6ebf4c9770e918e601aa9bf4bc3cf4001dd3d4d (diff)
ASoC: soc-core: avoid nested code on soc_remove_dai()
Nested code is not readable. This patch avoid it on soc_remove_dai(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-core.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4e9367aacc0c..dde9b70b58b5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -942,17 +942,18 @@ static void soc_remove_dai(struct snd_soc_dai *dai, int order)
{
int err;
- if (dai && dai->probed &&
- dai->driver->remove_order == order) {
- if (dai->driver->remove) {
- err = dai->driver->remove(dai);
- if (err < 0)
- dev_err(dai->dev,
- "ASoC: failed to remove %s: %d\n",
- dai->name, err);
- }
- dai->probed = 0;
+ if (!dai || !dai->probed ||
+ dai->driver->remove_order != order)
+ return;
+
+ if (dai->driver->remove) {
+ err = dai->driver->remove(dai);
+ if (err < 0)
+ dev_err(dai->dev,
+ "ASoC: failed to remove %s: %d\n",
+ dai->name, err);
}
+ dai->probed = 0;
}
static void soc_remove_link_dais(struct snd_soc_card *card,