All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Saurabh Anand" <saurabh.anand@oss.qualcomm.com>
Cc: olteanv@gmail.com, vkoul@kernel.org,
	linux-phy@lists.infradead.org, neil.armstrong@linaro.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/4] drm/msm/dp: skip LTTPR init when no LTTPRs are present
Date: Mon, 24 Aug 2026 11:35:36 +0000	[thread overview]
Message-ID: <20260824113537.4E3C21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260824-qcom-dp-typec-reconnect-fixes-v1-3-2825e5bf8a96@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Skipping `drm_dp_lttpr_init()` for negative `lttpr_count` bypasses the required LTTPR transparent mode fallback and is based on a flawed premise.
--

--- Patch [3]: [PATCH 3/4] drm/msm/dp: skip LTTPR init when no LTTPRs are present ---
commit 586e314c50820df2341a91e8a30d3963d3346281
Author: Saurabh Anand <saurabh.anand@oss.qualcomm.com>

drm/msm/dp: skip LTTPR init when no LTTPRs are present

This patch adds an early return when drm_dp_lttpr_count() returns a zero or
negative value. The goal is to skip LTTPR initialization when no repeaters
are detected or an error occurs reading the count.

> drm_dp_lttpr_count() returns 0 when no LTTPRs are detected and a
> negative value on error. The previous code passed the result directly
> to drm_dp_lttpr_init() without checking, which would call into the
> LTTPR transparency-mode setup with a zero or negative repeater count.

Is this description of drm_dp_lttpr_init() accurate?

Looking at drm_dp_lttpr_init(), it safely returns 0 on its own if
lttpr_count is zero:

int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count)
{
	int ret;

	if (!lttpr_count)
		return 0;
	...
}

It appears it already avoids calling into the transparency-mode setup
when the count is zero.

> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -253,6 +253,10 @@ static int msm_dp_display_lttpr_init(struct msm_dp_display_private *dp, u8 *dpcd
>  		return 0;
>  
>  	lttpr_count = drm_dp_lttpr_count(dp->link->lttpr_common_caps);
> +
> +	if (lttpr_count <= 0)
> +		return 0;
> +

[Severity: Medium]
Does skipping drm_dp_lttpr_init() for negative counts bypass the required
transparent mode fallback for non-compliant repeaters?

Looking at drm_dp_lttpr_init() in drivers/gpu/drm/display/drm_dp_helper.c,
it relies on receiving negative counts to trigger its fallback logic:

int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count)
{
	...
	ret = drm_dp_lttpr_set_transparent_mode(aux, true);
	if (ret)
		return ret;

	if (lttpr_count < 0)
		return -ENODEV;
	...
}

When lttpr_count is negative (e.g., -ERANGE or -EINVAL), the early return in
msm_dp_display_lttpr_init() causes the fallback to force transparent mode to
be entirely skipped. Could this cause link training to fail on setups with
non-compliant LTTPRs where the repeater count is invalid?

>  	rc = drm_dp_lttpr_init(dp->aux, lttpr_count);
>  	if (rc) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260824-qcom-dp-typec-reconnect-fixes-v1-0-2825e5bf8a96@oss.qualcomm.com?part=3

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Saurabh Anand" <saurabh.anand@oss.qualcomm.com>
Cc: olteanv@gmail.com, vkoul@kernel.org,
	linux-phy@lists.infradead.org, neil.armstrong@linaro.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/4] drm/msm/dp: skip LTTPR init when no LTTPRs are present
Date: Mon, 24 Aug 2026 11:35:36 +0000	[thread overview]
Message-ID: <20260824113537.4E3C21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260824-qcom-dp-typec-reconnect-fixes-v1-3-2825e5bf8a96@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Skipping `drm_dp_lttpr_init()` for negative `lttpr_count` bypasses the required LTTPR transparent mode fallback and is based on a flawed premise.
--

--- Patch [3]: [PATCH 3/4] drm/msm/dp: skip LTTPR init when no LTTPRs are present ---
commit 586e314c50820df2341a91e8a30d3963d3346281
Author: Saurabh Anand <saurabh.anand@oss.qualcomm.com>

drm/msm/dp: skip LTTPR init when no LTTPRs are present

This patch adds an early return when drm_dp_lttpr_count() returns a zero or
negative value. The goal is to skip LTTPR initialization when no repeaters
are detected or an error occurs reading the count.

> drm_dp_lttpr_count() returns 0 when no LTTPRs are detected and a
> negative value on error. The previous code passed the result directly
> to drm_dp_lttpr_init() without checking, which would call into the
> LTTPR transparency-mode setup with a zero or negative repeater count.

