ASoC: omap-hdmi-audio: Handle return value of devm_kasprintf
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Wed, 20 Sep 2017 10:06:11 +0000 (15:36 +0530)
committerMark Brown <broonie@kernel.org>
Thu, 21 Sep 2017 14:56:03 +0000 (15:56 +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/omap/omap-hdmi-audio.c

index 3e9cc4842a1db14c2e8b0dc0a60dd462305f07aa..8eeac7cab1c1945742c5307d8b40b05f63842bfe 100644 (file)
@@ -362,6 +362,9 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev)
 
        card->name = devm_kasprintf(dev, GFP_KERNEL,
                                    "HDMI %s", dev_name(ad->dssdev));
+       if (!card->name)
+               return -ENOMEM;
+
        card->owner = THIS_MODULE;
        card->dai_link =
                devm_kzalloc(dev, sizeof(*(card->dai_link)), GFP_KERNEL);