[alsa-devel] [PATCH] ASoC don't clobber platform DMA driver ops
r80115
alan.tull at freescale.com
Thu Nov 10 16:14:25 CET 2011
On 11/10/2011 5:43 AM, Mark Brown wrote:
> On Tue, Nov 01, 2011 at 04:05:16PM -0500, Alan Tull wrote:
>
> This looks mostly good, though as someone pointed out earlier it'd be
> nicer to split the ioctl() operation addition out into a separate patch.
> One issue, though.
>
>> @@ -1547,6 +1547,7 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card)
>>
>> snd_soc_dapm_free(&card->dapm);
>>
>> + kfree(card->rtd->ops);
>
> This is going to leak - rtd is an array per PCM, not a single value, so
> we need to free the ops for each element. This is so we can have
> multiple DMA controllers in a single card.
>
> Actually what would be even easier would be to just embed the ops in the
> struct, we need to allocate one per runtime anyway and it makes for less
> allocation and cleanup code.
>
In soc-pcm.c we allocate:
soc_pcm_ops = kzalloc(sizeof(struct snd_pcm_ops), GFP_KERNEL);
and set it to the pointer
rtd->ops = soc_pcm_ops;
So that's what is freed there.
--
Regards,
Alan
More information about the Alsa-devel
mailing list