From patchwork Mon May 15 08:19:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 9726351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B5CCF601E7 for ; Mon, 15 May 2017 08:19:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A437B2896B for ; Mon, 15 May 2017 08:19:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 975C328970; Mon, 15 May 2017 08:19:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB1D72896B for ; Mon, 15 May 2017 08:19:34 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 00D15267338; Mon, 15 May 2017 10:19:20 +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 9E9E12672BC; Mon, 15 May 2017 10:19:18 +0200 (CEST) Received: from andre.telenet-ops.be (andre.telenet-ops.be [195.130.132.53]) by alsa0.perex.cz (Postfix) with ESMTP id 9FB5526684C for ; Mon, 15 May 2017 10:19:13 +0200 (CEST) Received: from ayla.of.borg ([84.193.137.253]) by andre.telenet-ops.be with bizsmtp id LYKB1v00R5UCtCs01YKCjd; Mon, 15 May 2017 10:19:13 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1dABDj-0007Y2-SU; Mon, 15 May 2017 10:19:11 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1dABDj-0007V3-QE; Mon, 15 May 2017 10:19:11 +0200 From: Geert Uytterhoeven To: Clemens Ladisch , Jaroslav Kysela , Takashi Iwai , Takashi Sakamoto Date: Mon, 15 May 2017 10:19:09 +0200 Message-Id: <1494836350-28790-1-git-send-email-geert@linux-m68k.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Geert Uytterhoeven , linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [alsa-devel] [PATCH 1/2] ALSA: firewire-tascam: Fix infinite loop in snd_tscm_stream_get_rate() 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Obviously the intention was to put a limit on the maximum number of operations. However, for this to work, the check should be "&& trials++ < 5", not "|| trials++ < 5". Fixes: 35efa5c489de63a9 ("ALSA: firewire-tascam: add streaming functionality") Signed-off-by: Geert Uytterhoeven --- Compile-tested only. Triggered by a false-positive warning from gcc-4.1.2: warning: ‘err’ may be used uninitialized in this function --- sound/firewire/tascam/tascam-stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/firewire/tascam/tascam-stream.c b/sound/firewire/tascam/tascam-stream.c index f1657a4e0621ef49..e433b92ac6904db5 100644 --- a/sound/firewire/tascam/tascam-stream.c +++ b/sound/firewire/tascam/tascam-stream.c @@ -84,7 +84,7 @@ int snd_tscm_stream_get_rate(struct snd_tscm *tscm, unsigned int *rate) unsigned int trials = 0; int err; - while (data == 0x0 || trials++ < 5) { + while (data == 0x0 && trials++ < 5) { err = get_clock(tscm, &data); if (err < 0) return err;