[PATCH v2 10/14] drm/dp-mst: Fill branch->num_ports

Lyude Paul lyude at redhat.com
Tue Aug 20 21:08:51 UTC 2019


On Tue, 2019-08-20 at 15:11 -0400, David Francis wrote:
> This field on drm_dp_mst_branch was never filled
> 
> Initialize it to zero when the list of ports is created.
> When a port is added to the list, increment num_ports
> 
> Signed-off-by: David Francis <David.Francis at amd.com>
> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 5d5bd42da17c..0c580d5279c1 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -918,6 +918,7 @@ static struct drm_dp_mst_branch
> *drm_dp_add_mst_branch_device(u8 lct, u8 *rad)
>  	INIT_LIST_HEAD(&mstb->ports);
>  	kref_init(&mstb->topology_kref);
>  	kref_init(&mstb->malloc_kref);
> +	mstb->num_ports = 0;
>  	return mstb;
>  }
>  
> @@ -1672,6 +1673,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
> *mstb,
>  		mutex_lock(&mstb->mgr->lock);
>  		drm_dp_mst_topology_get_port(port);
>  		list_add(&port->next, &mstb->ports);
> +		mstb->num_ports++;

You're forgot to add mstb->num_ports--; lower down in the function:

		if (!port->connector) {
			/* remove it from the port list */
			mutex_lock(&mstb->mgr->lock);
			list_del(&port->next);
/* Right here --------> */
			mutex_unlock(&mstb->mgr->lock);
			/* drop port list reference */
			drm_dp_mst_topology_put_port(port);
			goto out;
		}

With that fixed:

Reviewed-by: Lyude Paul <lyude at redhat.com>

>  		mutex_unlock(&mstb->mgr->lock);
>  	}
>  
-- 
Cheers,
	Lyude Paul



More information about the amd-gfx mailing list