anx7625_parse_dt() obtains a reference to the MIPI host node and keeps it in the platform data for DSI host lookup. Neither the probe failure paths nor device removal release this reference. The existing put before looking up the node only releases a previously stored value. The platform data is freshly allocated for each probe, so that does not release the reference acquired by the current probe. Register a managed action to put the node when probe fails or the device is removed. Drop the put of the initially empty platform data field. Fixes: 8bdfc5dae4e3 ("drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP") Cc: stable@vger.kernel.org Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex Signed-off-by: Wentao Liang --- drivers/gpu/drm/bridge/analogix/anx7625.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index c3af88e14f8b..3ee22f5f7bc2 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1841,6 +1841,11 @@ static int anx7625_get_swing_setting(struct device *dev, return 0; } +static void anx7625_put_mipi_host_node(void *data) +{ + of_node_put(data); +} + static int anx7625_parse_dt(struct device *dev, struct anx7625_platform_data *pdata) { @@ -1850,7 +1855,6 @@ static int anx7625_parse_dt(struct device *dev, anx7625_get_swing_setting(dev, pdata); pdata->is_dpi = 0; /* default dsi mode */ - of_node_put(pdata->mipi_host_node); pdata->mipi_host_node = of_graph_get_remote_node(np, 0, 0); if (!pdata->mipi_host_node) { DRM_DEV_ERROR(dev, "fail to get internal panel.\n"); @@ -1883,7 +1887,8 @@ static int anx7625_parse_dt(struct device *dev, if (of_property_read_bool(np, "analogix,audio-enable")) pdata->audio_en = 1; - return 0; + return devm_add_action_or_reset(dev, anx7625_put_mipi_host_node, + pdata->mipi_host_node); } static int anx7625_parse_dt_panel(struct device *dev, -- 2.34.1