Merge "post_proc: Fix for KW reported P1 issues"
diff --git a/post_proc/effect_api.c b/post_proc/effect_api.c
index c850fa5..e15db17 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;
@@ -968,6 +968,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*/
@@ -976,7 +981,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)