From patchwork Sun Feb 18 03:30:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 774117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6EA9C48BC4 for ; Sun, 18 Feb 2024 03:31:26 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id F380182C; Sun, 18 Feb 2024 04:31:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F380182C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1708227084; bh=2nRBV2fUpHaqb82N/C4deVSrnkTWASajFc9A8riQRbE=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=l9y48+F6iWqzt03nGkUdlrPMFKqDAzt9xOHEF6NudhnOKktpZD6CZI3ER1VmfnXLP /DPQlcAW5yeZ+aAPmEo1APjQS064ScVzsN0rLXM4c5dEJZXXGaRnu/eeKP3rnIszhj I/I4yZXcve9EV/N/hVHCqHJoLYKNN41qgfuJ+L/Q= Received: by alsa1.perex.cz (Postfix, from userid 50401) id CB035F805A1; Sun, 18 Feb 2024 04:30:51 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3D93AF805AA; Sun, 18 Feb 2024 04:30:51 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D00ECF80496; Sun, 18 Feb 2024 04:30:45 +0100 (CET) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 03B19F80104 for ; Sun, 18 Feb 2024 04:30:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 03B19F80104 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.a=rsa-sha256 header.s=fm1 header.b=NC1PWQQC; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=QNR8uT44 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id D68483200392; Sat, 17 Feb 2024 22:30:32 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 17 Feb 2024 22:30:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm1; t=1708227032; x=1708313432; bh=A0j3SW1JHI a1O1Iw2bt8CT2eukJao0r8lGkD5zm4FEw=; b=NC1PWQQC3QlJPgKR1uFROzvhAc oDP7wMr4rYeLOXrAuReQfkJIFTwgtSrZTKwhVXQvOAhs3YAy/pKPLwNU21MpmfGI ZOgwompL+8NFQ8P/ks+nCaspbiaxhLEB2V9h5rg77fjcOAh/7BDIlprugM18AuHV yCWuPjv+tH4zVs+NKRYUvN0Z2TNEBev94v9SiKsqqHyQQq4ruCPhLzBDcIbqLYwX hIgQum0Erm+qkSFWlhlB2bMb4jYUFUERzYtL1YighQh3Z631FGEiB8nuxcRLQeDB A2HSz1G6NsLz1bJAu010qMVAF4WloJYQ8Cuer7SX1BTpcxrWD3Y78T53LZng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1708227032; x=1708313432; bh=A0j3SW1JHIa1O1Iw2bt8CT2eukJa o0r8lGkD5zm4FEw=; b=QNR8uT44v54QUDHKppXCGufRJKDRWgpx35j/oAR/zNYt 9guVq4ykQ0NFGE7Qy3s+HCC6QivcbOZ/Ej8ef3CebexegfKhnq+0BjzF0Pz31onf LyiO0YnCDZne8m/vn5h2PGd766FZGC/bKa9n6kbW3PyEUmNjgAgEfw7badxDkHgU wN+4SkyOG0cPYx0iW3sv9z1kpPMpo5MNQCnNj4cNfJYyr04T3Rr1bqHbmKNCK5i2 K7OjpnSZwD9GHG7bZ2Ujt3Z13q7G+7/r1d4p6GJjpcBuiSJ0NyjriZAmQP23/EGA 8OuOQOGLxqQDJ+tYr39qKhUOHRg39X3CXpVczpQ5VA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdehgdeiudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgggfestdekredtre dttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgrshhh ihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepffdvueelffevke duhfetjeduffeghfettdfguedtgfdvgfeufeduheevheevkeeknecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepohdqthgrkhgrshhhihesshgrkh grmhhotggthhhirdhjph X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Feb 2024 22:30:30 -0500 (EST) From: Takashi Sakamoto To: tiwai@suse.de Cc: alsa-devel@alsa-project.org, stable@vger.kernel.org Subject: [PATCH] ALSA: firewire-lib: fix to check cycle continuity Date: Sun, 18 Feb 2024 12:30:26 +0900 Message-Id: <20240218033026.72577-1-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Message-ID-Hash: BQWKXOJ4Q2BXU4SE2SACSRGG3ZGCDBJQ X-Message-ID-Hash: BQWKXOJ4Q2BXU4SE2SACSRGG3ZGCDBJQ X-MailFrom: o-takashi@sakamocchi.jp X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The local helper function to compare the given pair of cycle count evaluates them. If the left value is less than the right value, the function returns negative value. If the safe cycle is less than the current cycle, it is the case of cycle lost. However, it is not currently handled properly. This commit fixes the bug. Cc: Fixes: 705794c53b00 ("ALSA: firewire-lib: check cycle continuity") Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index a13c0b408aad..7be17bca257f 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -951,7 +951,7 @@ static int generate_tx_packet_descs(struct amdtp_stream *s, struct pkt_desc *des // to the reason. unsigned int safe_cycle = increment_ohci_cycle_count(next_cycle, IR_JUMBO_PAYLOAD_MAX_SKIP_CYCLES); - lost = (compare_ohci_cycle_count(safe_cycle, cycle) > 0); + lost = (compare_ohci_cycle_count(safe_cycle, cycle) < 0); } if (lost) { dev_err(&s->unit->device, "Detect discontinuity of cycle: %d %d\n",