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@samsung.com Signed-off-by: Liam Girdwood lrg@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; }