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

Tabi Timur-B04825 B04825 at freescale.com
Tue Nov 15 17:56:46 CET 2011

On Tue, Nov 15, 2011 at 9:59 AM, Alan Tull <alan.tull at freescale.com> wrote:
> Previously, only one static struct for ops existed for all
> platform DMA drivers to share.  Half of the ops are shared
> functions and the other half are initialized to point directly
> to ops in the platform driver.  This creates problems where
> each time soc_new_pcm is called, the new platform driver's
> ops would overwrite a subset of the ops.
> This patch creates and populates a ops struct for each call
> to soc_pcm_new.
> Signed-off-by: Alan Tull <alan.tull at freescale.com>
> ---

Something is wrong.  When I apply this patch, I get this:

  CC      sound/soc/soc-core.o
/home/b04825/git/linux.34/sound/soc/soc-core.c: In function
/home/b04825/git/linux.34/sound/soc/soc-core.c:1583:3: error:
incompatible type for argument 1 of 'kfree'
/home/b04825/git/linux.34/include/linux/slab.h:161:6: note: expected
'const void *' but argument is of type 'struct snd_pcm_ops'

	/* free the ops */
	for (i = 0; i < card->num_rtd; i++) {
		struct snd_soc_pcm_runtime *rtd = &card->rtd[i];

rtd->ops is not a pointer, so it can't be freed.  Also, this:

+	rtd->ops = soc_pcm_ops;

is a memcpy.  Why not just write to rtd->ops directly?

Timur Tabi
Linux kernel developer at Freescale

More information about the Alsa-devel mailing list