Skip to content

Commit 2b57f72

Browse files
jhovoldAbhinav Kumar
authored andcommitted
drm/msm/dp: fix aux-bus EP lifetime
Device-managed resources allocated post component bind must be tied to the lifetime of the aggregate DRM device or they will not necessarily be released when binding of the aggregate device is deferred. This can lead resource leaks or failure to bind the aggregate device when binding is later retried and a second attempt to allocate the resources is made. For the DP aux-bus, an attempt to populate the bus a second time will simply fail ("DP AUX EP device already populated"). Fix this by tying the lifetime of the EP device to the DRM device rather than DP controller platform device. Fixes: c3bf8e2 ("drm/msm/dp: Add eDP support via aux_bus") Cc: [email protected] # 5.19 Signed-off-by: Johan Hovold <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Tested-by: Kuogee Hsieh <[email protected]> Reviewed-by: Kuogee Hsieh <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/502672/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abhinav Kumar <[email protected]>
1 parent a79343d commit 2b57f72

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/gpu/drm/msm/dp/dp_display.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,11 @@ void msm_dp_debugfs_init(struct msm_dp *dp_display, struct drm_minor *minor)
15281528
}
15291529
}
15301530

1531+
static void of_dp_aux_depopulate_bus_void(void *data)
1532+
{
1533+
of_dp_aux_depopulate_bus(data);
1534+
}
1535+
15311536
static int dp_display_get_next_bridge(struct msm_dp *dp)
15321537
{
15331538
int rc;
@@ -1552,10 +1557,16 @@ static int dp_display_get_next_bridge(struct msm_dp *dp)
15521557
* panel driver is probed asynchronously but is the best we
15531558
* can do without a bigger driver reorganization.
15541559
*/
1555-
rc = devm_of_dp_aux_populate_ep_devices(dp_priv->aux);
1560+
rc = of_dp_aux_populate_bus(dp_priv->aux, NULL);
15561561
of_node_put(aux_bus);
15571562
if (rc)
15581563
goto error;
1564+
1565+
rc = devm_add_action_or_reset(dp->drm_dev->dev,
1566+
of_dp_aux_depopulate_bus_void,
1567+
dp_priv->aux);
1568+
if (rc)
1569+
goto error;
15591570
} else if (dp->is_edp) {
15601571
DRM_ERROR("eDP aux_bus not found\n");
15611572
return -ENODEV;

0 commit comments

Comments
 (0)