From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B8553C2F; Wed, 21 Feb 2024 13:38:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708522708; cv=none; b=TJdFUOGpzlO9DcdxOlL+DkxFXlJdgoEhCAZQZzjquQ3EBUZ0QGg/8OelDVIjdzysFCOCl5W5h+Vp5cy2Zo1Sd5YZ3YX8J9w0RR2aHZ5PgGvP35Yc0IJYwQPrv5G7riw6ZVpQKSq7WWuxixlJqZIUlOT5u4pP4BnDlsnZSv70hOg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708522708; c=relaxed/simple; bh=m1P2N0iR+hl5JB3NMZsRZnsGMQ3VrF1jLmtQJihy6EM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jqthcmXw22fDIMvzFW9c9Q6jOlI+6YccZ12LvZFioJA13G1OiL2psfaxhsjJlG9v1CahYGj6INYg3ATa3HAahadYHFyev94o+IcaMQuh+G8wj9pF6E166vZyVH1Tv3vQQ5UF3npTBpNNKOf9ucxlUrOaOyqMUe87TGqPk2t0xPQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ahaE7XIu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ahaE7XIu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 841D8C433F1; Wed, 21 Feb 2024 13:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1708522707; bh=m1P2N0iR+hl5JB3NMZsRZnsGMQ3VrF1jLmtQJihy6EM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ahaE7XIuKFzBs25VMM35GqLR8Qk6w5LOn0nw4C7kfe9l5xNjjoG+TgRYk2t/UcvUA huHq9dwLmtwmGWEDsVleLzt0HIKdp/gvvBxXty0+Rfmx+mFfWZRXJu6JnlzwREXYso oq8joD1V/KUOhVaTBYjlpq5Z1pVSRJDpjnpnbvMw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Takashi Iwai , Sasha Levin Subject: [PATCH 5.15 209/476] ALSA: hda: Refer to correct stream index at loops Date: Wed, 21 Feb 2024 14:04:20 +0100 Message-ID: <20240221130015.631197217@linuxfoundation.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240221130007.738356493@linuxfoundation.org> References: <20240221130007.738356493@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Iwai [ Upstream commit 26257869672fd4a06a60c2da841e15fb2cb47bbe ] In a couple of loops over the all streams, we check the bitmap against the loop counter. A more correct reference would be, however, the index of each stream, instead. This patch corrects the check of bitmaps to the stream index. Note that this change doesn't fix anything for now; all existing drivers set up the stream indices properly, hence the loop count is always equal with the stream index. That said, this change is only for consistency. Link: https://lore.kernel.org/r/20231121154125.4888-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/hda/hdac_stream.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c index ec95d0449bfe..c3342c9fee86 100644 --- a/sound/hda/hdac_stream.c +++ b/sound/hda/hdac_stream.c @@ -598,17 +598,15 @@ void snd_hdac_stream_timecounter_init(struct hdac_stream *azx_dev, struct hdac_stream *s; bool inited = false; u64 cycle_last = 0; - int i = 0; list_for_each_entry(s, &bus->stream_list, list) { - if (streams & (1 << i)) { + if ((streams & (1 << s->index))) { azx_timecounter_init(s, inited, cycle_last); if (!inited) { inited = true; cycle_last = s->tc.cycle_last; } } - i++; } snd_pcm_gettime(runtime, &runtime->trigger_tstamp); @@ -653,14 +651,13 @@ void snd_hdac_stream_sync(struct hdac_stream *azx_dev, bool start, unsigned int streams) { struct hdac_bus *bus = azx_dev->bus; - int i, nwait, timeout; + int nwait, timeout; struct hdac_stream *s; for (timeout = 5000; timeout; timeout--) { nwait = 0; - i = 0; list_for_each_entry(s, &bus->stream_list, list) { - if (!(streams & (1 << i++))) + if (!(streams & (1 << s->index))) continue; if (start) { -- 2.43.0