Skip to content

Commit 1f7f51a

Browse files
wyqkptiwai
authored andcommitted
ALSA: hda: Fix regression of hdmi eld control created based on invalid pcm
Commit fb087ea ("ALSA: hda - hdmi eld control created based on pcm") forget to filter out invalid pcm numbers, if there is only one invalid pcm number, then this issue causes we create eld control for invalid pcm silently, but when there are more than one invalid pcm numbers, then this issue bring probe error looks like below dmesg: " kernel: [ 1.647283] snd_hda_intel 0000:00:03.0: bound 0000:00:02.0 (ops 0xc2967540) kernel: [ 1.651192] snd_hda_intel 0000:00:03.0: Too many HDMI devices kernel: [ 1.651195] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y kernel: [ 1.651197] snd_hda_intel 0000:00:03.0: Too many HDMI devices kernel: [ 1.651199] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y kernel: [ 1.651201] snd_hda_intel 0000:00:03.0: Too many HDMI devices kernel: [ 1.651203] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y kernel: [ 1.651676] snd_hda_intel 0000:00:03.0: control 3:0:0:ELD:0 is already present kernel: [ 1.651787] snd_hda_codec_hdmi: probe of hdaudioC0D0 failed with error -16 " This patch add invalid pcm number filter before calling hdmi_create_eld_ctl. Fixes: fb087ea ("ALSA: hda - hdmi eld control created based on pcm") Signed-off-by: Wang YanQing <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 83b033b commit 1f7f51a

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

sound/pci/hda/hda_codec.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3213,8 +3213,10 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec)
32133213
continue; /* no substreams assigned */
32143214

32153215
dev = get_empty_pcm_device(bus, cpcm->pcm_type);
3216-
if (dev < 0)
3216+
if (dev < 0) {
3217+
cpcm->device = SNDRV_PCM_INVALID_DEVICE;
32173218
continue; /* no fatal error */
3219+
}
32183220
cpcm->device = dev;
32193221
err = snd_hda_attach_pcm_stream(bus, codec, cpcm);
32203222
if (err < 0) {

sound/pci/hda/hda_codec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ enum {
164164
HDA_PCM_NTYPES
165165
};
166166

167+
#define SNDRV_PCM_INVALID_DEVICE (-1)
167168
/* for PCM creation */
168169
struct hda_pcm {
169170
char *name;

sound/pci/hda/patch_hdmi.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,7 +2126,7 @@ static int generic_hdmi_build_jack(struct hda_codec *codec, int pcm_idx)
21262126
static int generic_hdmi_build_controls(struct hda_codec *codec)
21272127
{
21282128
struct hdmi_spec *spec = codec->spec;
2129-
int err;
2129+
int dev, err;
21302130
int pin_idx, pcm_idx;
21312131

21322132

@@ -2154,11 +2154,13 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
21542154
return err;
21552155
snd_hda_spdif_ctls_unassign(codec, pcm_idx);
21562156

2157-
/* add control for ELD Bytes */
2158-
err = hdmi_create_eld_ctl(codec, pcm_idx,
2159-
get_pcm_rec(spec, pcm_idx)->device);
2160-
if (err < 0)
2161-
return err;
2157+
dev = get_pcm_rec(spec, pcm_idx)->device;
2158+
if (dev != SNDRV_PCM_INVALID_DEVICE) {
2159+
/* add control for ELD Bytes */
2160+
err = hdmi_create_eld_ctl(codec, pcm_idx, dev);
2161+
if (err < 0)
2162+
return err;
2163+
}
21622164
}
21632165

21642166
for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {

0 commit comments

Comments
 (0)