Is this description of drm_dp_lttpr_init() accurate?

Looking at drm_dp_lttpr_init(), it safely returns 0 on its own if
lttpr_count is zero:

int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count)
{
	int ret;

	if (!lttpr_count)
		return 0;
	...
}

It appears it already avoids calling into the transparency-mode setup
when the count is zero.

> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -253,6 +253,10 @@ static int msm_dp_display_lttpr_init(struct msm_dp_display_private *dp, u8 *dpcd
>  		return 0;
>  
>  	lttpr_count = drm_dp_lttpr_count(dp->link->lttpr_common_caps);
> +
> +	if (lttpr_count <= 0)
> +		return 0;
> +

[Severity: Medium]
Does skipping drm_dp_lttpr_init() for negative counts bypass the required
transparent mode fallback for non-compliant repeaters?

Looking at drm_dp_lttpr_init() in drivers/gpu/drm/display/drm_dp_helper.c,
it relies on receiving negative counts to trigger its fallback logic:

int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count)
{
	...
	ret = drm_dp_lttpr_set_transparent_mode(aux, true);
	if (ret)
		return ret;

	if (lttpr_count < 0)
		return -ENODEV;
	...
}

When lttpr_count is negative (e.g., -ERANGE or -EINVAL), the early return in
msm_dp_display_lttpr_init() causes the fallback to force transparent mode to
be entirely skipped. Could this cause link training to fail on setups with
non-compliant LTTPRs where the repeater count is invalid?

>  	rc = drm_dp_lttpr_init(dp->aux, lttpr_count);
>  	if (rc) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260824-qcom-dp-typec-reconnect-fixes-v1-0-2825e5bf8a96@oss.qualcomm.com?part=3

  reply	other threads:[~2026-08-24 11:35 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 11:28 [PATCH 0/4] drm/msm/dp, phy: qcom: improve DP Type-C reconnect handling Saurabh Anand
2026-08-24 11:28 ` Saurabh Anand
2026-08-24 11:28 ` [PATCH 1/4] phy: qcom: qmp-combo: delay Type-C mux switch while DP PHY is initializing Saurabh Anand
2026-08-24 11:28   ` Saurabh Anand
2026-08-24 11:44   ` sashiko-bot
2026-08-24 11:44     ` sashiko-bot
2026-09-02  7:48   ` Manivannan Sadhasivam
2026-09-02  7:48     ` Manivannan Sadhasivam
2026-09-07  9:47     ` Saurabh Anand
2026-09-07  9:47       ` Saurabh Anand
2026-09-13 21:36   ` Dmitry Baryshkov
2026-09-13 21:36     ` Dmitry Baryshkov
2026-08-24 11:28 ` [PATCH 2/4] drm/msm/dp: clear force_link_train flag when link training succeeds Saurabh Anand
2026-08-24 11:28   ` Saurabh Anand
2026-08-24 11:40   ` sashiko-bot
2026-08-24 11:40     ` sashiko-bot
2026-08-24 13:17   ` Konrad Dybcio
2026-08-24 13:17     ` Konrad Dybcio
2026-09-07  9:35     ` Saurabh Anand
2026-09-07  9:35       ` Saurabh Anand
2026-10-04 10:04       ` Oleg Keri
2026-10-04 10:04         ` Oleg Keri
2026-08-24 11:28 ` [PATCH 3/4] drm/msm/dp: skip LTTPR init when no LTTPRs are present Saurabh Anand
2026-08-24 11:28   ` Saurabh Anand
2026-08-24 11:35   ` sashiko-bot [this message]
2026-08-24 11:35     ` sashiko-bot
2026-08-24 13:15   ` Konrad Dybcio
2026-08-24 13:15     ` Konrad Dybcio
2026-09-07  9:44     ` Saurabh Anand
2026-09-07  9:44       ` Saurabh Anand
2026-09-13 21:39       ` Dmitry Baryshkov
2026-09-13 21:39         ` Dmitry Baryshkov
2026-08-24 11:28 ` [PATCH 4/4] drm/msm/dp: continue link training downgrade when cable is still plugged Saurabh Anand
2026-08-24 11:28   ` Saurabh Anand
2026-08-24 11:40   ` sashiko-bot
2026-08-24 11:40     ` sashiko-bot
2026-09-13 21:42   ` Dmitry Baryshkov
2026-09-13 21:42     ` 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=20260824113537.4E3C21F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=saurabh.anand@oss.qualcomm.com \
    --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 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.