Merge 37e91827fe2a016e5cb81dd7acdd299931663278 on remote branch

Change-Id: I09b3568964064f0e71a84dba96c4d795bb7d92de
diff --git a/sound_trigger_hw.c b/sound_trigger_hw.c
index 1d3b001..38b7655 100644
--- a/sound_trigger_hw.c
+++ b/sound_trigger_hw.c
@@ -2701,7 +2701,12 @@
     ATRACE_BEGIN("sthal: stdev_close");
 
     pthread_mutex_lock(&stdev_init_lock);
-    if (!st_device || (--stdev_ref_cnt != 0)) {
+    if (!st_device) {
+        goto exit;
+    }
+    if (--stdev_ref_cnt != 0) {
+        ALOGD("%s: Exit device=%p cnt=%d ", __func__, st_device,
+            stdev_ref_cnt);
         goto exit;
     }
 
@@ -2746,8 +2751,6 @@
 exit:
     pthread_mutex_unlock(&stdev_init_lock);
     ATRACE_END();
-    ALOGD("%s: Exit device=%p cnt=%d ", __func__, st_device,
-        stdev_ref_cnt);
     return 0;
 }