hal: fix ASAN crash

Fix asan crash due to access usecase->stream.out without check type.

CRs-Fixed: 2534699
Change-Id: I24f3f86885a1949a02ba0eea230e1431a95b4713
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 8d6e7bc..8411ecc 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -8435,7 +8435,8 @@
     int controller = -1;
     int stream = -1;
 
-    if (usecase) {
+    if (usecase != NULL && usecase->stream.out &&
+            usecase->type == PCM_PLAYBACK) {
         controller = usecase->stream.out->extconn.cs.controller;
         stream = usecase->stream.out->extconn.cs.stream;
     }