Merge " Audio: Fix for sound card status overwrite issue"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index e58c954..5f29d71 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -851,7 +851,7 @@
 
     if (SND_CARD_STATE_OFFLINE == snd_card_status) {
         ALOGE("%s: sound card is not active/SSR returning error", __func__);
-        ret = -ENETRESET;
+        ret = -EIO;
         goto error_config;
     }
 
@@ -1255,7 +1255,7 @@
 
     if (SND_CARD_STATE_OFFLINE == snd_card_status) {
         ALOGE("%s: sound card is not active/SSR returning error", __func__);
-        ret = -ENETRESET;
+        ret = -EIO;
         goto error_config;
     }
 
@@ -1775,7 +1775,7 @@
     if (SND_CARD_STATE_OFFLINE == snd_scard_state) {
         if (out->pcm) {
             ALOGD(" %s: sound card is not active/SSR state", __func__);
-            ret= -ENETRESET;
+            ret= -EIO;
             goto exit;
         } else if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) {
             //during SSR for compress usecase we should return error to flinger
@@ -2230,7 +2230,7 @@
     if (in->pcm) {
         if(SND_CARD_STATE_OFFLINE == snd_scard_state) {
             ALOGD(" %s: sound card is not active/SSR state", __func__);
-            ret= -ENETRESET;
+            ret= -EIO;;
             goto exit;
         }
     }
@@ -2268,10 +2268,9 @@
 
 exit:
     /* ToDo: There may be a corner case when SSR happens back to back during
-        start/stop. Need to post different error to handle that. */
+       start/stop. Need to post different error to handle that. */
     if (-ENETRESET == ret) {
         set_snd_card_state(adev,SND_CARD_STATE_OFFLINE);
-        memset(buffer, 0, bytes);
     }
     pthread_mutex_unlock(&in->lock);
 
@@ -2282,6 +2281,7 @@
             pthread_mutex_unlock(&adev->lock);
             in->standby = true;
         }
+        memset(buffer, 0, bytes);
         in_standby(&in->stream.common);
         ALOGV("%s: read failed - sleeping for buffer duration", __func__);
         usleep(bytes * 1000000 / audio_stream_frame_size(&in->stream.common) /