[PATCH v8 6/7] drm/rockchip: cdn-dp: Support handle lane info without extcon

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Oct 20 01:52:10 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/rockchip: cdn-dp: unguarded PTR_ERR() in cdn_dp_probe() breaks extcon
--

commit 1cf3e3cfbcc79fdbf3996fd0993b72d987bbcf59
Author: Chaoyi Chen <chaoyi.chen at rock-chips.com>

drm/rockchip: cdn-dp: Support handle lane info without extcon

This patch updates the Rockchip cdn-dp driver to allow operating without an
extcon device by retrieving lane count information directly from the PHY
while preserving existing extcon support.

> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> index 68aa66915e8ac..1c1c1116b5ebe 100644
> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c

[ ... ]

> @@ -1122,14 +1131,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)
>  			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;

[Severity: High]
When an extcon phandle is present in Device Tree and resolved,
extcon_get_edev_by_phandle() returns a valid struct extcon_dev pointer
rather than an error pointer.

Because PTR_ERR(extcon) != -ENODEV is evaluated in cdn_dp_probe() without
first checking IS_ERR(extcon), any valid extcon pointer will satisfy
PTR_ERR(extcon) != -ENODEV and hit the continue statement.

Doesn't this skip every port that has a valid extcon device, making the
non-NULL branch of IS_ERR(extcon) ? NULL : extcon unreachable and causing
cdn_dp_probe() to fail with -EINVAL on boards that use extcon? Should the
check in cdn_dp_probe() be:

	if (IS_ERR(phy) || (IS_ERR(extcon) && PTR_ERR(extcon) != -ENODEV))
		continue;

instead?

титься

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261020072816.180-1-kernel@airkyi.com?part=6



More information about the linux-phy mailing list