[alsa-devel] [PATCH] ASoC don't clobber platform DMA driver ops

r80115 alan.tull at freescale.com
Thu Nov 10 16:20:35 CET 2011


On 11/10/2011 9:16 AM, Mark Brown wrote:
> On Thu, Nov 10, 2011 at 09:14:25AM -0600, r80115 wrote:
>> On 11/10/2011 5:43 AM, Mark Brown wrote:
>
>>> 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.
>
> You're not getting the point here.  The point is that you're only
> freeing a single copy of the ops no matter how many are allocated.
>

I see.  This is sounding like a significant rewrite.  I'll have to 
revisit this then.  Thanks for catching that.

-- 
Regards,
Alan




More information about the Alsa-devel mailing list