]> git.alsa-project.org Git - alsa-lib.git/commitdiff
mixer: abst - reshuffle snd_mixer_simple_basic_register code to be more logical
authorJaroslav Kysela <perex@perex.cz>
Wed, 12 Nov 2025 09:20:21 +0000 (10:20 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 12 Nov 2025 14:36:29 +0000 (15:36 +0100)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/mixer/simple_abst.c

index 7d48c8edf705f5e802145d904a0e8969beeb77f9..b60c0eefb57dc236c9b74847905b3c61d0941559 100644 (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)