[PATCH v7 4/7] drm/bridge: aux: Add drm_aux_bridge_register_from_node()

sashiko-bot at kernel.org sashiko-bot at kernel.org
Fri Aug 28 01:57:20 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing OF node reference acquisition for explicitly provided device_node `np`, leading to a reference count underflow when the device is destroyed or initialization fails.
--

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

drm/bridge: aux: Add drm_aux_bridge_register_from_node()

This commit adds a new function, drm_aux_bridge_register_from_node(),
which allows specifying the of_node corresponding to the bridge when
creating a simple DRM bridge device.

> diff --git a/drivers/gpu/drm/bridge/aux-bridge.c b/drivers/gpu/drm/bridge/aux-bridge.c
> index 1ed21a8713bfd..06a1466f49bd2 100644
> --- a/drivers/gpu/drm/bridge/aux-bridge.c
> +++ b/drivers/gpu/drm/bridge/aux-bridge.c
[ ... ]
> @@ -62,7 +63,10 @@ int drm_aux_bridge_register(struct device *parent)
>  	adev->dev.parent = parent;
>  	adev->dev.release = drm_aux_bridge_release;
>  
> -	device_set_of_node_from_dev(&adev->dev, parent);
> +	if (np)
> +		device_set_node(&adev->dev, of_fwnode_handle(np));

[Severity: High]
Does this miss a reference increment for the device node?

Looking at drivers/base/core.c, device_set_node() simply assigns the
pointer without taking a reference, whereas device_set_of_node_from_dev()
internally calls of_node_get(dev2->of_node).

> +	else
> +		device_set_of_node_from_dev(&adev->dev, parent);
>  
>  	ret = auxiliary_device_init(adev);
>  	if (ret) {
> 		of_node_put(adev->dev.of_node);

[Severity: High]
If np was provided and auxiliary_device_init() fails, won't this drop a
reference that was never acquired?

The same reference count underflow appears to happen during normal teardown
in drm_aux_bridge_release(), which will also unconditionally call
of_node_put() on a node that didn't have its reference count incremented
here. Should an explicit of_node_get(np) be used before assigning it?

[ ... ]

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



More information about the linux-phy mailing list