lkml.org 
[lkml]   [2014]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [alsa-devel] [PATCH v2 3/5] ASoC: generic-dmaengine-pcm: Prepare formats mask for valid physical sample sizes
On 07/02/2014 03:47 PM, Takashi Iwai wrote:
[...]
>> + /*
>> + * Prepare formats mask for valid/allowed sample types. If the dma does
>> + * not have support for the given physical word size, it needs to be
>> + * masked out so user space can not use the format which produces
>> + * corrupted audio.
>> + * In case the dma driver does not implement the slave_caps the default
>> + * assumption is that it supports 1, 2 and 4 bytes widths.
>> + */
>> + for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {
>> + int bits = snd_pcm_format_physical_width(i);
>
> Better to add a negative value check. Some formats return -EINVAL.
>

So what should we do with those formats? Not support them?

>> +
>> + /* Enable only samples with DMA supported physical widths */
>> + if (addr_widths & BIT(bits / 8))
>
> Just nitpicking: Using BIT() for 32bit int isn't always a wise choice
> since BIT() is defined as unsigned long. This is a generic problem,
> though, as we see many codes using BIT() wrongly (and thus get
> compiler warnings on 64bit machines). We should introduce a new macro
> for 32bit int...



\
 
 \ /
  Last update: 2014-07-02 16:41    [W:6.348 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site