Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754573AbaGBOOF (ORCPT ); Wed, 2 Jul 2014 10:14:05 -0400 Received: from smtp-out-155.synserver.de ([212.40.185.155]:1042 "EHLO smtp-out-155.synserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753976AbaGBOOB (ORCPT ); Wed, 2 Jul 2014 10:14:01 -0400 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 14206 Message-ID: <53B413A7.6070301@metafoo.de> Date: Wed, 02 Jul 2014 16:13:59 +0200 From: Lars-Peter Clausen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.6.0 MIME-Version: 1.0 To: Takashi Iwai CC: Peter Ujfalusi , alsa-devel@alsa-project.org, vinod.koul@intel.com, nsekhar@ti.com, Liam Girdwood , linux-kernel@vger.kernel.org, joelf@ti.com, Mark Brown , dmaengine@vger.kernel.org, dan.j.williams@intel.com Subject: Re: [alsa-devel] [PATCH v2 3/5] ASoC: generic-dmaengine-pcm: Prepare formats mask for valid physical sample sizes References: <1404307763-30557-1-git-send-email-peter.ujfalusi@ti.com> <1404307763-30557-4-git-send-email-peter.ujfalusi@ti.com> <53B412C1.20406@metafoo.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/02/2014 04:12 PM, Takashi Iwai wrote: > At Wed, 02 Jul 2014 16:10:09 +0200, > Lars-Peter Clausen wrote: >> >> 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? > > Yes, these are special formats that can't be handled generically. > Looking through the list in pcm_misc.c there are also some formats where the physical width is not a multiple of 8. We should probably also skip those. - Lars -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/