On 2025-10-29 07:41, Miaoqian Lin wrote:
The function samsung_dsim_parse_dt() calls of_graph_get_endpoint_by_regs() to get the endpoint device node, but fails to call of_node_put() to release the reference when the function returns. This results in a device node reference leak.
Fix this by adding the missing of_node_put() call before returning from the function.
Found via static analysis and code review.
Fixes: 77169a11d4e9 ("drm/bridge: samsung-dsim: add driver support for exynos7870 DSIM bridge")
Is the Fixes: tag correct? This is what I get for relevant code:
74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2074) endpoint = of_graph_get_endpoint_by_regs(node, 1, -1); 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2075) nr_lanes = of_property_count_u32_elems(endpoint, "data-lanes"); 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2076) if (nr_lanes > 0 && nr_lanes <= 4) { 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2077) /* Polarity 0 is clock lane, 1..4 are data lanes. */ 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2078) of_property_read_u32_array(endpoint, "lane-polarities", 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2079) lane_polarities, nr_lanes + 1); 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2080) for (i = 1; i <= nr_lanes; i++) { 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2081) if (lane_polarities[1] != lane_polarities[i]) 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2082) DRM_DEV_ERROR(dsi->dev, "Data lanes polarities do not match"); 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2083) } 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2084) if (lane_polarities[0]) 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2085) dsi->swap_dn_dp_clk = true; 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2086) if (lane_polarities[1]) 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2087) dsi->swap_dn_dp_data = true; 74629c49e66cc (Marek Vasut 2023-05-14 08:46:25 -0300 2088) }
This should be a fix for 74629c49e66c instead.