Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/meson/dw-hdmi: convert to of_drm_find_and_get_bridge()

of_drm_find_bridge() is deprecated. Move to its replacement
of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
is put when done.

dw_hdmi->bridge is used only in dw_hdmi_top_thread_irq(), so in order to
avoid potential use-after-free ensure the irq is freed before putting the
dw_hdmi->bridge reference.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20260109-drm-bridge-alloc-getput-drm_of_find_bridge-3-v2-2-8d7a3dbacdf4@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

+5 -1
+5 -1
drivers/gpu/drm/meson/meson_dw_hdmi.c
··· 778 778 if (IS_ERR(meson_dw_hdmi->hdmi)) 779 779 return PTR_ERR(meson_dw_hdmi->hdmi); 780 780 781 - meson_dw_hdmi->bridge = of_drm_find_bridge(pdev->dev.of_node); 781 + meson_dw_hdmi->bridge = of_drm_find_and_get_bridge(pdev->dev.of_node); 782 782 783 783 DRM_DEBUG_DRIVER("HDMI controller initialized\n"); 784 784 ··· 789 789 void *data) 790 790 { 791 791 struct meson_dw_hdmi *meson_dw_hdmi = dev_get_drvdata(dev); 792 + struct platform_device *pdev = to_platform_device(dev); 793 + int irq = platform_get_irq(pdev, 0); 792 794 795 + devm_free_irq(dev, irq, meson_dw_hdmi); 793 796 dw_hdmi_unbind(meson_dw_hdmi->hdmi); 797 + drm_bridge_put(meson_dw_hdmi->bridge); 794 798 } 795 799 796 800 static const struct component_ops meson_dw_hdmi_ops = {