ASoC: msm: Avoid accessing invalid audio client during hw_params fail

In some cases, when DSP doesn't respond to any commands that
are sent, pcm_open will return success followed by hw_params
which will return failure. Audio client gets freed in case of
hw_params failure. However, the subsequent pcm_close will try to
access the audio client structure which is already freed. To avoid
this case, we move open_write to msm_pcm_open so that if DSP is in
bad state, pcm_open will return failure, thus avoiding pcm_close
to happen.

Change-Id: Ia53408e8c0a1d40ed552ba81340e3766451c69f1
Signed-off-by: Phani Kumar Uppalapati <phanik@codeaurora.org>
1 file changed