lkml.org 
[lkml]   [2012]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [alsa-devel] [PATCH 08/22] ASoC: codecs: Enable AB8500 CODEC for Device Tree
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@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>


\
 
 \ /
  Last update: 2012-08-14 15:03    [W:0.500 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site