All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Gianfranco Mariotti" <gianfranco.mariotti94@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 10/11] drm/msm/dp: guard internal HPD state checks when external HPD is used
Date: Thu, 03 Dec 2026 00:04:17 +0000	[thread overview]
Message-ID: <sashiko-outbox-246796@kernel.org> (raw)
In-Reply-To: <20261202234640.9379-11-gianfranco.mariotti94@gmail.com>

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 <gianfranco.mariotti94@gmail.com>

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/20261202234640.9379-1-gianfranco.mariotti94@gmail.com?part=10

  reply	other threads:[~2026-12-03  0:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 23:46 [PATCH v3 00/11] drm/msm/dp: fix DisplayPort hotplug, link training, PHY lifecycle, and external HPD Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 01/11] drm/msm/dp: configure voltage swing and pre-emphasis for all active lanes Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 02/11] drm/msm/dp: reset cached link_info before reading DPCD capabilities Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 03/11] drm/msm/dp: keep training pattern active until stream video is ready Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 04/11] drm/msm/dp: reinit video_comp and guard stream state on link maintenance Gianfranco Mariotti
2026-12-03  0:03   ` sashiko-bot
2026-12-02 23:46 ` [PATCH v3 05/11] drm/msm/dp: avoid synchronous runtime PM put from HPD IRQ thread Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 06/11] drm/msm/dp: track DP_SINK_COUNT capability and sync prev_sink_count Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 07/11] drm/msm/dp: fix HPD plugged, AUX gate, and runtime PM tracking Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 08/11] drm/msm/dp: keep PHY initialized while plugged across link unprepare Gianfranco Mariotti
2026-12-03  0:17   ` sashiko-bot
2026-12-02 23:46 ` [PATCH v3 09/11] drm/msm/dp: re-read EDID on demand in get_modes when blob is missing Gianfranco Mariotti
2026-12-02 23:46 ` [PATCH v3 10/11] drm/msm/dp: guard internal HPD state checks when external HPD is used Gianfranco Mariotti
2026-12-03  0:04   ` sashiko-bot [this message]
2026-12-02 23:46 ` [PATCH v3 11/11] drm/msm/dp: dispatch native IRQ_HPD directly to msm_dp_irq_hpd_handle() Gianfranco Mariotti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-246796@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gianfranco.mariotti94@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.