[PATCH 1/5] ALSA: hda: Make snd_hda_multi_out_analog_{prepare,cleanup}() return void

From: Ingyu Jang

Date: Sun Nov 01 2026 - 12:22:57 EST


snd_hda_multi_out_analog_prepare() and snd_hda_multi_out_analog_cleanup()
always return 0, so the error checks on their return values in
playback_pcm_prepare() and playback_pcm_cleanup() never trigger.

Make both functions return void, and call the playback hooks
unconditionally.

Signed-off-by: Ingyu Jang <ingyujang25@xxxxxxxxxxx>
---
sound/hda/codecs/generic.c | 22 +++++++++-------------
sound/hda/common/codec.c | 16 +++++++---------
sound/hda/common/hda_local.h | 14 +++++++-------
3 files changed, 23 insertions(+), 29 deletions(-)

diff --git a/sound/hda/codecs/generic.c b/sound/hda/codecs/generic.c
index 6120f797b45a5..ca780b7f688f6 100644
--- a/sound/hda/codecs/generic.c
+++ b/sound/hda/codecs/generic.c
@@ -5324,14 +5324,12 @@ static int playback_pcm_prepare(struct hda_pcm_stream *hinfo,
struct snd_pcm_substream *substream)
{
struct hda_gen_spec *spec = codec->spec;
- int err;

- err = snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
- stream_tag, format, substream);
- if (!err)
- call_pcm_playback_hook(hinfo, codec, substream,
- HDA_GEN_PCM_ACT_PREPARE);
- return err;
+ snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
+ stream_tag, format, substream);
+ call_pcm_playback_hook(hinfo, codec, substream,
+ HDA_GEN_PCM_ACT_PREPARE);
+ return 0;
}

static int playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
@@ -5339,13 +5337,11 @@ static int playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
struct snd_pcm_substream *substream)
{
struct hda_gen_spec *spec = codec->spec;
- int err;

- err = snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
- if (!err)
- call_pcm_playback_hook(hinfo, codec, substream,
- HDA_GEN_PCM_ACT_CLEANUP);
- return err;
+ snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
+ call_pcm_playback_hook(hinfo, codec, substream,
+ HDA_GEN_PCM_ACT_CLEANUP);
+ return 0;
}

static int playback_pcm_close(struct hda_pcm_stream *hinfo,
diff --git a/sound/hda/common/codec.c b/sound/hda/common/codec.c
index e367cc1c6e78f..51189e305ece6 100644
--- a/sound/hda/common/codec.c
+++ b/sound/hda/common/codec.c
@@ -3798,11 +3798,11 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_open);
* Set up the i/o for analog out.
* When the digital out is available, copy the front out to digital out, too.
*/
-int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
- struct hda_multi_out *mout,
- unsigned int stream_tag,
- unsigned int format,
- struct snd_pcm_substream *substream)
+void snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
+ struct hda_multi_out *mout,
+ unsigned int stream_tag,
+ unsigned int format,
+ struct snd_pcm_substream *substream)
{
const hda_nid_t *nids = mout->dac_nids;
int chs = substream->runtime->channels;
@@ -3865,7 +3865,6 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
stream_tag, ch, format);
}

- return 0;
}
EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_prepare);

@@ -3874,8 +3873,8 @@ EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_prepare);
* @codec: the HDA codec
* @mout: hda_multi_out object
*/
-int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
- struct hda_multi_out *mout)
+void snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
+ struct hda_multi_out *mout)
{
const hda_nid_t *nids = mout->dac_nids;
int i;
@@ -3897,7 +3896,6 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
cleanup_dig_out_stream(codec, mout->dig_out_nid);
mout->dig_out_used = 0;
}
- return 0;
}
EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_cleanup);

diff --git a/sound/hda/common/hda_local.h b/sound/hda/common/hda_local.h
index 947a3152fdb53..8bd4497a6b090 100644
--- a/sound/hda/common/hda_local.h
+++ b/sound/hda/common/hda_local.h
@@ -241,13 +241,13 @@ int snd_hda_multi_out_analog_open(struct hda_codec *codec,
struct hda_multi_out *mout,
struct snd_pcm_substream *substream,
struct hda_pcm_stream *hinfo);
-int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
- struct hda_multi_out *mout,
- unsigned int stream_tag,
- unsigned int format,
- struct snd_pcm_substream *substream);
-int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
- struct hda_multi_out *mout);
+void snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
+ struct hda_multi_out *mout,
+ unsigned int stream_tag,
+ unsigned int format,
+ struct snd_pcm_substream *substream);
+void snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
+ struct hda_multi_out *mout);

/*
* generic proc interface
--
2.34.1