Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/msm/dp: inverted read_link_status check in msm_dp_ctrl_on_link() --
commit 8c690997a9febc2815a307edb04f4bd93ad4035f Author: Gianfranco Mariotti <[email protected]> drm/msm/dp: guard internal HPD state checks when external HPD is used This commit tracks whether the DP controller's internal HPD block is enabled and gates internal HPD state checks on it, while also adding an error check for drm_dp_dpcd_read_link_status() in msm_dp_ctrl_on_link(). > diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c > b/drivers/gpu/drm/msm/dp/dp_ctrl.c > index ceff9a99147f2..36fc9c6bd9f45 100644 > --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c > +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c > @@ -2435,10 +2435,13 @@ int msm_dp_ctrl_on_link(struct msm_dp_ctrl > *msm_dp_ctrl, > break; > } else if (training_step == DP_TRAINING_1) { > /* link train_1 failed */ > - if (!msm_dp_aux_is_link_connected(ctrl->aux)) > + if (msm_dp_aux_is_hpd_enabled(ctrl->aux) && > + !msm_dp_aux_is_link_connected(ctrl->aux)) > break; > > - drm_dp_dpcd_read_link_status(ctrl->aux, link_status); > + if (drm_dp_dpcd_read_link_status(ctrl->aux, > + link_status) <= 0) > + break; > > rc = msm_dp_ctrl_link_rate_down_shift(ctrl); > if (rc < 0) { /* already in RBR = 1.6G */ > @@ -2460,10 +2463,13 @@ int msm_dp_ctrl_on_link(struct msm_dp_ctrl > *msm_dp_ctrl, > } > } else if (training_step == DP_TRAINING_2) { > /* link train_2 failed */ > - if (!msm_dp_aux_is_link_connected(ctrl->aux)) > + if (msm_dp_aux_is_hpd_enabled(ctrl->aux) && > + !msm_dp_aux_is_link_connected(ctrl->aux)) > break; > > - drm_dp_dpcd_read_link_status(ctrl->aux, link_status); > + if (drm_dp_dpcd_read_link_status(ctrl->aux, > + link_status) <= 0) > + break; > > if (!drm_dp_clock_recovery_ok(link_status, > ctrl->link->link_params.num_lanes)) [Severity: High] Should both of these checks test `< 0` rather than `<= 0`? Since fcbb93f1e48a ("drm/display: dp: change drm_dp_dpcd_read_link_status() return value"), drm_dp_dpcd_read_link_status() returns 0 on success and a negative errno on failure. Testing `<= 0` is always true, so any DP_TRAINING_1 or DP_TRAINING_2 failure aborts the retry loop immediately instead of downshifting the link rate or lane count. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=10
