From b6a5a22b6002517d7024b665d6a0c51e838635c3 Mon Sep 17 00:00:00 2001 From: Fuad Hossain Date: Fri, 16 Aug 2019 17:58:48 -0400 Subject: [PATCH] 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 --- msm/dp/dp_mst_drm.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/msm/dp/dp_mst_drm.c b/msm/dp/dp_mst_drm.c index 4861566a2da8..a7424bc2b1cc 100644 --- a/msm/dp/dp_mst_drm.c +++ b/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,