From: sashiko-bot@kernel.org
To: "naidu nama" <naidu.nama@oss.qualcomm.com>
Cc: linux-phy@lists.infradead.org, dri-devel@lists.freedesktop.org,
vkoul@kernel.org, neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH v2 3/3] drm/msm/dp: continue link training downgrade when cable is still plugged
Date: Wed, 11 Nov 2026 10:58:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-208838@kernel.org> (raw)
In-Reply-To: <20261111104434.2222182-4-naidu.nama@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/msm/dp: pass-by-value plugged in msm_dp_ctrl_on_link()
breaks unplug abort
- [Medium] drm/msm/dp: uninitialized link_status read in
msm_dp_ctrl_on_link()
--
commit 03d6b22aa9378458ab94c6193f79ad69b24cfe32
Author: Saurabh Anand <saurabh.anand@oss.qualcomm.com>
drm/msm/dp: continue link training downgrade when cable is still plugged
This commit passes dp->plugged into msm_dp_ctrl_on_link() so the link
training retry loop only aborts when both msm_dp_aux_is_link_connected()
and plugged are false.
> diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c
> index 6b9d9a76ba059..f8a6bd7b0d107 100644
> --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
> +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
[ ... ]
> @@ -2377,7 +2378,7 @@ static bool msm_dp_ctrl_channel_eq_ok(struct msm_dp_ctrl_private *ctrl)
> }
>
> int msm_dp_ctrl_on_link(struct msm_dp_ctrl *msm_dp_ctrl,
> - struct msm_dp_panel *panel)
> + struct msm_dp_panel *panel, bool plugged)
> {
> int rc = 0;
> struct msm_dp_ctrl_private *ctrl;
> @@ -2427,7 +2428,7 @@ 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) && !plugged)
> + if (!msm_dp_aux_is_link_connected(ctrl->aux) && !plugged)
> break;
[Severity: Medium]
Does passing dp->plugged by value into msm_dp_ctrl_on_link() prevent the
retry loop from ever breaking out on an unplug during link training?
At both callers (msm_dp_display_prepare_link() and
msm_dp_display_handle_irq_hpd()), dp->plugged is true when link training
starts, and msm_dp_display_prepare_link() also reads dp->plugged without
holding dp->plugged_lock. If the cable is unplugged while the retry loop is
running, msm_dp_hpd_unplug_handle() sets dp->plugged = false, but the local
plugged parameter in msm_dp_ctrl_on_link() stays true for every iteration,
so !plugged is always false and all remaining downshift retries and PHY
power-cycles still run on the disconnected link.
Also, the commit message refers to msm_dp_ctrl->plugged, which does not
exist in struct msm_dp_ctrl or struct msm_dp_ctrl_private.
>
> drm_dp_dpcd_read_link_status(ctrl->aux, link_status);
> @@ -2452,7 +2453,7 @@ 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) && !plugged)
> + if (!msm_dp_aux_is_link_connected(ctrl->aux) && !plugged)
> break;
>
> drm_dp_dpcd_read_link_status(ctrl->aux, link_status);
[Severity: Medium]
When continuing past !msm_dp_aux_is_link_connected(ctrl->aux) in the
DP_TRAINING_1 and DP_TRAINING_2 failure paths, can this read uninitialized
stack bytes from link_status[]?
link_status is declared on the stack without initialization in
msm_dp_ctrl_on_link(). When the AUX channel is transiently disconnected or
a concurrent unplug disables AUX transfers, drm_dp_dpcd_read_link_status()
fails without writing to link_status, and its return value is not checked
before msm_dp_ctrl_clock_recovery_any_ok() and drm_dp_clock_recovery_ok()
inspect link_status to choose between rate downshift, lane downshift, and
abort.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261111104434.2222182-1-naidu.nama@oss.qualcomm.com?part=3
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-11-11 10:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 10:43 [PATCH v2 0/3] drm/msm/dp, phy: qcom: improve DP Type-C reconnect handli naidu nama
2026-11-11 10:43 ` [PATCH v2 1/3] phy: qcom: qmp-combo: delay Type-C mux switch while DP PHY is initializing naidu nama
2026-11-11 11:03 ` sashiko-bot
2026-11-11 14:06 ` Dmitry Baryshkov
2026-11-11 10:43 ` [PATCH v2 2/3] drm/msm/dp: Remove redundant force_link_train flag naidu nama
2026-11-11 10:57 ` sashiko-bot
2026-11-11 14:06 ` Dmitry Baryshkov
2026-11-11 10:43 ` [PATCH v2 3/3] drm/msm/dp: continue link training downgrade when cable is still plugged naidu nama
2026-11-11 10:58 ` sashiko-bot [this message]
2026-11-11 14:08 ` Dmitry Baryshkov
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-208838@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-phy@lists.infradead.org \
--cc=naidu.nama@oss.qualcomm.com \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).