drm/display/dp_mst: Correct the kref of port.
authorjsg <jsg@openbsd.org>
Thu, 2 Feb 2023 04:07:54 +0000 (04:07 +0000)
committerjsg <jsg@openbsd.org>
Thu, 2 Feb 2023 04:07:54 +0000 (04:07 +0000)
From Wayne Lin
335ef7d0777c5609d5fadb5b73b96c538fa8fc93 in linux-6.1.y/6.1.9
d8bf2df715bb8ac964f91fe8bf67c37c5d916463 in mainline linux

sys/dev/pci/drm/display/drm_dp_mst_topology.c

index d9765de..ef500fa 100644 (file)
@@ -3382,6 +3382,9 @@ void drm_dp_remove_payload(struct drm_dp_mst_topology_mgr *mgr,
 
        mgr->payload_count--;
        mgr->next_start_slot -= payload->time_slots;
+
+       if (payload->delete)
+               drm_dp_mst_put_port_malloc(payload->port);
 }
 EXPORT_SYMBOL(drm_dp_remove_payload);
 
@@ -4337,7 +4340,6 @@ int drm_dp_atomic_release_time_slots(struct drm_atomic_state *state,
 
        drm_dbg_atomic(mgr->dev, "[MST PORT:%p] TU %d -> 0\n", port, payload->time_slots);
        if (!payload->delete) {
-               drm_dp_mst_put_port_malloc(port);
                payload->pbn = 0;
                payload->delete = true;
                topology_state->payload_mask &= ~BIT(payload->vcpi - 1);