dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nabige Aala" <nabige.aala@oss.qualcomm.com>
Cc: olteanv@gmail.com, devicetree@vger.kernel.org, vkoul@kernel.org,
	linux-phy@lists.infradead.org, neil.armstrong@linaro.org,
	robh@kernel.org, dri-devel@lists.freedesktop.org,
	conor+dt@kernel.org
Subject: Re: [PATCH v2 06/13] drm/msm/dp: Add support for DP controllers on Nord
Date: Mon, 12 Oct 2026 13:47:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-168214@kernel.org> (raw)
In-Reply-To: <20261012-nord-drv-dt-v2-6-a2ab9af954d2@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] drm/msm/dp: logic typo in loop condition i < io_start
--

commit 9873fd55a5048fd6867334e37aee81635bc94b5a
Author: Mahadevan P <mahadevan.p@oss.qualcomm.com>

drm/msm/dp: Add support for DP controllers on Nord

This commit adds the Nord DP controller descriptors and compatible strings.
Nord supports four DP controllers, two per MDSS instance.

> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index bce641d7d8938..d258963cddc64 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -109,6 +109,14 @@ static const struct msm_dp_desc msm_dp_desc_glymur[] = {
>  	{}
>  };
>  
> +static const struct msm_dp_desc msm_dp_desc_nord[] = {
> +	{ .io_start = 0x0af54000, .id = MSM_DP_CONTROLLER_0, .wide_bus_supported = true },
> +	{ .io_start = 0x0af5c000, .id = MSM_DP_CONTROLLER_1, .wide_bus_supported = true },
> +	{ .io_start = 0x08d54000, .id = MSM_DP_CONTROLLER_0, .wide_bus_supported = true },
> +	{ .io_start = 0x08d5c000, .id = MSM_DP_CONTROLLER_1, .wide_bus_supported = true },
> +	{}
> +};

[Severity: Low]
Does this new DP controller configuration rely on a logic typo in the loop
condition of msm_dp_display_get_desc() to terminate safely?

Looking at msm_dp_display_get_desc(), the loop condition compares the
array index i against the physical memory address io_start:

	for (i = 0; i < descs[i].io_start; i++) {
		if (descs[i].io_start == res->start)
			return &descs[i];
	}

This regression in the loop logic appears to be a typo that should likely be
descs[i].io_start != 0.

The loop avoids crashing because physical memory addresses (like 0x0af54000)
are much larger than the index i, and the zero-initialized sentinel element {}
sets io_start to 0.

Since phys_addr_t is unsigned, checking i < 0 safely evaluates to false and
terminates the loop, but this logic is brittle and semantically incorrect.

Could the loop condition in msm_dp_display_get_desc() be corrected so that
newly added controller arrays do not rely on this unsigned comparison behavior
for termination?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261012-nord-drv-dt-v2-0-a2ab9af954d2@oss.qualcomm.com?part=6

  reply	other threads:[~2026-10-12 13:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 13:32 [PATCH v2 00/13] Add Qualcomm Nord display and eDP PHY support Nabige Aala
2026-10-12 13:32 ` [PATCH v2 01/13] dt-bindings: phy: qcom,edp-phy: Add DP PHY compatible for Nord Nabige Aala
2026-10-13  7:37   ` Krzysztof Kozlowski
2026-10-12 13:32 ` [PATCH v2 02/13] dt-bindings: display: msm: Document the Nord DiplayPort controller Nabige Aala
2026-10-13  7:44   ` Krzysztof Kozlowski
2026-10-13  8:48     ` Krzysztof Kozlowski
2026-10-12 13:32 ` [PATCH v2 03/13] dt-bindings: display/msm: Document Nord MDSS Nabige Aala
2026-10-12 13:45   ` sashiko-bot
2026-10-13  8:48   ` Krzysztof Kozlowski
2026-10-12 13:32 ` [PATCH v2 04/13] drm/msm/dpu: Add support for DPU 12.1 on Nord Nabige Aala
2026-10-13  9:28   ` Dmitry Baryshkov
2026-10-12 13:32 ` [PATCH v2 05/13] drm/msm: mdss: Add support for MDSS " Nabige Aala
2026-10-12 13:32 ` [PATCH v2 06/13] drm/msm/dp: Add support for DP controllers " Nabige Aala
2026-10-12 13:47   ` sashiko-bot [this message]
2026-10-12 14:01   ` Konrad Dybcio
2026-10-13  9:18   ` Dmitry Baryshkov
2026-10-12 13:32 ` [PATCH v2 07/13] phy: qcom: edp: Add Nord-specific register offsets Nabige Aala
2026-10-13  8:43   ` Abel Vesa
2026-10-13 10:19   ` Dmitry Baryshkov
2026-10-12 13:32 ` [PATCH v2 08/13] phy: qcom: edp: Generalize power-on path for per-SoC overrides Nabige Aala
2026-10-12 13:46   ` sashiko-bot
2026-10-13 10:26   ` Dmitry Baryshkov
2026-10-12 13:32 ` [PATCH v2 09/13] phy: qcom: edp: Add Nord voltage-swing and pre-emphasis tables Nabige Aala
2026-10-13  8:44   ` Abel Vesa
2026-10-13 10:27   ` Dmitry Baryshkov
2026-10-12 13:32 ` [PATCH v2 10/13] phy: qcom: edp: Add Nord spread-spectrum clocking configuration callback Nabige Aala
2026-10-13  8:47   ` Abel Vesa
2026-10-13 10:28   ` Dmitry Baryshkov
2026-10-12 13:32 ` [PATCH v2 11/13] phy: qcom: edp: Add Nord PLL " Nabige Aala
2026-10-12 13:32 ` [PATCH v2 12/13] phy: qcom: edp: Add Nord PHY configuration data tables Nabige Aala
2026-10-12 13:43   ` sashiko-bot
2026-10-13 10:33   ` Dmitry Baryshkov
2026-10-12 13:32 ` [PATCH v2 13/13] phy: qcom: edp: Add Nord phy_cfg, ops and OF compatible Nabige Aala
2026-10-12 13:44   ` sashiko-bot

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-168214@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=nabige.aala@oss.qualcomm.com \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=robh@kernel.org \
    --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