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

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Nov 10 16:16:19 CET 2011


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.


More information about the Alsa-devel mailing list