All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kaitao Cheng" <kaitao.cheng@linux.dev>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 13/14] ASoC: dapm: Open-code widget invalidation walk
Date: Tue, 09 Jun 2026 06:55:05 +0000	[thread overview]
Message-ID: <20260609065506.4CD561F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260609064122.95825-1-kaitao.cheng@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Incomplete preparation for list iterator semantics change causes DAPM power loop to terminate prematurely.
--

commit 43f2e05998002333ccbe3a3f202cf3f76c35d1b0
Author: Kaitao Cheng <chengkaitao@kylinos.cn>

ASoC: dapm: Open-code widget invalidation walk

This commit prepares dapm_widget_invalidate_paths() for an upcoming change
to list_for_each_entry() that will cache the next element. It open-codes the
loop to preserve the existing semantics where new widgets can be appended
during traversal.

> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index d6192204e613d..5bd921fca1323 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -255,7 +255,9 @@ static __always_inline void dapm_widget_invalidate_paths(
>  	list_add_tail(&w->work_list, &list);
>  	w->endpoints[dir] = -1;
>  
> -	list_for_each_entry(w, &list, work_list) {
> +	for (w = list_first_entry(&list, typeof(*w), work_list);
> +	     !list_entry_is_head(w, &list, work_list);
> +	     w = list_next_entry(w, work_list)) {

[Severity: High]
Does this open-coding also need to be applied to the loop in
dapm_power_widgets()?

dapm_power_widgets() loops over card->dapm_dirty using list_for_each_entry():

sound/soc/soc-dapm.c:dapm_power_widgets() {
	...
	list_for_each_entry(w, &card->dapm_dirty, dirty) {
		dapm_power_one_widget(w, &up_list, &down_list);
	}
	...
}

Inside that loop, dapm_power_one_widget() can invoke
dapm_widget_set_peer_power(), which calls dapm_mark_dirty() to append peer
widgets to the tail of card->dapm_dirty.

If the upcoming list_for_each_entry() changes cache the next element, won't
the loop in dapm_power_widgets() terminate early and fail to process newly
dirtied widgets if they are appended while processing the current tail
element?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260609064122.95825-1-kaitao.cheng@linux.dev?part=13

  parent reply	other threads:[~2026-06-09  6:55 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  6:13 [PATCH v2 00/14] list: Prepare entry iterators to cache cursor state Kaitao Cheng
2026-06-09  6:13 ` [PATCH v2 01/14] drbd: Open-code transfer log list walk Kaitao Cheng
2026-06-09  6:53   ` sashiko-bot
2026-06-09  6:13 ` [PATCH v2 02/14] firewire: core: Open-code topology " Kaitao Cheng
2026-06-09  6:53   ` sashiko-bot
2026-06-09  6:25 ` [PATCH v2 03/14] drm/bridge: Open-code bridge chain list walks Kaitao Cheng
2026-06-09  6:25   ` [PATCH v2 04/14] drm/i915/gt: Open-code active timeline walk Kaitao Cheng
2026-06-09  7:00     ` Andy Shevchenko
2026-06-09  6:25   ` [PATCH v2 05/14] drm/i915: Open-code DFS dependency list walk Kaitao Cheng
2026-06-09  6:25   ` [PATCH v2 06/14] drm/ttm: Open-code reservation " Kaitao Cheng
2026-06-09  6:51     ` sashiko-bot
2026-06-09  6:25   ` [PATCH v2 07/14] spi: fsi: Open-code message transfer walk Kaitao Cheng
2026-06-09  7:02     ` Andy Shevchenko
2026-06-09  6:25   ` [PATCH v2 08/14] spi: stm32-ospi: " Kaitao Cheng
2026-06-09  6:57     ` sashiko-bot
2026-06-09  6:25   ` [PATCH v2 09/14] spi: stm32-qspi: " Kaitao Cheng
2026-06-09  6:55     ` sashiko-bot
2026-06-09  6:38 ` [PATCH v2 10/14] spi: tegra210-quad: " Kaitao Cheng
2026-06-09  6:38   ` [PATCH v2 11/14] locking/locktorture: Open-code ww mutex list walk Kaitao Cheng
2026-06-09  6:54     ` sashiko-bot
2026-06-09  6:38   ` [PATCH v2 12/14] locking/ww_mutex: Open-code stress reorder " Kaitao Cheng
2026-06-09  6:57   ` [PATCH v2 10/14] spi: tegra210-quad: Open-code message transfer walk sashiko-bot
2026-06-09  6:41 ` [PATCH v2 13/14] ASoC: dapm: Open-code widget invalidation walk Kaitao Cheng
2026-06-09  6:41   ` [PATCH v2 14/14] list: Cache cursors in entry iterators Kaitao Cheng
2026-06-09  6:59     ` sashiko-bot
2026-06-09  6:55   ` sashiko-bot [this message]
2026-06-09  6:47 ` [PATCH v2 00/14] list: Prepare entry iterators to cache cursor state Andy Shevchenko
2026-06-09  7:05   ` Andy Shevchenko
2026-06-09 10:33 ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260609065506.4CD561F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kaitao.cheng@linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.