dw_hdmi_parse_dt() takes a reference to the next bridge in the
pipeline with of_drm_find_and_get_bridge() and stores it in
hdmi->bridge.next_bridge, but neither the probe error paths nor the
driver teardown release it.  Drop the reference in the err_res label
of dw_hdmi_probe() and in dw_hdmi_remove().

Fixes: 4e7fd5aa3f39 ("drm/bridge: dw-hdmi: convert to 
of_drm_find_and_get_bridge()")
Signed-off-by: Wentao Liang <[email protected]>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 1da12e4616fe..3000572d99fe 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -3599,6 +3599,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device 
*pdev,
        return hdmi;
 
 err_res:
+       drm_bridge_put(hdmi->bridge.next_bridge);
        i2c_put_adapter(hdmi->ddc);
 
        return ERR_PTR(ret);
@@ -3608,6 +3609,7 @@ EXPORT_SYMBOL_GPL(dw_hdmi_probe);
 void dw_hdmi_remove(struct dw_hdmi *hdmi)
 {
        drm_bridge_remove(&hdmi->bridge);
+       drm_bridge_put(hdmi->bridge.next_bridge);
 
        if (hdmi->audio && !IS_ERR(hdmi->audio))
                platform_device_unregister(hdmi->audio);
-- 
2.34.1

Reply via email to