[alsa-devel] [PATCH] ucm: fix switch device & modifier when no transition is found

Liam Girdwood lrg at slimlogic.co.uk
Tue Jan 11 18:56:30 CET 2011


Fix some logic bugs in switch device and switch modifier when
transition sequences are not found. Also fix check for new device.

Reported-by: w0806.kim at samsung.com
Signed-off-by: Liam Girdwood <lrg at slimlogic.co.uk>
---
 src/ucm/main.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/ucm/main.c b/src/ucm/main.c
index 7305042..030c9b1 100644
--- a/src/ucm/main.c
+++ b/src/ucm/main.c
@@ -1305,7 +1305,7 @@ static int switch_device(snd_use_case_mgr_t *uc_mgr,
         if (xold == NULL)
                 return -ENOENT;
         xnew = find_device(uc_mgr->active_verb, new_device);
-        if (xold == NULL)
+        if (xnew == NULL)
                 return -ENOENT;
         err = 0;
         list_for_each(pos, &xold->transition_list) {
@@ -1327,7 +1327,7 @@ static int switch_device(snd_use_case_mgr_t *uc_mgr,
                 err = set_device(uc_mgr, xold, 0);
                 if (err < 0)
                         return err;
-                err = set_device(uc_mgr, xnew, 0);
+                err = set_device(uc_mgr, xnew, 1);
                 if (err < 0)
                         return err;
         }
@@ -1379,7 +1379,7 @@ static int switch_modifier(snd_use_case_mgr_t *uc_mgr,
                 err = set_modifier(uc_mgr, xold, 0);
                 if (err < 0)
                         return err;
-                err = set_modifier(uc_mgr, xnew, 0);
+                err = set_modifier(uc_mgr, xnew, 1);
                 if (err < 0)
                         return err;
         }
-- 
1.7.1



More information about the Alsa-devel mailing list