Skip to content

Commit 1619495

Browse files
jhovoldAbhinav Kumar
authored andcommitted
drm/msm/dp: fix bridge 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 bridges, previously allocated bridges will leak on probe deferral. Fix this by amending the DP parser interface and tying the lifetime of the bridge device to the DRM device rather than DP platform device. Fixes: c3bf8e2 ("drm/msm/dp: Add eDP support via aux_bus") Cc: [email protected] # 5.19 Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Tested-by: Kuogee Hsieh <[email protected]> Reviewed-by: Kuogee Hsieh <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/502667/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abhinav Kumar <[email protected]>
1 parent 2b57f72 commit 1619495

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,7 @@ static int dp_display_get_next_bridge(struct msm_dp *dp)
15791579
* For DisplayPort interfaces external bridges are optional, so
15801580
* silently ignore an error if one is not present (-ENODEV).
15811581
*/
1582-
rc = dp_parser_find_next_bridge(dp_priv->parser);
1582+
rc = devm_dp_parser_find_next_bridge(dp->drm_dev->dev, dp_priv->parser);
15831583
if (!dp->is_edp && rc == -ENODEV)
15841584
return 0;
15851585

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,12 @@ static int dp_parser_clock(struct dp_parser *parser)
240240
return 0;
241241
}
242242

243-
int dp_parser_find_next_bridge(struct dp_parser *parser)
243+
int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser)
244244
{
245-
struct device *dev = &parser->pdev->dev;
245+
struct platform_device *pdev = parser->pdev;
246246
struct drm_bridge *bridge;
247247

248-
bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
248+
bridge = devm_drm_of_get_bridge(dev, pdev->dev.of_node, 1, 0);
249249
if (IS_ERR(bridge))
250250
return PTR_ERR(bridge);
251251

drivers/gpu/drm/msm/dp/dp_parser.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,16 @@ struct dp_parser {
138138
struct dp_parser *dp_parser_get(struct platform_device *pdev);
139139

140140
/**
141-
* dp_parser_find_next_bridge() - find an additional bridge to DP
141+
* devm_dp_parser_find_next_bridge() - find an additional bridge to DP
142142
*
143+
* @dev: device to tie bridge lifetime to
143144
* @parser: dp_parser data from client
144145
*
145146
* This function is used to find any additional bridge attached to
146147
* the DP controller. The eDP interface requires a panel bridge.
147148
*
148149
* Return: 0 if able to get the bridge, otherwise negative errno for failure.
149150
*/
150-
int dp_parser_find_next_bridge(struct dp_parser *parser);
151+
int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser);
151152

152153
#endif

0 commit comments

Comments
 (0)