From: sashiko-bot@kernel.org
To: "AngeloGioacchino Del Regno" <angelogioacchino.delregno@collabora.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
dri-devel@lists.freedesktop.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 07/11] drm/mediatek: mtk_dp: Add support for PHY from devicetree
Date: Thu, 09 Jul 2026 11:13:22 +0000 [thread overview]
Message-ID: <20260709111323.6F4201F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709100617.42583-8-angelogioacchino.delregno@collabora.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Double-unregister of the `mediatek-dp-phy` platform device on `devm_phy_get` failure.
--
--- Patch [7]: [PATCH v2 07/11] drm/mediatek: mtk_dp: Add support for PHY from devicetree ---
commit 21392ccaeb903069c1e4a92500d58612e1669daf
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Subject: drm/mediatek: mtk_dp: Add support for PHY from devicetree
This commit adds support for parsing the DisplayPort PHY from the devicetree
via the phys property. For older devicetrees, it falls back to a legacy
configuration by registering a mediatek-dp-phy platform device and reading
legacy PHY calibration data.
> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
> index b4cb1996a3314..cabfc833c0a80 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
[ ... ]
> @@ -2754,6 +2775,7 @@ static int mtk_dp_register_phy(struct mtk_dp *mtk_dp)
> return dev_err_probe(dev, ret,
> "Failed to add phy unregister devm action");
>
> + /* PHY calibration data is in mtk_dp only for legacy devicetree */
> mtk_dp_get_calibration_data(mtk_dp);
>
> mtk_dp->phy = devm_phy_get(&mtk_dp->phy_dev->dev, "dp");
[Severity: High]
Does this code double-unregister the mediatek-dp-phy platform device?
Earlier in mtk_dp_register_phy(), mtk_dp->phy_dev is registered with devres:
ret = devm_add_action_or_reset(dev, mtk_dp_unregister_pdevs,
mtk_dp->phy_dev);
If devm_phy_get() fails immediately after the lines modified above:
mtk_dp->phy = devm_phy_get(&mtk_dp->phy_dev->dev, "dp");
if (IS_ERR(mtk_dp->phy)) {
platform_device_unregister(mtk_dp->phy_dev);
return dev_err_probe(dev, PTR_ERR(mtk_dp->phy),
"Failed to get phy\n");
}
It explicitly calls platform_device_unregister() on the failure path. Since
devres will also execute mtk_dp_unregister_pdevs() (which unregisters the
same device) when probe fails, can this lead to a double-free and list
corruption in the driver core?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709100617.42583-1-angelogioacchino.delregno@collabora.com?part=7
next prev parent reply other threads:[~2026-07-09 11:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 10:06 [PATCH v2 00/11] drm: MediaTek DisplayPort cleanups and MT8196 eDP AngeloGioacchino Del Regno
2026-07-09 10:06 ` [PATCH v2 01/11] dt-bindings: display: mediatek: dp: Deprecate nvmem efuse data AngeloGioacchino Del Regno
2026-07-09 10:06 ` [PATCH v2 02/11] dt-bindings: display: mediatek: dp: Add compatible for MT8196 eDP AngeloGioacchino Del Regno
2026-07-09 10:06 ` [PATCH v2 03/11] drm/mediatek: mtk_dp: Fix hdmi codec and phy driver unregistration AngeloGioacchino Del Regno
2026-07-09 10:20 ` sashiko-bot
2026-07-09 10:06 ` [PATCH v2 04/11] drm/mediatek: mtk_dp: Clarify SMC eDP/DP video unmute commands AngeloGioacchino Del Regno
2026-07-09 10:06 ` [PATCH v2 05/11] drm/mediatek: mtk_dp: Rework register offsets for proper PHY usage AngeloGioacchino Del Regno
2026-07-09 10:06 ` [PATCH v2 06/11] drm/mediatek: mtk_dp: Use PHY API for PHY power sequences AngeloGioacchino Del Regno
2026-07-09 10:55 ` sashiko-bot
2026-07-09 10:06 ` [PATCH v2 07/11] drm/mediatek: mtk_dp: Add support for PHY from devicetree AngeloGioacchino Del Regno
2026-07-09 11:13 ` sashiko-bot [this message]
2026-07-09 10:06 ` [PATCH v2 08/11] drm/mediatek: mtk_dp: Move max link rate to SoC specific data AngeloGioacchino Del Regno
2026-07-09 10:06 ` [PATCH v2 09/11] drm/mediatek: mtk_dp: Add support for HotPlug Detection in DP AUX AngeloGioacchino Del Regno
2026-07-09 11:32 ` sashiko-bot
2026-07-09 10:06 ` [PATCH v2 10/11] drm/mediatek: mtk_dp: Add support for eDP1.5 IPs and MT8196 SoC AngeloGioacchino Del Regno
2026-07-09 11:49 ` sashiko-bot
2026-07-09 10:06 ` [PATCH v2 11/11] drm/mediatek: mtk_dp: Clarify XTAL freq and Debounce registers AngeloGioacchino Del Regno
2026-07-09 11:56 ` 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=20260709111323.6F4201F000E9@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=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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