ASoC: dapm: Refactor the code in snd_soc_dapm_new_pcm
authoranish kumar <yesanishhere@gmail.com>
Wed, 20 Sep 2017 08:28:34 +0000 (01:28 -0700)
committerMark Brown <broonie@kernel.org>
Wed, 20 Sep 2017 11:38:50 +0000 (12:38 +0100)
refactor snd_soc_dapm_new_pcm to reduce the size of
this function to facilitate further refactoring.

Signed-off-by: anish kumar <yesanishhere@gmail.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-dapm.c

index f51f61340f9c1c2004a596dedc0287aea64a87ae..d55cac65519542313e087646ae455f7f28a2db41 100644 (file)
@@ -3821,19 +3821,15 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
                                devm_kasprintf(card->dev, GFP_KERNEL,
                                               "Anonymous Configuration %d",
                                               count);
-                       if (!w_param_text[count]) {
-                               ret = -ENOMEM;
-                               goto outfree_link_name;
-                       }
                } else {
                        w_param_text[count] = devm_kmemdup(card->dev,
                                                config->stream_name,
                                                strlen(config->stream_name) + 1,
                                                GFP_KERNEL);
-                       if (!w_param_text[count]) {
-                               ret = -ENOMEM;
-                               goto outfree_link_name;
-                       }
+               }
+               if (!w_param_text[count]) {
+                       ret = -ENOMEM;
+                       goto outfree_link_name;
                }
                config++;
        }