drm/bridge: anx7625: Fix refcount bug in anx7625_parse_dt()
Subsystems (3)
PATCH v2 1/2 drm/bridge: anx7625: Fix refcount bug in anx7625_parse_dt()
In anx7625_parse_dt(), 'pdata->mipi_host_node' will be assigned a new reference with of_graph_get_remote_node() which will increase the refcount of the object, correspondingly, we should call of_node_put() for the old reference stored in the 'pdata->mipi_host_node'.
---
changelog:
v2: (1) rebase with drm-misc-next advised by Robert Foss
(2) use proper title
(3) remove the v1's second bug ('ep0'), fixed recently
v1: https://lore.kernel.org/all/[email protected]/
drivers/gpu/drm/bridge/analogix/anx7625.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/analogix/anx7625.c +1 -0
@@ -1642,6 +1642,7 @@ 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" );
Signature · 1 line
2.25.1
PATCH v2 2/2 drm/bridge: tc358767: Add of_node_put() when breaking out of loop
In tc_probe_bridge_endpoint(), we should call of_node_put() when breaking out of the for_each_endpoint_of_node() which will automatically increase and decrease the refcount.
---
changelog:
v2: (1) rebase with drm-misc-next advised by Robert Foss
(2) use proper title
v1: https://lore.kernel.org/all/[email protected]/
drivers/gpu/drm/bridge/tc358767.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/tc358767.c +3 -2
@@ -2010,9 +2010,10 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc)for_each_endpoint_of_node (dev->of_node, node) {of_graph_parse_endpoint (node, &endpoint); -if (endpoint.port >2 ) +if (endpoint.port >2 ) { +of_node_put (node);return -EINVAL ; - + } mode |=BIT (endpoint.port); }
Signature · 1 line
2.25.1
Quoted 32 lines · Liang He
In
anx7625_parse_dt(), 'pdata->mipi_host_node' will be assigned a new reference withof_graph_get_remote_node()which will increase the refcount of the object, correspondingly, we should callof_node_put()for the old reference stored in the 'pdata->mipi_host_node'.Fixes 8bdfc5dae4e3 ("drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP")Signed-off-by Liang He <[email protected]>---
changelog:v2: (1) rebase with drm-misc-next advised by Robert Foss
(2) use proper title
(3) remove the v1's second bug ('ep0'), fixed recently
v1: https://lore.kernel.org/all/[email protected]/drivers/gpu/drm/bridge/analogix/anx7625.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/bridge/analogix/anx7625.c +1
-1@@ -1642,6 +1642,7 @@ 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" ); --
Quoted 2 lines
2.25.1
This series has my r-b.
Applied series to drm-misc-next.