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 ABD9C2556F; Sat, 3 Feb 2024 04:17:17 +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=1706933837; cv=none; b=gqoQZvHGb54vV4yC5LH6bdr2a1u4m3Uc33PgaXUnemVZ4quao4GgervmXHhN+Tg265LHMLQurmEzREAOlioXdXecBz9QY9ZG9WClTXuv/FptXe/DNi9MqZ+C0LTMWukIOvpcsl91evARQOYFMg65MIU4ZeoT4hq9hzSXReGRQjs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706933837; c=relaxed/simple; bh=QxlcEbqmadxrpe63u6Kl4dKlrHzVwiJJDe6nSP7BcS0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PEiG+pdZI+OZUn7RS2cVrC2C8k36KlsiSDB0p96+41pieRcuY+dWTt3+O/Jsu7BAU0urCkb3hfZJhLKdIblk+ovGOPZ3KLkSIUmbTDIEkFV5l1Pl15CQmY+oyNnrSWeI9gcUjR1u+U2C8Y0fudqQSuAHz2uU4zVzjMEConQPWBA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=n0zd9SIO; 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="n0zd9SIO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75CF2C433C7; Sat, 3 Feb 2024 04:17:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1706933837; bh=QxlcEbqmadxrpe63u6Kl4dKlrHzVwiJJDe6nSP7BcS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n0zd9SIO6KgKGjMsLiDh7uzSK+y0bQspWNHcyddcTiYoB4QCP6sdUCtdBULRfw/Aa s0+uiu1wMhQe3gfW47ljA3VPZ8wKr0hwwSZtYziQ10hNev0dOeLU7eE69grqHK8h2U YLLyzWkUI0dEJhk2lHqVZj0KEHuQ5QyFsXbZDb5g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Takashi Iwai , Sasha Levin Subject: [PATCH 6.7 162/353] ALSA: hda: Refer to correct stream index at loops Date: Fri, 2 Feb 2024 20:04:40 -0800 Message-ID: <20240203035408.766572594@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240203035403.657508530@linuxfoundation.org> References: <20240203035403.657508530@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.7-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 6ce24e248f8e..610ea7a33cd8 100644 --- a/sound/hda/hdac_stream.c +++ b/sound/hda/hdac_stream.c @@ -671,17 +671,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); @@ -726,14 +724,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