* [PATCH v1] drm/rockchip: rk3066_hdmi: convert to devm_drm_bridge_alloc() API
@ 2026-08-23 12:47 Johan Jonker
2026-08-23 12:58 ` sashiko-bot
2026-08-23 19:10 ` Heiko Stübner
0 siblings, 2 replies; 3+ messages in thread
From: Johan Jonker @ 2026-08-23 12:47 UTC (permalink / raw)
To: heiko
Cc: hjc, andy.yan, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, dri-devel, linux-rockchip, linux-arm-kernel, linux-kernel
The function devm_drm_bridge_alloc() is the new API for allocating DRM bridges.
This conversion was missed during the initial conversion of all bridges to
the new API.
Signed-off-by: Hüseyin BIYIK <boogiepop@gmx.com>
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---
drivers/gpu/drm/rockchip/rk3066_hdmi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.c b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
index f28d6a883e09..39c65ee07caa 100644
--- a/drivers/gpu/drm/rockchip/rk3066_hdmi.c
+++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
@@ -703,7 +703,6 @@ rk3066_hdmi_register(struct drm_device *drm, struct rk3066_hdmi *hdmi)
DRM_MODE_ENCODER_TMDS, NULL);
hdmi->bridge.driver_private = hdmi;
- hdmi->bridge.funcs = &rk3066_hdmi_bridge_funcs;
hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT |
DRM_BRIDGE_OP_EDID |
DRM_BRIDGE_OP_HDMI |
@@ -747,9 +746,10 @@ static int rk3066_hdmi_bind(struct device *dev, struct device *master,
int irq;
int ret;
- hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
- if (!hdmi)
- return -ENOMEM;
+ hdmi = devm_drm_bridge_alloc(dev, struct rk3066_hdmi, bridge,
+ &rk3066_hdmi_bridge_funcs);
+ if (IS_ERR(hdmi))
+ return PTR_ERR(hdmi);
hdmi->dev = dev;
hdmi->drm_dev = drm;
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] drm/rockchip: rk3066_hdmi: convert to devm_drm_bridge_alloc() API
2026-08-23 12:47 [PATCH v1] drm/rockchip: rk3066_hdmi: convert to devm_drm_bridge_alloc() API Johan Jonker
@ 2026-08-23 12:58 ` sashiko-bot
2026-08-23 19:10 ` Heiko Stübner
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-08-23 12:58 UTC (permalink / raw)
To: Johan Jonker; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Devres allocations in component bind() cause permanent initialization failure (-EBUSY) on probe deferral.
- [High] Active devm-managed IRQ and I2C handlers access hardware with the clock disabled after unbind(), causing a system crash.
--
--- Patch [1]: [PATCH v1] drm/rockchip: rk3066_hdmi: convert to devm_drm_bridge_alloc() API ---
commit 2ee09d3b212b24956cbceb44c6bf494785f5586d
Author: Johan Jonker <jbx6244@gmail.com>
drm/rockchip: rk3066_hdmi: convert to devm_drm_bridge_alloc() API
The function devm_drm_bridge_alloc() is the new API for allocating DRM
bridges. This conversion was missed during the initial conversion of all
bridges to the new API.
> diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.c b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
> index f28d6a883e099..39c65ee07caac 100644
> --- a/drivers/gpu/drm/rockchip/rk3066_hdmi.c
> +++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
[ ... ]
> @@ -747,9 +746,10 @@ static int rk3066_hdmi_bind(struct device *dev, struct device *master,
> int irq;
> int ret;
>
> - hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
> - if (!hdmi)
> - return -ENOMEM;
> + hdmi = devm_drm_bridge_alloc(dev, struct rk3066_hdmi, bridge,
> + &rk3066_hdmi_bridge_funcs);
> + if (IS_ERR(hdmi))
> + return PTR_ERR(hdmi);
[Severity: High]
This is a pre-existing issue, but does using devm_ allocations in the
component bind() function cause a permanent failure on probe deferral?
rk3066_hdmi_bind() allocates devres-managed resources using the component
device, including devm_platform_ioremap_resource() right below this hunk.
Devres actions are tied to the device's probe/remove lifecycle, not the
component bind/unbind lifecycle.
If bind() fails, for example when rk3066_hdmi_register() returns -EPROBE_DEFER
due to missing CRTCs, the devres resources are not freed.
When the master DRM device retries probing and calls bind() again,
devm_platform_ioremap_resource() will attempt to request the same physical
memory region via request_mem_region(). Because the first request was never
released by devres, this fails with -EBUSY, preventing the display from ever
initializing.
[Severity: High]
This is a pre-existing issue, but can the active devm-managed IRQ and I2C
handlers access hardware with the clock disabled after unbind(), causing a
system crash?
In rk3066_hdmi_bind(), the HDMI IRQ handler and I2C adapter are registered
using devm_request_threaded_irq() and devm_i2c_add_adapter() on the component
device.
Because they are devres-managed on the component device's probe/remove
lifecycle, they are not removed when the master DRM device unbinds and calls
rk3066_hdmi_unbind().
In rk3066_hdmi_unbind(), the hardware bus clock is explicitly disabled:
clk_disable_unprepare(hdmi->hclk);
If an I2C transfer is initiated from userspace (via /dev/i2c-*), or if a
shared IRQ fires after the master is unbound, the still-active handlers
(rk3066_hdmi_i2c_xfer or rk3066_hdmi_hardirq) will execute and access HDMI
hardware registers. Accessing hardware registers while the clock is disabled
causes a synchronous external abort (bus fault), resulting in a kernel panic.
>
> hdmi->dev = dev;
> hdmi->drm_dev = drm;
--
Sashiko AI review · https://sashiko.dev/#/patchset/dea8a038-577b-45da-bff3-703e9099b7e1@gmail.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] drm/rockchip: rk3066_hdmi: convert to devm_drm_bridge_alloc() API
2026-08-23 12:47 [PATCH v1] drm/rockchip: rk3066_hdmi: convert to devm_drm_bridge_alloc() API Johan Jonker
2026-08-23 12:58 ` sashiko-bot
@ 2026-08-23 19:10 ` Heiko Stübner
1 sibling, 0 replies; 3+ messages in thread
From: Heiko Stübner @ 2026-08-23 19:10 UTC (permalink / raw)
To: Johan Jonker
Cc: hjc, andy.yan, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, dri-devel, linux-rockchip, linux-arm-kernel, linux-kernel
Hi Johan,
Am Sonntag, 23. August 2026, 14:47:25 Mitteleuropäische Sommerzeit schrieb Johan Jonker:
> The function devm_drm_bridge_alloc() is the new API for allocating DRM bridges.
> This conversion was missed during the initial conversion of all bridges to
> the new API.
>
> Signed-off-by: Hüseyin BIYIK <boogiepop@gmx.com>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
the authorship is ambigous here. First Signed-off-by should be from the
patch author, yet this one makes you the author.
So either the author needs to change or the signed-off-by line
needs to go.
Heiko
> ---
> drivers/gpu/drm/rockchip/rk3066_hdmi.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.c b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
> index f28d6a883e09..39c65ee07caa 100644
> --- a/drivers/gpu/drm/rockchip/rk3066_hdmi.c
> +++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
> @@ -703,7 +703,6 @@ rk3066_hdmi_register(struct drm_device *drm, struct rk3066_hdmi *hdmi)
> DRM_MODE_ENCODER_TMDS, NULL);
>
> hdmi->bridge.driver_private = hdmi;
> - hdmi->bridge.funcs = &rk3066_hdmi_bridge_funcs;
> hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT |
> DRM_BRIDGE_OP_EDID |
> DRM_BRIDGE_OP_HDMI |
> @@ -747,9 +746,10 @@ static int rk3066_hdmi_bind(struct device *dev, struct device *master,
> int irq;
> int ret;
>
> - hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
> - if (!hdmi)
> - return -ENOMEM;
> + hdmi = devm_drm_bridge_alloc(dev, struct rk3066_hdmi, bridge,
> + &rk3066_hdmi_bridge_funcs);
> + if (IS_ERR(hdmi))
> + return PTR_ERR(hdmi);
>
> hdmi->dev = dev;
> hdmi->drm_dev = drm;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-23 19:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-23 12:47 [PATCH v1] drm/rockchip: rk3066_hdmi: convert to devm_drm_bridge_alloc() API Johan Jonker
2026-08-23 12:58 ` sashiko-bot
2026-08-23 19:10 ` Heiko Stübner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox