ASoC: soc-core: avoid nested code on soc_remove_dai()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 11 Sep 2018 06:54:26 +0000 (06:54 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 11 Sep 2018 16:18:23 +0000 (17:18 +0100)
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>
sound/soc/soc-core.c

index 4e9367aacc0c9c259d6c2cd547330cabfe35193f..dde9b70b58b59d2faa8ca5d462c72c0f21081c3d 100644 (file)
@@ -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,