]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/msm/dp: fix aux-bus EP lifetime
authorJohan Hovold <johan+linaro@kernel.org>
Tue, 13 Sep 2022 08:53:16 +0000 (10:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Nov 2022 15:00:22 +0000 (00:00 +0900)
commit 2b57f726611e294dc4297dd48eb8c98ef1938e82 upstream.

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: c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus")
Cc: stable@vger.kernel.org # 5.19
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/502672/
Link: https://lore.kernel.org/r/20220913085320.8577-7-johan+linaro@kernel.org
Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/msm/dp/dp_display.c

index be9ed891dc3f8ea1eeb29c248165aa9a7ac70b2c..99da6e8cae6dac3d84934dbae8fb7ac903192ced 100644 (file)
@@ -1528,6 +1528,11 @@ void msm_dp_debugfs_init(struct msm_dp *dp_display, struct drm_minor *minor)
        }
 }
 
+static void of_dp_aux_depopulate_bus_void(void *data)
+{
+       of_dp_aux_depopulate_bus(data);
+}
+
 static int dp_display_get_next_bridge(struct msm_dp *dp)
 {
        int rc;
@@ -1552,10 +1557,16 @@ static int dp_display_get_next_bridge(struct msm_dp *dp)
                 * panel driver is probed asynchronously but is the best we
                 * can do without a bigger driver reorganization.
                 */
-               rc = devm_of_dp_aux_populate_ep_devices(dp_priv->aux);
+               rc = of_dp_aux_populate_bus(dp_priv->aux, NULL);
                of_node_put(aux_bus);
                if (rc)
                        goto error;
+
+               rc = devm_add_action_or_reset(dp->drm_dev->dev,
+                                               of_dp_aux_depopulate_bus_void,
+                                               dp_priv->aux);
+               if (rc)
+                       goto error;
        } else if (dp->is_edp) {
                DRM_ERROR("eDP aux_bus not found\n");
                return -ENODEV;