소스 검색

asoc: mbhc: avoid unregister extcon device when ssr happens

MBHC extcon device is unregistered when adsp ssr happens and causes
kernel panic. Avoid unregistering MBHC extcon device in mbhc_deinit.

Change-Id: I69fa057a480ebadaf324ca1f61bf399c176e3b2d
Signed-off-by: Meng Wang <[email protected]>
Meng Wang 3 년 전
부모
커밋
b16ebebc97
1개의 변경된 파일10개의 추가작업 그리고 13개의 파일을 삭제
  1. 10 13
      asoc/codecs/wcd-mbhc-v2.c

+ 10 - 13
asoc/codecs/wcd-mbhc-v2.c

@@ -2049,20 +2049,20 @@ int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_component *component,
 		       mbhc->intr_ids->hph_right_ocp);
 		goto err_hphr_ocp_irq;
 	}
-	if (!mbhc->extdev)
+	if (!mbhc->extdev) {
 		mbhc->extdev =
 			devm_extcon_dev_allocate(component->dev,
 				mbhc_ext_dev_supported_table);
-	if (IS_ERR(mbhc->extdev)) {
-		goto err_ext_dev;
-		ret = PTR_ERR(mbhc->extdev);
-	}
-	ret = devm_extcon_dev_register(component->dev, mbhc->extdev);
-	if (ret) {
-		pr_err("%s:audio registration failed\n", __func__);
-		goto err_ext_dev;
+		if (IS_ERR(mbhc->extdev)) {
+			goto err_ext_dev;
+			ret = PTR_ERR(mbhc->extdev);
+		}
+		ret = devm_extcon_dev_register(component->dev, mbhc->extdev);
+		if (ret) {
+			pr_err("%s:audio registration failed\n", __func__);
+			goto err_ext_dev;
+		}
 	}
-
 	mbhc->deinit_in_progress = false;
 	pr_debug("%s: leave ret %d\n", __func__, ret);
 	return ret;
@@ -2100,9 +2100,6 @@ void wcd_mbhc_deinit(struct wcd_mbhc *mbhc)
 {
 	struct snd_soc_component *component = mbhc->component;
 
-	if (mbhc->extdev)
-		devm_extcon_dev_unregister(component->dev, mbhc->extdev);
-
 	mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->mbhc_sw_intr, mbhc);
 	mbhc->mbhc_cb->free_irq(component, mbhc->intr_ids->mbhc_btn_press_intr,
 				mbhc);