mixer: abst - reshuffle snd_mixer_simple_basic_register code to be more logical

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-12 10:20:21 +01:00
parent b97a11ecf0
commit f0679e5de2

View file

@ -305,38 +305,36 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
file = s;
}
err = snd_config_top(&top);
if (err >= 0) {
err = snd_input_stdio_open(&input, file, "r");
if (err < 0) {
snd_error(MIXER, "unable to open simple mixer configuration file '%s'", file);
goto __error;
}
err = snd_config_load(top, input);
snd_input_close(input);
if (err < 0) {
snd_error(MIXER, "%s may be old or corrupted: consider to remove or fix it", file);
goto __error;
}
err = find_full(class, mixer, top, priv->device);
if (err >= 0)
goto __full;
if (err < 0)
goto __error;
err = snd_input_stdio_open(&input, file, "r");
if (err < 0) {
snd_error(MIXER, "unable to open simple mixer configuration file '%s'", file);
goto __error;
}
if (err >= 0) {
err = snd_ctl_open(&priv->ctl, priv->device, 0);
if (err < 0) {
snd_error(MIXER, "unable to open control device '%s': %s", priv->device, snd_strerror(err));
goto __error;
}
err = snd_hctl_open_ctl(&priv->hctl, priv->ctl);
if (err < 0)
goto __error;
err = snd_ctl_card_info_malloc(&priv->info);
if (err < 0)
goto __error;
err = snd_ctl_card_info(priv->ctl, priv->info);
if (err < 0)
goto __error;
err = snd_config_load(top, input);
snd_input_close(input);
if (err < 0) {
snd_error(MIXER, "%s may be old or corrupted: consider to remove or fix it", file);
goto __error;
}
err = find_full(class, mixer, top, priv->device);
if (err >= 0)
goto __full;
err = snd_ctl_open(&priv->ctl, priv->device, 0);
if (err < 0) {
snd_error(MIXER, "unable to open control device '%s': %s", priv->device, snd_strerror(err));
goto __error;
}
err = snd_hctl_open_ctl(&priv->hctl, priv->ctl);
if (err < 0)
goto __error;
err = snd_ctl_card_info_malloc(&priv->info);
if (err < 0)
goto __error;
err = snd_ctl_card_info(priv->ctl, priv->info);
if (err < 0)
goto __error;
if (err >= 0)
err = find_module(class, top);
if (err >= 0)