From: sashiko-bot@kernel.org
To: "AngeloGioacchino Del Regno" <angelogioacchino.delregno@collabora.com>
Cc: conor+dt@kernel.org, neil.armstrong@linaro.org, vkoul@kernel.org,
linux-phy@lists.infradead.org, robh@kernel.org,
dri-devel@lists.freedesktop.org, olteanv@gmail.com,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 05/12] phy: phy-mtk-dp: Implement power_on and power_off PHY callbacks
Date: Tue, 07 Jul 2026 14:33:10 +0000 [thread overview]
Message-ID: <20260707143310.E1D5D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260707141931.191172-6-angelogioacchino.delregno@collabora.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
New issues:
- [Medium] mtk_dp_phy_power_off() aborts early on regmap_set_bits failure, leaving the RX channel perpetually enabled.
- [Medium] Missing check for device_get_match_data() returning NULL in mtk_dp_phy_probe, leading to a crash in PHY operations.
- [Low] Undeclared variable 'ret' in mtk_dp_phy_probe() causes a strict build failure.
Pre-existing issues:
- [High] Dereferencing dev->platform_data without checking for NULL in mtk_dp_phy_legacy_probe leads to a kernel panic.
--
--- Patch [5]: [PATCH v2 05/12] phy: phy-mtk-dp: Implement power_on and power_off PHY callbacks ---
commit db273838783f1ea341d7728660183966ad3c4d16
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
phy: phy-mtk-dp: Implement power_on and power_off PHY callbacks
This commit adds .power_on() and .power_off() callbacks to the DisplayPort
PHY operations. These additions allow the DisplayPort driver to use the
phy_power_on() and phy_power_off() APIs instead of hardcoded register writes.
> diff --git a/drivers/phy/mediatek/phy-mtk-dp.c b/drivers/phy/mediatek/phy-mtk-dp.c
> index 915f148325c49..0c3f06791613a 100644
> --- a/drivers/phy/mediatek/phy-mtk-dp.c
> +++ b/drivers/phy/mediatek/phy-mtk-dp.c
[ ... ]
> @@ -200,6 +225,59 @@ static int mtk_dp_phy_configure(struct phy *phy, union phy_configure_opts *opts)
> return 0;
> }
>
> +static int mtk_dp_phy_power_on(struct phy *phy)
> +{
[ ... ]
> +static int mtk_dp_phy_power_off(struct phy *phy)
> +{
> + struct mtk_dp_phy *dp_phy = phy_get_drvdata(phy);
> + const struct mtk_dp_phy_pdata *pdata = dp_phy->pdata;
> + const u8 *regs_dig = pdata->regs_dig_glb;
> + const u8 *regs_ana = pdata->regs_ana_glb;
> + int ret;
> +
> + ret = regmap_set_bits(dp_phy->regmap,
> + pdata->off_ana_glb + regs_ana[DP_PHYA_GLB_FORCE_CTRL_1],
> + CKM_CKTX0_EN_FORCE_MODE);
> + if (ret)
> + return ret;
[Severity: Medium]
If regmap_set_bits() fails and returns early, could this leave the hardware
RX channel powered on indefinitely?
Teardown steps usually proceed on a best-effort basis to ensure subsequent
hardware disable operations are executed.
> +
> + /* Disable RX */
> + ret = regmap_write(dp_phy->regmap,
> + pdata->off_dig_glb + regs_dig[DP_PHYD_AUX_RX_CTL], 0);
[ ... ]
> @@ -319,8 +399,10 @@ static int mtk_dp_phy_probe(struct platform_device *pdev)
> }
[Severity: Low]
Does this code cause a build failure?
drivers/phy/mediatek/phy-mtk-dp.c:mtk_dp_phy_probe() {
...
ret = devm_pm_runtime_enable(dev);
if (ret)
return ret;
...
}
It appears the variable 'ret' is used but not declared.
[Severity: Medium]
Does this code need a NULL check for the return value of
device_get_match_data()?
drivers/phy/mediatek/phy-mtk-dp.c:mtk_dp_phy_probe() {
...
dp_phy->pdata = device_get_match_data(dev);
phy = devm_phy_create(dev, NULL, &mtk_dp_phy_dev_ops);
...
}
If the device is bound manually via sysfs and the compatible string doesn't
match, device_get_match_data() could return NULL, which might crash the
kernel in subsequent operations like mtk_dp_phy_power_on().
[Severity: High]
This is a pre-existing issue, but does dereferencing dev->platform_data
without checking for NULL in mtk_dp_phy_legacy_probe() lead to a crash?
drivers/phy/mediatek/phy-mtk-dp.c:mtk_dp_phy_legacy_probe() {
...
dp_phy->regmap = *(struct regmap **)dev->platform_data;
if (!dp_phy->regmap)
return dev_err_probe(dev, -EINVAL, "No platform data available\n");
...
}
If pdev->dev.platform_data is NULL, the blind pointer dereference happens
before the sanity check is reached.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260707141931.191172-1-angelogioacchino.delregno@collabora.com?part=5
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "AngeloGioacchino Del Regno" <angelogioacchino.delregno@collabora.com>
Cc: conor+dt@kernel.org, neil.armstrong@linaro.org, vkoul@kernel.org,
linux-phy@lists.infradead.org, robh@kernel.org,
dri-devel@lists.freedesktop.org, olteanv@gmail.com,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 05/12] phy: phy-mtk-dp: Implement power_on and power_off PHY callbacks
Date: Tue, 07 Jul 2026 14:33:10 +0000 [thread overview]
Message-ID: <20260707143310.E1D5D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260707141931.191172-6-angelogioacchino.delregno@collabora.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
New issues:
- [Medium] mtk_dp_phy_power_off() aborts early on regmap_set_bits failure, leaving the RX channel perpetually enabled.
- [Medium] Missing check for device_get_match_data() returning NULL in mtk_dp_phy_probe, leading to a crash in PHY operations.
- [Low] Undeclared variable 'ret' in mtk_dp_phy_probe() causes a strict build failure.
Pre-existing issues:
- [High] Dereferencing dev->platform_data without checking for NULL in mtk_dp_phy_legacy_probe leads to a kernel panic.
--
--- Patch [5]: [PATCH v2 05/12] phy: phy-mtk-dp: Implement power_on and power_off PHY callbacks ---
commit db273838783f1ea341d7728660183966ad3c4d16
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
phy: phy-mtk-dp: Implement power_on and power_off PHY callbacks
This commit adds .power_on() and .power_off() callbacks to the DisplayPort
PHY operations. These additions allow the DisplayPort driver to use the
phy_power_on() and phy_power_off() APIs instead of hardcoded register writes.
> diff --git a/drivers/phy/mediatek/phy-mtk-dp.c b/drivers/phy/mediatek/phy-mtk-dp.c
> index 915f148325c49..0c3f06791613a 100644
> --- a/drivers/phy/mediatek/phy-mtk-dp.c
> +++ b/drivers/phy/mediatek/phy-mtk-dp.c
[ ... ]
> @@ -200,6 +225,59 @@ static int mtk_dp_phy_configure(struct phy *phy, union phy_configure_opts *opts)
> return 0;
> }
>
> +static int mtk_dp_phy_power_on(struct phy *phy)
> +{
[ ... ]
> +static int mtk_dp_phy_power_off(struct phy *phy)
> +{
> + struct mtk_dp_phy *dp_phy = phy_get_drvdata(phy);
> + const struct mtk_dp_phy_pdata *pdata = dp_phy->pdata;
> + const u8 *regs_dig = pdata->regs_dig_glb;
> + const u8 *regs_ana = pdata->regs_ana_glb;
> + int ret;
> +
> + ret = regmap_set_bits(dp_phy->regmap,
> + pdata->off_ana_glb + regs_ana[DP_PHYA_GLB_FORCE_CTRL_1],
> + CKM_CKTX0_EN_FORCE_MODE);
> + if (ret)
> + return ret;
[Severity: Medium]
If regmap_set_bits() fails and returns early, could this leave the hardware
RX channel powered on indefinitely?
Teardown steps usually proceed on a best-effort basis to ensure subsequent
hardware disable operations are executed.
> +
> + /* Disable RX */
> + ret = regmap_write(dp_phy->regmap,
> + pdata->off_dig_glb + regs_dig[DP_PHYD_AUX_RX_CTL], 0);
[ ... ]
> @@ -319,8 +399,10 @@ static int mtk_dp_phy_probe(struct platform_device *pdev)
> }
[Severity: Low]
Does this code cause a build failure?
drivers/phy/mediatek/phy-mtk-dp.c:mtk_dp_phy_probe() {
...
ret = devm_pm_runtime_enable(dev);
if (ret)
return ret;
...
}
It appears the variable 'ret' is used but not declared.
[Severity: Medium]
Does this code need a NULL check for the return value of
device_get_match_data()?
drivers/phy/mediatek/phy-mtk-dp.c:mtk_dp_phy_probe() {
...
dp_phy->pdata = device_get_match_data(dev);
phy = devm_phy_create(dev, NULL, &mtk_dp_phy_dev_ops);
...
}
If the device is bound manually via sysfs and the compatible string doesn't
match, device_get_match_data() could return NULL, which might crash the
kernel in subsequent operations like mtk_dp_phy_power_on().
[Severity: High]
This is a pre-existing issue, but does dereferencing dev->platform_data
without checking for NULL in mtk_dp_phy_legacy_probe() lead to a crash?
drivers/phy/mediatek/phy-mtk-dp.c:mtk_dp_phy_legacy_probe() {
...
dp_phy->regmap = *(struct regmap **)dev->platform_data;
if (!dp_phy->regmap)
return dev_err_probe(dev, -EINVAL, "No platform data available\n");
...
}
If pdev->dev.platform_data is NULL, the blind pointer dereference happens
before the sanity check is reached.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260707141931.191172-1-angelogioacchino.delregno@collabora.com?part=5
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-07-07 14:33 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 14:19 [PATCH v2 00/12] PHY: MediaTek DP PHY refactor and MT8196 eDP AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:19 ` [PATCH v2 01/12] dt-bindings: phy: Document MT8195 and MT8196 DisplayPort PHYs AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:35 ` sashiko-bot
2026-07-07 14:35 ` sashiko-bot
2026-07-07 14:19 ` [PATCH v2 02/12] phy: phy-mtk-dp: Rename regs to regmap in struct mtk_dp_phy AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:27 ` sashiko-bot
2026-07-07 14:27 ` sashiko-bot
2026-07-07 14:19 ` [PATCH v2 03/12] phy: phy-mtk-dp: Allow probing with devicetree match AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:31 ` sashiko-bot
2026-07-07 14:31 ` sashiko-bot
2026-07-07 14:19 ` [PATCH v2 04/12] phy: phy-mtk-dp: Migrate register offsets to SoC specific pdata AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:34 ` sashiko-bot
2026-07-07 14:34 ` sashiko-bot
2026-07-07 14:19 ` [PATCH v2 05/12] phy: phy-mtk-dp: Implement power_on and power_off PHY callbacks AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:33 ` sashiko-bot [this message]
2026-07-07 14:33 ` sashiko-bot
2026-07-07 14:19 ` [PATCH v2 06/12] phy: phy-mtk-dp: Support set_lanes in configure and properly cleanup AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:34 ` sashiko-bot
2026-07-07 14:34 ` sashiko-bot
2026-07-07 14:19 ` [PATCH v2 07/12] phy: phy-mtk-dp: Support setting volt swing and preemphasis values AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:33 ` sashiko-bot
2026-07-07 14:33 ` sashiko-bot
2026-07-07 14:19 ` [PATCH v2 08/12] phy: phy-mtk-dp: Add support for digital and analog calibration AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:31 ` sashiko-bot
2026-07-07 14:31 ` sashiko-bot
2026-07-07 14:19 ` [PATCH v2 09/12] phy: phy-mtk-dp: Rewrite and document default driving param macros AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:28 ` sashiko-bot
2026-07-07 14:28 ` sashiko-bot
2026-07-07 14:19 ` [PATCH v2 10/12] phy: phy-mtk-dp: Add bitrate register val definitions to SoC data AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:19 ` [PATCH v2 11/12] phy: phy-mtk-dp: Add PHYD Lane EN register mask " AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
2026-07-07 14:19 ` [PATCH v2 12/12] phy: phy-mtk-dp: Add support for MT8196 eDP PHY AngeloGioacchino Del Regno
2026-07-07 14:19 ` AngeloGioacchino Del Regno
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=20260707143310.E1D5D1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.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 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.