소스 검색

asoc: codecs: Add NULL check before calling bcs_enable callback function

Add NULL check before calling bcs_enable callback function.

Change-Id: Ic2d65534710d71c074c55d67da3e8a9793bab637
Signed-off-by: Faiz Nabi Kuchay <[email protected]>
Faiz Nabi Kuchay 5 년 전
부모
커밋
54fe9be449
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      asoc/codecs/wcd-mbhc-adc.c

+ 4 - 2
asoc/codecs/wcd-mbhc-adc.c

@@ -694,7 +694,8 @@ correct_plug_type:
 	 */
 	if (plug_type == MBHC_PLUG_TYPE_HEADSET ||
 	    plug_type == MBHC_PLUG_TYPE_HEADPHONE)
-		mbhc->mbhc_cb->bcs_enable(mbhc, false);
+		if (mbhc->mbhc_cb->bcs_enable)
+			mbhc->mbhc_cb->bcs_enable(mbhc, false);
 
 	timeout = jiffies + msecs_to_jiffies(HS_DETECT_PLUG_TIME_MS);
 	while (!time_after(jiffies, timeout)) {
@@ -842,7 +843,8 @@ correct_plug_type:
 	}
 	if ((plug_type == MBHC_PLUG_TYPE_HEADSET ||
 	    plug_type == MBHC_PLUG_TYPE_HEADPHONE))
-		mbhc->mbhc_cb->bcs_enable(mbhc, true);
+		if (mbhc->mbhc_cb->bcs_enable)
+			mbhc->mbhc_cb->bcs_enable(mbhc, true);
 
 	if (!wrk_complete) {
 		/*