Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH v2] ALSA: hda: Add error check for snd_ctl_rename_id() in snd_hda_create_dig_out_ctls()
@ 2025-02-13  7:45 Wentao Liang
  2025-02-13  8:23 ` Markus Elfring
  2025-02-14  7:47 ` Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2025-02-13  7:45 UTC (permalink / raw)
  To: perex, tiwai
  Cc: vulab, cezary.rojewski, Julia.Lawall, linux-sound, linux-kernel,
	stable

Check the return value of snd_ctl_rename_id() in
snd_hda_create_dig_out_ctls(). Ensure that failures
are properly handled.

Fixes: 5c219a340850 ("ALSA: hda: Fix kctl->id initialization")
Cc: stable@vger.kernel.org # 6.4+
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 sound/pci/hda/hda_codec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 14763c0f31ad..46a220404999 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2470,7 +2470,9 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
 				break;
 			id = kctl->id;
 			id.index = spdif_index;
-			snd_ctl_rename_id(codec->card, &kctl->id, &id);
+			err = snd_ctl_rename_id(codec->card, &kctl->id, &id);
+			if (err < 0)
+				return err;
 		}
 		bus->primary_dig_out_type = HDA_PCM_TYPE_HDMI;
 	}
-- 
2.42.0.windows.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ALSA: hda: Add error check for snd_ctl_rename_id() in snd_hda_create_dig_out_ctls()
  2025-02-13  7:45 [PATCH v2] ALSA: hda: Add error check for snd_ctl_rename_id() in snd_hda_create_dig_out_ctls() Wentao Liang
@ 2025-02-13  8:23 ` Markus Elfring
  2025-02-14  7:47 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2025-02-13  8:23 UTC (permalink / raw)
  To: vulab, linux-sound
  Cc: stable, LKML, Cezary Rojewski, Jaroslav Kysela, Julia Lawall,
	Takashi Iwai

…
> ---
>  sound/pci/hda/hda_codec.c | 4 +++-
…

How do you think about to improve also your version management?
https://lore.kernel.org/all/?q=%22This+looks+like+a+new+version+of+a+previously+submitted+patch%22
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14-rc2#n780

Regards,
Markus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ALSA: hda: Add error check for snd_ctl_rename_id() in snd_hda_create_dig_out_ctls()
  2025-02-13  7:45 [PATCH v2] ALSA: hda: Add error check for snd_ctl_rename_id() in snd_hda_create_dig_out_ctls() Wentao Liang
  2025-02-13  8:23 ` Markus Elfring
@ 2025-02-14  7:47 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2025-02-14  7:47 UTC (permalink / raw)
  To: Wentao Liang
  Cc: perex, tiwai, cezary.rojewski, Julia.Lawall, linux-sound,
	linux-kernel, stable

On Thu, 13 Feb 2025 08:45:43 +0100,
Wentao Liang wrote:
> 
> Check the return value of snd_ctl_rename_id() in
> snd_hda_create_dig_out_ctls(). Ensure that failures
> are properly handled.
> 
> Fixes: 5c219a340850 ("ALSA: hda: Fix kctl->id initialization")
> Cc: stable@vger.kernel.org # 6.4+
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>

The error would never happen because this is a rename, and the only
error condition of snd_ctl_rename_id() is the lack of the control id.
But it's better to have a return check in the caller side, so I took
now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-14  7:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13  7:45 [PATCH v2] ALSA: hda: Add error check for snd_ctl_rename_id() in snd_hda_create_dig_out_ctls() Wentao Liang
2025-02-13  8:23 ` Markus Elfring
2025-02-14  7:47 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox