From: Ronald Claveau <linux-kernel-dev@aliel.fr>
To: sashiko-reviews@lists.linux.dev
Cc: devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org,
linux-phy@lists.infradead.org, dri-devel@lists.freedesktop.org,
robh@kernel.org, conor+dt@kernel.org, neil.armstrong@linaro.org,
vkoul@kernel.org, olteanv@gmail.com
Subject: Re: [PATCH 04/10] phy: amlogic: Add Meson HDMI TX PHY driver
Date: Thu, 19 Nov 2026 17:29:51 +0100 [thread overview]
Message-ID: <8652ae36-7506-4fc2-b8ff-0b05a61dec63@aliel.fr> (raw)
In-Reply-To: <sashiko-outbox-219538@kernel.org>
On 11/17/26 20:58, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Medium] phy: amlogic: broken rate and submode check in
> meson_hdmi_phy_validate()
> --
>
> commit 0bf49ea77c864cdcf7af96e59e1ffba5194d9636
> Author: Ronald Claveau <linux-kernel-dev@aliel.fr>
>
> phy: amlogic: Add Meson HDMI TX PHY driver
>
> This commit adds a generic PHY driver for the HDMI TX PHY on Amlogic GXBB,
> GXL, GXM, and G12A SoCs, along with a legacy helper for device trees
> lacking a "phys" property.
>
>> diff --git a/drivers/phy/amlogic/phy-meson-hdmi-tx.c b/drivers/phy/amlogic/phy-meson-hdmi-tx.c
>> new file mode 100644
>> index 0000000000000..69833a080dc35
>> --- /dev/null
>> +++ b/drivers/phy/amlogic/phy-meson-hdmi-tx.c
> [ ... ]
>> +/* GXBB */
>> +static const struct meson_hdmi_phy_rate gxbb_rates[] = {
>> + /* 5.94Gbps, 3.7125Gbps */
>> + { 371250000, 0x33353245, 0x2100115b },
>> + /* 2.97Gbps */
>> + { 297000000, 0x33634283, 0xb000115b },
>> + /* 1.485Gbps, and below */
>> + { 0, 0x33632122, 0x2000115b },
>> +};
> [ ... ]
>> +static const struct meson_hdmi_phy_rate *
>> +meson_hdmi_phy_find_rate(const struct meson_hdmi_phy_data *data, u64 rate)
>> +{
>> + unsigned int i;
>> +
>> + for (i = 0; i < data->num_rates; i++)
>> + if (rate >= data->rates[i].min_rate)
>> + return &data->rates[i];
>> +
>> + return NULL;
>> +}
> [ ... ]
>> +static int meson_hdmi_phy_validate(struct phy *phy, enum phy_mode mode,
>> + int submode, union phy_configure_opts *opts)
>> +{
>> + struct meson_hdmi_phy *priv = phy_get_drvdata(phy);
>> +
>> + if (mode != PHY_MODE_HDMI)
>> + return -EINVAL;
>> +
>> + if (opts->hdmi.bpc != 8)
>> + return -EINVAL;
>> +
>> + if (!meson_hdmi_phy_find_rate(priv->data, opts->hdmi.tmds_char_rate))
>> + return -EINVAL;
>> +
>> + return 0;
>> +}
>
> [Severity: Medium]
> Can meson_hdmi_phy_find_rate() ever return NULL here?
>
> Every per-SoC rate table ends with an entry where min_rate is 0, and rate
> is an unsigned u64, so rate >= data->rates[i].min_rate is always true on
> the final entry. That makes the NULL return and the callers' NULL checks
> in meson_hdmi_phy_validate() and meson_hdmi_phy_configure() dead code, and
> meson_hdmi_phy_validate() accepts any tmds_char_rate value (including 0 Hz
> or rates above the 594 MHz hardware limit).
>
> In addition, meson_hdmi_phy_validate() does not check that submode is
> PHY_HDMI_MODE_TMDS before reading opts->hdmi.tmds_char_rate, which shares
> an anonymous union with opts->hdmi.frl when submode is PHY_HDMI_MODE_FRL.
>
I will add min_rate 25175000 in table end and a check on max_rate 600MHz
in v2.
--
Best regards,
Ronald
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-11-19 16:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 19:33 [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 01/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Fix compatible matching in conditionals Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 02/10] dt-bindings: phy: amlogic: Add Meson HDMI TX PHY binding Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 03/10] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Add hdmi-phy child node Ronald Claveau via B4 Relay
2026-11-17 19:39 ` sashiko-bot
2026-11-17 19:33 ` [PATCH 04/10] phy: amlogic: Add Meson HDMI TX PHY driver Ronald Claveau via B4 Relay
2026-11-17 19:58 ` sashiko-bot
2026-11-19 16:29 ` Ronald Claveau [this message]
2026-11-17 19:33 ` [PATCH 05/10] dt-bindings: display: amlogic,meson-dw-hdmi: Add phys and phy-names Ronald Claveau via B4 Relay
2026-11-18 12:34 ` Neil Armstrong
2026-11-18 19:10 ` linux-kernel-dev
2026-11-17 19:33 ` [PATCH 06/10] drm/meson: dw-hdmi: Drop manual HHI clock and memory PD setup Ronald Claveau via B4 Relay
2026-11-17 20:11 ` sashiko-bot
2026-11-19 15:30 ` Ronald Claveau
2026-11-17 19:33 ` [PATCH 07/10] drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY Ronald Claveau via B4 Relay
2026-11-17 20:03 ` sashiko-bot
2026-11-20 17:52 ` Ronald Claveau
2026-11-17 19:33 ` [PATCH 08/10] arm64: dts: amlogic: Add HDMI TX PHY node for G12 Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 09/10] arm64: dts: amlogic: Add HDMI TX PHY node for GXBB Ronald Claveau via B4 Relay
2026-11-17 19:33 ` [PATCH 10/10] arm64: dts: amlogic: Add HDMI TX PHY node for GXL Ronald Claveau via B4 Relay
2026-11-18 12:38 ` [PATCH 00/10] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Neil Armstrong
2026-11-18 19:35 ` linux-kernel-dev
2026-11-19 7:58 ` Neil Armstrong
2026-11-19 15:33 ` linux-kernel-dev
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=8652ae36-7506-4fc2-b8ff-0b05a61dec63@aliel.fr \
--to=linux-kernel-dev@aliel.fr \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-phy@lists.infradead.org \
--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
all inboxes | Powered by JetHome®