ALSA: ice1712,ice1724: fix the kcontrol->id initialization
commit b9a4efd61b6b9f62f83752959e75a5dae20624fa upstream. The new xarray lookup code requires to know complete kcontrol->id before snd_ctl_add() call. Reorder the code to make the initialization properly. Cc: stable@kernel.org # v5.19+ Reported-by: Martin Zidek <zidek@master.cz> Signed-off-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20230606073122.597491-1-perex@perex.cz Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
caad8a0a10
commit
0df0097ea2
3 changed files with 23 additions and 14 deletions
|
|
@ -1903,11 +1903,12 @@ static int aureon_add_controls(struct snd_ice1712 *ice)
|
||||||
else {
|
else {
|
||||||
for (i = 0; i < ARRAY_SIZE(cs8415_controls); i++) {
|
for (i = 0; i < ARRAY_SIZE(cs8415_controls); i++) {
|
||||||
struct snd_kcontrol *kctl;
|
struct snd_kcontrol *kctl;
|
||||||
err = snd_ctl_add(ice->card, (kctl = snd_ctl_new1(&cs8415_controls[i], ice)));
|
kctl = snd_ctl_new1(&cs8415_controls[i], ice);
|
||||||
if (err < 0)
|
|
||||||
return err;
|
|
||||||
if (i > 1)
|
if (i > 1)
|
||||||
kctl->id.device = ice->pcm->device;
|
kctl->id.device = ice->pcm->device;
|
||||||
|
err = snd_ctl_add(ice->card, kctl);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2371,22 +2371,26 @@ int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice)
|
||||||
|
|
||||||
if (snd_BUG_ON(!ice->pcm_pro))
|
if (snd_BUG_ON(!ice->pcm_pro))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_default, ice));
|
kctl = snd_ctl_new1(&snd_ice1712_spdif_default, ice);
|
||||||
|
kctl->id.device = ice->pcm_pro->device;
|
||||||
|
err = snd_ctl_add(ice->card, kctl);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
kctl = snd_ctl_new1(&snd_ice1712_spdif_maskc, ice);
|
||||||
kctl->id.device = ice->pcm_pro->device;
|
kctl->id.device = ice->pcm_pro->device;
|
||||||
err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_maskc, ice));
|
err = snd_ctl_add(ice->card, kctl);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
kctl = snd_ctl_new1(&snd_ice1712_spdif_maskp, ice);
|
||||||
kctl->id.device = ice->pcm_pro->device;
|
kctl->id.device = ice->pcm_pro->device;
|
||||||
err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_maskp, ice));
|
err = snd_ctl_add(ice->card, kctl);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
kctl = snd_ctl_new1(&snd_ice1712_spdif_stream, ice);
|
||||||
kctl->id.device = ice->pcm_pro->device;
|
kctl->id.device = ice->pcm_pro->device;
|
||||||
err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_stream, ice));
|
err = snd_ctl_add(ice->card, kctl);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
kctl->id.device = ice->pcm_pro->device;
|
|
||||||
ice->spdif.stream_ctl = kctl;
|
ice->spdif.stream_ctl = kctl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2392,23 +2392,27 @@ static int snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice)
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_vt1724_spdif_default, ice));
|
kctl = snd_ctl_new1(&snd_vt1724_spdif_default, ice);
|
||||||
|
kctl->id.device = ice->pcm->device;
|
||||||
|
err = snd_ctl_add(ice->card, kctl);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
kctl = snd_ctl_new1(&snd_vt1724_spdif_maskc, ice);
|
||||||
kctl->id.device = ice->pcm->device;
|
kctl->id.device = ice->pcm->device;
|
||||||
err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_vt1724_spdif_maskc, ice));
|
err = snd_ctl_add(ice->card, kctl);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
kctl = snd_ctl_new1(&snd_vt1724_spdif_maskp, ice);
|
||||||
kctl->id.device = ice->pcm->device;
|
kctl->id.device = ice->pcm->device;
|
||||||
err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_vt1724_spdif_maskp, ice));
|
err = snd_ctl_add(ice->card, kctl);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
kctl->id.device = ice->pcm->device;
|
|
||||||
#if 0 /* use default only */
|
#if 0 /* use default only */
|
||||||
err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_vt1724_spdif_stream, ice));
|
kctl = snd_ctl_new1(&snd_vt1724_spdif_stream, ice);
|
||||||
|
kctl->id.device = ice->pcm->device;
|
||||||
|
err = snd_ctl_add(ice->card, kctl);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
kctl->id.device = ice->pcm->device;
|
|
||||||
ice->spdif.stream_ctl = kctl;
|
ice->spdif.stream_ctl = kctl;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue