Merge "hal: msm8998 define max channel count to 8"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 22a97ad..3761367 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3044,10 +3044,11 @@
                     pcm_close(in->pcm);
                     in->pcm = NULL;
                 }
-                if (pcm_open_retry_count-- == 0) {
+                if (pcm_open_retry_count == 0) {
                     ret = -EIO;
                     goto error_open;
                 }
+                pcm_open_retry_count--;
                 usleep(PROXY_OPEN_WAIT_TIME * 1000);
                 continue;
             }
@@ -3536,9 +3537,10 @@
                 pcm_close(pcm);
                 pcm = NULL;
             }
-            if (pcm_open_retry_count-- == 0)
+            if (pcm_open_retry_count == 0)
                 return NULL;
 
+            pcm_open_retry_count--;
             usleep(PROXY_OPEN_WAIT_TIME * 1000);
             continue;
         }
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 73369ea..6c6d0de 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -2533,6 +2533,8 @@
         } else {
             my_data->is_acdb_initialized = false;
             ALOGD("ACDB initialization failed");
+            if (my_data->acdb_deallocate)
+                my_data->acdb_deallocate();
         }
     }
     audio_extn_pm_vote();
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index cc75c9e..264c6f6 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -3408,6 +3408,8 @@
         } else {
             my_data->is_acdb_initialized = false;
             ALOGD("ACDB initialization failed");
+            if (my_data->acdb_deallocate)
+                my_data->acdb_deallocate();
         }
     }
     /* init keep-alive for compress passthru */