[PATCH v4 03/11] drm/msm/hdmi: switch to of_drm_get_bridge_by_endpoint()
Luca Ceresoli
luca.ceresoli at bootlin.com
Mon May 4 03:45:06 PDT 2026
This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
@panel parameter, thus using a reduced feature set of that function.
Replace this call with the simpler of_drm_get_bridge_by_endpoint().
Since of_drm_get_bridge_by_endpoint() increases the refcount of the
returned bridge, ensure it is put on removal.
Signed-off-by: Luca Ceresoli <luca.ceresoli at bootlin.com>
---
Changes in v4:
- ensure next_bridge is put on later probe failures
Changes in v3:
- fix ERR_PTR deref when -ENODEV is returned
---
drivers/gpu/drm/msm/hdmi/hdmi.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index d9491aac1a89..57e85ac38059 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -285,9 +285,14 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
spin_lock_init(&hdmi->reg_lock);
mutex_init(&hdmi->state_mutex);
- ret = drm_of_find_panel_or_bridge(dev_of_node(dev), 1, 0, NULL, &hdmi->next_bridge);
- if (ret && ret != -ENODEV)
- return ret;
+ struct drm_bridge *next_bridge __free(drm_bridge_put) =
+ of_drm_get_bridge_by_endpoint(dev_of_node(dev), 1, 0);
+ if (IS_ERR(next_bridge)) {
+ if (PTR_ERR(next_bridge) == -ENODEV)
+ next_bridge = NULL;
+ else
+ return PTR_ERR(next_bridge);
+ }
hdmi->mmio = msm_ioremap(pdev, "core_physical");
if (IS_ERR(hdmi->mmio))
@@ -367,6 +372,8 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
if (ret)
goto err_put_phy;
+ hdmi->next_bridge = no_free_ptr(next_bridge);
+
return 0;
err_put_phy:
@@ -381,6 +388,7 @@ static void msm_hdmi_dev_remove(struct platform_device *pdev)
component_del(&pdev->dev, &msm_hdmi_ops);
msm_hdmi_put_phy(hdmi);
+ drm_bridge_put(hdmi->next_bridge);
}
static int msm_hdmi_runtime_suspend(struct device *dev)
--
2.53.0
More information about the linux-arm-kernel
mailing list