]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ASoC: soc-core: drop delayed_work_pending() check before flush
authormatteo.cotifava <cotifavamatteo@gmail.com>
Mon, 9 Mar 2026 21:54:11 +0000 (22:54 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 9 Mar 2026 22:22:40 +0000 (22:22 +0000)
The delayed_work_pending() check before flush_delayed_work() in
soc_free_pcm_runtime() is unnecessary and racy. flush_delayed_work()
is safe to call unconditionally - it is a no-op when no work is
pending. Remove the check.

The original check was added by commit 9c9b65203492 ("ASoC: core:
only flush inited work during free") but delayed_work_pending()
followed by flush_delayed_work() has a time-of-check/time-of-use
window where work can become pending between the two calls.

Fixes: 9c9b65203492 ("ASoC: core: only flush inited work during free")
Signed-off-by: Matteo Cotifava <cotifavamatteo@gmail.com>
Link: https://patch.msgid.link/20260309215412.545628-2-cotifavamatteo@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-core.c

index d0fffef65daf5ee79fb54bd83b51a84347032a18..e5ac8ae1665dfc8d6198f3e3172bd971abb0ef7b 100644 (file)
@@ -462,8 +462,7 @@ static void soc_free_pcm_runtime(struct snd_soc_pcm_runtime *rtd)
 
        list_del(&rtd->list);
 
-       if (delayed_work_pending(&rtd->delayed_work))
-               flush_delayed_work(&rtd->delayed_work);
+       flush_delayed_work(&rtd->delayed_work);
        snd_soc_pcm_component_free(rtd);
 
        /*