Skip to content

Commit 822b7ec

Browse files
ISCAS-Vulabtiwai
authored andcommitted
ALSA: hda: Add error check for snd_ctl_rename_id() in snd_hda_create_dig_out_ctls()
Check the return value of snd_ctl_rename_id() in snd_hda_create_dig_out_ctls(). Ensure that failures are properly handled. [ Note: the error cannot happen practically because the only error condition in snd_ctl_rename_id() is the missing ID, but this is a rename, hence it must be present. But for the code consistency, it's safer to have always the proper return check -- tiwai ] Fixes: 5c219a3 ("ALSA: hda: Fix kctl->id initialization") Cc: stable@vger.kernel.org # 6.4+ Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Link: https://patch.msgid.link/20250213074543.1620-1-vulab@iscas.ac.cn Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 325735e commit 822b7ec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sound/pci/hda/hda_codec.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2470,7 +2470,9 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
24702470
break;
24712471
id = kctl->id;
24722472
id.index = spdif_index;
2473-
snd_ctl_rename_id(codec->card, &kctl->id, &id);
2473+
err = snd_ctl_rename_id(codec->card, &kctl->id, &id);
2474+
if (err < 0)
2475+
return err;
24742476
}
24752477
bus->primary_dig_out_type = HDA_PCM_TYPE_HDMI;
24762478
}

0 commit comments

Comments
 (0)