[PATCH 1/4] drm/dp_mst: Put malloc_kref of vcpi pointing port when disable MST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Why]
We directlly clean up proposed_vcpis[] but forget to put malloc_kref of
ports which the proposed_vcpis[] are pointing to.

[How]
Iterate over proposed_vcpis[] and put malloc_kref of ports which used to
have allocated payloads.

Fixes: 8732fe46b20c ("drm/dp_mst: Fix clearing payload state on topology disable")
Cc: Sean Paul <sean@xxxxxxxxxx>
Cc: Wayne Lin <Wayne.Lin@xxxxxxx>
Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx # v4.4+
Cc: Lyude Paul <lyude@xxxxxxxxxx>
Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
Cc: Maxime Ripard <mripard@xxxxxxxxxx>
Cc: Thomas Zimmermann <tzimmermann@xxxxxxx>
Cc: David Airlie <airlied@xxxxxxxx>
Cc: Daniel Vetter <daniel@xxxxxxxx>
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
Cc: <stable@xxxxxxxxxxxxxxx> # v5.7+
Signed-off-by: Wayne Lin <Wayne.Lin@xxxxxxx>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index ad0795afc21c..51cd7f74f026 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -3765,12 +3765,26 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
 
 		ret = 0;
 	} else {
+		int i;
+		struct drm_dp_vcpi *vcpi;
+		struct drm_dp_mst_port *port;
 		/* disable MST on the device */
 		mstb = mgr->mst_primary;
 		mgr->mst_primary = NULL;
 		/* this can fail if the device is gone */
 		drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0);
 		ret = 0;
+
+		for (i = 0; i < mgr->max_payloads; i++) {
+			vcpi = mgr->proposed_vcpis[i];
+			if (vcpi) {
+				port = container_of(vcpi, struct drm_dp_mst_port,
+						    vcpi);
+				if (port)
+					drm_dp_mst_put_port_malloc(port);
+			}
+		}
+
 		memset(mgr->payloads, 0,
 		       mgr->max_payloads * sizeof(mgr->payloads[0]));
 		memset(mgr->proposed_vcpis, 0,
-- 
2.17.1




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux