ASoC: omap-hdmi-audio: Add missing error check for devm_kzalloc
authorKiran Padwal <kiran.padwal@smartplayin.com>
Thu, 12 Feb 2015 09:08:02 +0000 (14:38 +0530)
committerMark Brown <broonie@kernel.org>
Sat, 14 Feb 2015 04:32:53 +0000 (13:32 +0900)
This patch add a missing check on the return value of devm_kzalloc,
which would cause a NULL pointer dereference in a OOM situation.

Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/omap/omap-hdmi-audio.c

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