Re: [alsa-devel] [PATCH 08/22] ASoC: codecs: Enable AB8500 CODEC for Device Tree

From: Takashi Iwai
Date: Tue Aug 14 2012 - 08:17:38 EST


At Thu, 9 Aug 2012 16:47:34 +0100,
Lee Jones wrote:
> @@ -2407,6 +2464,30 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
> /* Setup AB8500 according to board-settings */
> pdata = (struct ab8500_platform_data *)dev_get_platdata(dev->parent);
>
> + if (np) {
> + if (!pdata)
> + pdata = devm_kzalloc(dev,
> + sizeof(struct ab8500_platform_data),
> + GFP_KERNEL);
> +
> + if (!pdata->codec)

The NULL check of pdata must be before pdata->codec access.


Takashi

> + pdata->codec
> + = devm_kzalloc(dev,
> + sizeof(struct ab8500_codec_platform_data),
> + GFP_KERNEL);
> +
> + if (!(pdata && pdata->codec))
> + return -ENOMEM;
> +
> + ab8500_codec_of_probe(dev, np, pdata->codec);
> +
> + } else {
> + if (!(pdata && pdata->codec)) {
> + dev_err(dev, "No codec platform data or DT found\n");
> + return -EINVAL;
> + }
> + }
> +
> /* Inform SoC Core that we have our own I/O arrangements. */
> codec->control_data = (void *)true;
>
> --
> 1.7.9.5
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@xxxxxxxxxxxxxxxx
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/