ASoC: fsl-asoc-card: Handle return value of devm_kasprintf
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Thu, 21 Sep 2017 05:20:03 +0000 (10:50 +0530)
committerMark Brown <broonie@kernel.org>
Thu, 21 Sep 2017 15:20:10 +0000 (16:20 +0100)
devm_kasprintf() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl-asoc-card.c

index 3772abbdd7b74a3a1908498c84952fa61e3892c4..1225e0399de8193cc5fce40a61e53bba6fc93e07 100644 (file)
@@ -639,6 +639,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
                                devm_kasprintf(&pdev->dev, GFP_KERNEL,
                                               "ac97-codec.%u",
                                               (unsigned int)idx);
+               if (!priv->dai_link[0].codec_name) {
+                       ret = -ENOMEM;
+                       goto asrc_fail;
+               }
        }
 
        priv->dai_link[0].platform_of_node = cpu_np;