Parcourir la source

disp: msm: dp: Detect failure cases when setting mst topology manager

The mst topology manager set may fail for various
reasons. Ensure that the return codes are checked
and stop execution when failure cases are
detected.

CRs-Fixed: 2520932
Change-Id: I95c4caf403d0960525d931bf67560e800a3691ae
Signed-off-by: Fuad Hossain <[email protected]>
Fuad Hossain il y a 5 ans
Parent
commit
b6a5a22b60
1 fichiers modifiés avec 21 ajouts et 4 suppressions
  1. 21 4
      msm/dp/dp_mst_drm.c

+ 21 - 4
msm/dp/dp_mst_drm.c

@@ -403,10 +403,16 @@ static int dp_mst_sim_topology_mgr_set_mst(
 		struct drm_dp_mst_topology_mgr *mgr,
 		bool mst_state)
 {
+	int rc;
 	struct dp_mst_private *mst = container_of(mgr,
 			struct dp_mst_private, mst_mgr);
 
-	drm_dp_mst_topology_mgr_set_mst(mgr, mst_state);
+	rc = drm_dp_mst_topology_mgr_set_mst(mgr, mst_state);
+	if (rc < 0) {
+		DRM_ERROR("unable to set mst topology mgr, rc: %d\n", rc);
+		return rc;
+	}
+
 	if (mst_state)
 		queue_work(system_long_wq, &mst->simulator.probe_work);
 
@@ -1945,9 +1951,12 @@ static void dp_mst_display_hpd(void *dp_display, bool hpd_status,
 	mst->mst_session_state = hpd_status;
 	mutex_unlock(&mst->mst_lock);
 
-	if (!hpd_status)
+	if (!hpd_status) {
 		rc = mst->mst_fw_cbs->topology_mgr_set_mst(&mst->mst_mgr,
 				hpd_status);
+		if (rc < 0)
+			goto fail;
+	}
 
 	if (info && !info->mst_protocol) {
 		if (hpd_status) {
@@ -1959,13 +1968,21 @@ static void dp_mst_display_hpd(void *dp_display, bool hpd_status,
 		mst->mst_fw_cbs = &drm_dp_mst_fw_helper_ops;
 	}
 
-	if (hpd_status)
+	if (hpd_status) {
 		rc = mst->mst_fw_cbs->topology_mgr_set_mst(&mst->mst_mgr,
 				hpd_status);
+		if (rc < 0)
+			goto fail;
+	}
 
 	dp_mst_hpd_event_notify(mst, hpd_status);
 
-	DP_MST_INFO_LOG("mst display hpd:%d, rc:%d\n", hpd_status, rc);
+	DP_MST_INFO_LOG("mst display hpd success. hpd:%d, rc:%d\n", hpd_status,
+			rc);
+	return;
+fail:
+	DRM_ERROR("mst display hpd failed. hpd: %d, rc: %d\n",
+			hpd_status, rc);
 }
 
 static void dp_mst_display_hpd_irq(void *dp_display,