On 11/16/2013 03:49 AM, Lars-Peter Clausen wrote:
> On 11/15/2013 09:54 PM, Stephen Warren wrote:
>>  
>> @@ -315,6 +343,7 @@ int snd_dmaengine_pcm_register(struct device *dev,
>>      const struct snd_dmaengine_pcm_config *config, unsigned int flags)
>>  {
>>      struct dmaengine_pcm *pcm;
>> +    int ret;
>>  
>>      pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
>>      if (!pcm)
>> @@ -323,14 +352,26 @@ int snd_dmaengine_pcm_register(struct device *dev,
>>      pcm->config = config;
>>      pcm->flags = flags;
>>  
>> -    dmaengine_pcm_request_chan_of(pcm, dev);
>> +    ret = dmaengine_pcm_request_chan_of(pcm, dev);
>> +    if (ret)
>> +            goto err_free_pcm;
>>  
> 
> We should still call dmaengine_pcm_release_chan() in case requesting the
> first channel succeeded, but the second did not.

Oh yes, I'd meant to do that. I'll modify that goto, and remove the
now-unused err_free_pcm label. Thanks.

> 
>>      if (flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE)
>> -            return snd_soc_add_platform(dev, &pcm->platform,
>> +            ret = snd_soc_add_platform(dev, &pcm->platform,
>>                              &dmaengine_no_residue_pcm_platform);
>>      else
>> -            return snd_soc_add_platform(dev, &pcm->platform,
>> +            ret = snd_soc_add_platform(dev, &pcm->platform,
>>                              &dmaengine_pcm_platform);
>> +    if (ret)
>> +            goto err_free_dma;
>> +
>> +    return 0;
>> +
>> +err_free_dma:
>> +    dmaengine_pcm_release_chan(pcm);
>> +err_free_pcm:
>> +    kfree(pcm);
>> +    return ret;
>>  }
>>  EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_register);
> [...]

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to