[PATCH] ASoC: soc-dapm: Remove overzealous check

From: Amadeusz Sławiński

Date: Mon Oct 19 2026 - 16:14:57 EST


Widget is always constructed with dapm context, so this check is
superfluous and it also leads to warning from kernel test robot.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <error27@xxxxxxxxx>
Closes: https://lore.kernel.org/r/202610180339.A6POXeNa-lkp@xxxxxxxxx/
Signed-off-by: Amadeusz Sławiński <amade@xxxxxxxxxx>
---
sound/soc/soc-dapm.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 7455160b11fe..eff6103cb21b 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2890,20 +2890,18 @@ void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w)

dapm_debugfs_free_widget(w);

- if (w->dapm) {
- if (w->dapm->card) {
- for_each_card_dapms(w->dapm->card, d) {
- if (d->wcache_sink == w)
- d->wcache_sink = NULL;
- if (d->wcache_source == w)
- d->wcache_source = NULL;
- }
- } else {
- if (w->dapm->wcache_sink == w)
- w->dapm->wcache_sink = NULL;
- if (w->dapm->wcache_source == w)
- w->dapm->wcache_source = NULL;
+ if (w->dapm->card) {
+ for_each_card_dapms(w->dapm->card, d) {
+ if (d->wcache_sink == w)
+ d->wcache_sink = NULL;
+ if (d->wcache_source == w)
+ d->wcache_source = NULL;
}
+ } else {
+ if (w->dapm->wcache_sink == w)
+ w->dapm->wcache_sink = NULL;
+ if (w->dapm->wcache_source == w)
+ w->dapm->wcache_source = NULL;
}

kfree(w->kcontrols);
--
2.56.0