[lvc-project] [PATCH 1/3] ASoC: dapm: make dapm_update_dai_chan() *void*
Sergey Shtylyov
s.shtylyov at omp.ru
Tue Apr 15 22:06:43 MSK 2025
dapm_update_dai_chan() always returns 0, so checking/propagating its result
in dapm_update_dai_unlocked() seems rather pointless. Remove the checks and
make dapm_update_dai_chan() *void* instead of *int*.
Found by Linux Verification Center (linuxtesting.org) with the Svace static
analysis tool.
Signed-off-by: Sergey Shtylyov <s.shtylyov at omp.ru>
---
sound/soc/soc-dapm.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index b7818388984e..2df199f6af74 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2712,16 +2712,16 @@ int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm)
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_sync);
-static int dapm_update_dai_chan(struct snd_soc_dapm_path *p,
- struct snd_soc_dapm_widget *w,
- int channels)
+static void dapm_update_dai_chan(struct snd_soc_dapm_path *p,
+ struct snd_soc_dapm_widget *w,
+ int channels)
{
switch (w->id) {
case snd_soc_dapm_aif_out:
case snd_soc_dapm_aif_in:
break;
default:
- return 0;
+ return;
}
dev_dbg(w->dapm->dev, "%s DAI route %s -> %s\n",
@@ -2732,8 +2732,6 @@ static int dapm_update_dai_chan(struct snd_soc_dapm_path *p,
soc_dapm_connect_path(p, true, "dai update");
else
soc_dapm_connect_path(p, false, "dai update");
-
- return 0;
}
static int dapm_update_dai_unlocked(struct snd_pcm_substream *substream,
@@ -2744,7 +2742,6 @@ static int dapm_update_dai_unlocked(struct snd_pcm_substream *substream,
int channels = params_channels(params);
struct snd_soc_dapm_path *p;
struct snd_soc_dapm_widget *w;
- int ret;
w = snd_soc_dai_get_widget(dai, dir);
@@ -2753,17 +2750,11 @@ static int dapm_update_dai_unlocked(struct snd_pcm_substream *substream,
dev_dbg(dai->dev, "Update DAI routes for %s %s\n", dai->name, snd_pcm_direction_name(dir));
- snd_soc_dapm_widget_for_each_sink_path(w, p) {
- ret = dapm_update_dai_chan(p, p->sink, channels);
- if (ret < 0)
- return ret;
- }
+ snd_soc_dapm_widget_for_each_sink_path(w, p)
+ dapm_update_dai_chan(p, p->sink, channels);
- snd_soc_dapm_widget_for_each_source_path(w, p) {
- ret = dapm_update_dai_chan(p, p->source, channels);
- if (ret < 0)
- return ret;
- }
+ snd_soc_dapm_widget_for_each_source_path(w, p)
+ dapm_update_dai_chan(p, p->source, channels);
return 0;
}
--
2.49.0
More information about the lvc-project
mailing list