]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ALSA: x86: Check platform_data earlier
authorTakashi Iwai <tiwai@suse.de>
Tue, 31 Jan 2017 07:44:23 +0000 (08:44 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 3 Feb 2017 16:31:06 +0000 (17:31 +0100)
Just a minor optimization; check the presence of platform_data earlier
in the probe function before actually starting allocation, which makes
the error path easier.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/x86/intel_hdmi_lpe_audio.c

index b84f7d92ed246511495b403010e0d78aca7133f2..8789f55724da80adccc4215d39b324216a8b4f50 100644 (file)
@@ -310,6 +310,12 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
        dev_dbg(&pdev->dev, "Enter %s\n", __func__);
        dev_dbg(&pdev->dev, "dma_mask: %p\n", pdev->dev.dma_mask);
 
+       pdata = pdev->dev.platform_data;
+       if (!pdata) {
+               dev_err(&pdev->dev, "%s: quit: pdata not allocated by i915!!\n", __func__);
+               return -EINVAL;
+       }
+
        /* get resources */
        irq = platform_get_irq(pdev, 0);
        if (irq < 0) {
@@ -352,14 +358,6 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
        /* assume pipe A as default */
        ctx->had_config_offset = AUDIO_HDMI_CONFIG_A;
 
-       pdata = pdev->dev.platform_data;
-
-       if (pdata == NULL) {
-               dev_err(&pdev->dev, "%s: quit: pdata not allocated by i915!!\n", __func__);
-               ret = -ENOMEM;
-               goto error_irq;
-       }
-
        platform_set_drvdata(pdev, ctx);
 
        /* setup interrupt handler */