[alsa-devel] [PATCH v3 4/8] ASoC: wm_adsp: Add support for opening a compressed stream

Charles Keepax ckeepax at opensource.wolfsonmicro.com
Wed Dec 23 11:00:44 CET 2015


On Wed, Dec 23, 2015 at 12:14:56AM +0000, Mark Brown wrote:
> On Tue, Dec 15, 2015 at 11:29:45AM +0000, Charles Keepax wrote:
> 
> > +int wm_adsp_compr_open(struct wm_adsp *dsp, struct snd_compr_stream *stream)
> > +{
> > +	struct wm_adsp_compr *compr;
> > +	int ret = 0;
> > +
> > +	mutex_lock(&dsp->pwr_lock);
> > +
> > +	if (wm_adsp_fw[dsp->fw].num_caps == 0) {
> > +		adsp_err(dsp, "Firmware does not support compressed API\n");
> > +		ret = -ENXIO;
> > +		goto out;
> > +	}
> > +
> > +	if (wm_adsp_fw[dsp->fw].compr_direction != stream->direction) {
> > +		adsp_err(dsp, "Firmware does not support stream direction\n");
> > +		ret = -EINVAL;
> > +		goto out;
> > +	}
> > +
> > +	compr = kzalloc(sizeof(*compr), GFP_KERNEL);
> 
> You're doing this under lock but not checking for an attempt to allocate
> on a DSP already in use.

A check does actually get added later in:

ASoC: wm_adsp: Attach buffers and streams together

I think that is really just a bit of a rebasing messup. I will
pull that forward into this patch for the next spin.

Thanks,
Charles


More information about the Alsa-devel mailing list