[PATCH 4/5] drm/rockchip: cdn-dp: Support handle lane info without extcon
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Wed May 20 22:49:27 PDT 2026
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The condition `PTR_ERR(extcon) != -ENODEV` in `cdn_dp_probe()` evaluates to true for valid `extcon` pointers, breaking initialization for devices with `extcon`.
--
commit 1c12cc989734f906a15b7d45d90d57d21f55c2d3
Author: Chaoyi Chen <chaoyi.chen at rock-chips.com>
drm/rockchip: cdn-dp: Support handle lane info without extcon
This commit adds support for getting PHY lane information directly from the
PHY instead of relying on extcon when a Type-C controller is present. It
updates the probe, bind, and phy enable paths to allow operation without
an extcon device, while intending to keep extcon supported for older setups.
> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> index 177e30445ee83..9068118859e21 100644
> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
[ ... ]
> @@ -1121,14 +1130,14 @@ static int cdn_dp_probe(struct platform_device *pdev)
> PTR_ERR(phy) == -EPROBE_DEFER)
> return -EPROBE_DEFER;
>
> - if (IS_ERR(extcon) || IS_ERR(phy))
> + if (IS_ERR(phy) || PTR_ERR(extcon) != -ENODEV)
[Severity: High]
Does this condition inadvertently skip port initialization for valid extcon
devices?
When extcon_get_edev_by_phandle() successfully returns a valid pointer,
PTR_ERR(extcon) evaluates to the pointer's memory address. Since a valid
pointer address is not equal to -ENODEV, this condition will evaluate to
true and trigger the continue statement.
This appears to break enumeration for all existing devices that use an extcon
by unconditionally skipping their setup.
Would it be better to ensure we only check the error code when the pointer
is actually an error?
if (IS_ERR(phy) || (IS_ERR(extcon) && PTR_ERR(extcon) != -ENODEV))
> continue;
>
> port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
> if (!port)
> return -ENOMEM;
>
> - port->extcon = extcon;
> + port->extcon = IS_ERR(extcon) ? NULL : extcon;
> port->phy = phy;
> port->dp = dp;
> port->id = i;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260521032854.103-1-kernel@airkyi.com?part=4
More information about the linux-phy
mailing list