public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Wayne Lin <Wayne.Lin@amd.com>
To: <dri-devel@lists.freedesktop.org>
Cc: lyude@redhat.com, Nicholas.Kazlauskas@amd.com,
	harry.wentland@amd.com, jerry.zuo@amd.com, hersenxs.wu@amd.com,
	"Wayne Lin" <Wayne.Lin@amd.com>, "Sean Paul" <sean@poorly.run>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	stable@vger.kernel.org,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>
Subject: [PATCH 1/4] drm/dp_mst: Put malloc_kref of vcpi pointing port when disable MST
Date: Wed, 21 Jul 2021 00:03:39 +0800	[thread overview]
Message-ID: <20210720160342.11415-2-Wayne.Lin@amd.com> (raw)
In-Reply-To: <20210720160342.11415-1-Wayne.Lin@amd.com>

[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@poorly.run>
Cc: Wayne Lin <Wayne.Lin@amd.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: stable@vger.kernel.org # v4.4+
Cc: Lyude Paul <lyude@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v5.7+
Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
---
 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


       reply	other threads:[~2021-07-20 16:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210720160342.11415-1-Wayne.Lin@amd.com>
2021-07-20 16:03 ` Wayne Lin [this message]
2021-07-20 16:03 ` [PATCH 2/4] drm/dp_mst: Only create connector for connected end device Wayne Lin
2021-08-03 23:58   ` Lyude Paul
2021-08-04  0:08     ` Lyude Paul
2021-08-04  7:13       ` Lin, Wayne
2021-08-10 20:45         ` Lyude Paul
2021-08-11  9:49           ` Lin, Wayne
2021-08-18 18:58             ` Lyude Paul
2021-08-20 11:20               ` Lin, Wayne
2021-08-20 20:47                 ` Lyude Paul
2021-08-23  6:33                   ` Lin, Wayne
2021-08-23 21:18                     ` Lyude Paul
2021-08-25  3:35                       ` Lin, Wayne
2021-08-31 22:47                         ` Lyude Paul
2021-09-01 21:59                           ` Lyude Paul
2021-09-14  8:46                             ` Lin, Wayne
2021-09-17 17:48                               ` Lyude Paul
2021-10-26  3:50                                 ` Lin, Wayne
2021-10-26 19:34                                   ` Lyude Paul
2021-10-29 12:11                                     ` Lin, Wayne
2021-11-02 22:31                                       ` Lyude Paul
2021-10-12 21:17                               ` Lyude Paul
2021-10-15 10:16                                 ` Lin, Wayne
2021-07-20 16:03 ` [PATCH 3/4] drm/dp_mst: Put connector of disconnected end device when handling CSN Wayne Lin
2021-07-20 16:03 ` [PATCH 4/4] drm/dp_mst: Release disconnected connectors when resume Wayne Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210720160342.11415-2-Wayne.Lin@amd.com \
    --to=wayne.lin@amd.com \
    --cc=Nicholas.Kazlauskas@amd.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=hersenxs.wu@amd.com \
    --cc=jerry.zuo@amd.com \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=sean@poorly.run \
    --cc=stable@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox