post_proc: Fix for KW reported P1 issues
-Changes are made to address P1 issues reported by KW:
160375, 160376
Change-Id: I4ac3573142f68b0bbe0de162b3883f8a9484fe5e
diff --git a/post_proc/effect_api.c b/post_proc/effect_api.c
index 7c1968e..63ce2c2 100644
--- a/post_proc/effect_api.c
+++ b/post_proc/effect_api.c
@@ -114,7 +114,7 @@
return -EINVAL;
} else {
*ctl = mixer_get_ctl_by_name(*mixer, mixer_string);
- if (!ctl) {
+ if (!(*ctl)) {
ALOGE("mixer_get_ctl_by_name failed");
mixer_close(*mixer);
*mixer = NULL;
@@ -891,6 +891,11 @@
uint32_t i;
ALOGV("%s", __func__);
+ if (!ctl) {
+ ALOGE("%s: ctl is NULL, return invalid", __func__);
+ return -EINVAL;
+ }
+
if (param_send_flags & OFFLOAD_SEND_HPX_STATE_OFF) {
*p_param_values++ = DTS_EAGLE_MODULE_ENABLE;
*p_param_values++ = 0; /* hpx off*/
@@ -899,7 +904,7 @@
*p_param_values++ = 1; /* hpx on*/
}
- if ((mode == OFFLOAD) && ctl)
+ if (mode == OFFLOAD)
mixer_ctl_set_array(ctl, param_values, ARRAY_SIZE(param_values));
else {
if (ioctl(*(int *)ctl, AUDIO_EFFECTS_SET_PP_PARAMS, param_values) < 0)