st-hal : Add pre-judgment prevent null pointer
Add pre-judgment prevent null pointer.
Change-Id: Ib5cd615b8b12f0c5f35d752b9855dc97b7b80266
diff --git a/st_hw_session_lsm.c b/st_hw_session_lsm.c
index ba8154a..735f7f0 100644
--- a/st_hw_session_lsm.c
+++ b/st_hw_session_lsm.c
@@ -1287,6 +1287,11 @@
int event_status, request;
st_hw_sess_event_t hw_sess_event; /* used to report event to st_session */
+ if (p_lsm_ses == NULL) {
+ ALOGE("%s: ERROR. null context.. exiting", __func__);
+ return NULL;
+ }
+
#ifdef ENABLE_SVA_MIXER_CTL
struct mixer * st_mixer = NULL;
st_mixer = p_lsm_ses->common.stdev->mixer;
@@ -1304,10 +1309,6 @@
}
#endif
- if (p_lsm_ses == NULL) {
- ALOGE("%s: ERROR. null context.. exiting", __func__);
- return NULL;
- }
ALOGD("%s:[%d] Enter", __func__, p_lsm_ses->common.sm_handle);
setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DEFAULT);