From patchwork Tue May 27 15:14:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 4249851 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D24B79F32B for ; Tue, 27 May 2014 15:19:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2484202E9 for ; Tue, 27 May 2014 15:19:36 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8374A2028D for ; Tue, 27 May 2014 15:19:35 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9BEE32658D4; Tue, 27 May 2014 17:19:34 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 3C15626585C; Tue, 27 May 2014 17:16:49 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 51853265859; Tue, 27 May 2014 17:16:47 +0200 (CEST) Received: from smtp303.phy.lolipop.jp (smtp303.phy.lolipop.jp [210.157.22.87]) by alsa0.perex.cz (Postfix) with ESMTP id 2EE79265848 for ; Tue, 27 May 2014 17:15:14 +0200 (CEST) Received: from smtp303.phy.lolipop.lan (HELO smtp303.phy.lolipop.jp) (172.17.1.87) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp303.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Wed, 28 May 2014 00:15:06 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp303.phy.lolipop.jp (LOLIPOP-Fsecure); Wed, 28 May 2014 00:14:47 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, dan.carpenter@oracle.com, tiwai@suse.de Date: Wed, 28 May 2014 00:14:36 +0900 Message-Id: <1401203687-4189-2-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1401203687-4189-1-git-send-email-o-takashi@sakamocchi.jp> References: <1401203687-4189-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org, ffado-devel@lists.sf.net Subject: [alsa-devel] [PATCH 01/12] firewire-lib: Use ARRAY_SIZE() instead of sizeof() for correct loop limit X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This commit fixes a big for loop count with array. The limitation of loop count should be calcurated with the number of elements in the array, not with the number of bytes. Aditionally, this commit apply the same declaration as a prototype in header for the array. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c index e573f25..31dd1cf 100644 --- a/sound/firewire/amdtp.c +++ b/sound/firewire/amdtp.c @@ -107,7 +107,7 @@ const unsigned int amdtp_syt_intervals[CIP_SFC_COUNT] = { }; EXPORT_SYMBOL(amdtp_syt_intervals); -const unsigned int amdtp_rate_table[] = { +const unsigned int amdtp_rate_table[CIP_SFC_COUNT] = { [CIP_SFC_32000] = 32000, [CIP_SFC_44100] = 44100, [CIP_SFC_48000] = 48000, @@ -198,7 +198,7 @@ void amdtp_stream_set_parameters(struct amdtp_stream *s, WARN_ON(midi_channels > AMDTP_MAX_CHANNELS_FOR_MIDI)) return; - for (sfc = 0; sfc < sizeof(amdtp_rate_table); ++sfc) + for (sfc = 0; sfc < ARRAY_SIZE(amdtp_rate_table); ++sfc) if (amdtp_rate_table[sfc] == rate) goto sfc_found; WARN_ON(1);