10 Nov
2011
10 Nov
'11
4:16 p.m.
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.