diff mbox series

[v8,04/17] drm/dp_mst: Fill branch->num_ports

Message ID 20191203143530.27262-5-mikita.lipski@amd.com (mailing list archive)
State New, archived
Headers show
Series DSC MST support for DRM and AMDGPU | expand

Commit Message

Lipski, Mikita Dec. 3, 2019, 2:35 p.m. UTC
From: David Francis <David.Francis@amd.com>

This field on drm_dp_mst_branch was never filled

It is initialized to zero when the port is kzallocced.
When a port is added to the list, increment num_ports,
and when a port is removed from the list, decrement num_ports.

v2: remember to decrement on port removal
v3: don't explicitly init to 0

Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: David Francis <David.Francis@amd.com>
Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Harry Wentland Dec. 6, 2019, 4:30 a.m. UTC | #1
On 2019-12-03 9:35 a.m., mikita.lipski@amd.com wrote:
> From: David Francis <David.Francis@amd.com>
> 
> This field on drm_dp_mst_branch was never filled
> 
> It is initialized to zero when the port is kzallocced.
> When a port is added to the list, increment num_ports,
> and when a port is removed from the list, decrement num_ports.
> 
> v2: remember to decrement on port removal
> v3: don't explicitly init to 0
> 
> Reviewed-by: Lyude Paul <lyude@redhat.com>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
> Signed-off-by: David Francis <David.Francis@amd.com>
> Signed-off-by: Mikita Lipski <mikita.lipski@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 06aae9b52e8a..d74b767d0fe1 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -2129,6 +2129,7 @@ drm_dp_mst_port_add_connector(struct drm_dp_mst_branch *mstb,
>  	build_mst_prop_path(mstb, port->port_num, proppath, sizeof(proppath));
>  	port->connector = mgr->cbs->add_connector(mgr, port, proppath);
>  	if (!port->connector) {
> +		mstb->num_ports--;
>  		ret = -ENOMEM;
>  		goto error;
>  	}
> @@ -2256,6 +2257,7 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
>  		mutex_lock(&mgr->lock);
>  		drm_dp_mst_topology_get_port(port);
>  		list_add(&port->next, &mstb->ports);
> +		mstb->num_ports++;
>  		mutex_unlock(&mgr->lock);
>  	}
>  

Did you drop the num_ports-- when we do list_del() by accident?

See https://patchwork.freedesktop.org/patch/325600/

Harry

>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 06aae9b52e8a..d74b767d0fe1 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2129,6 +2129,7 @@  drm_dp_mst_port_add_connector(struct drm_dp_mst_branch *mstb,
 	build_mst_prop_path(mstb, port->port_num, proppath, sizeof(proppath));
 	port->connector = mgr->cbs->add_connector(mgr, port, proppath);
 	if (!port->connector) {
+		mstb->num_ports--;
 		ret = -ENOMEM;
 		goto error;
 	}
@@ -2256,6 +2257,7 @@  drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
 		mutex_lock(&mgr->lock);
 		drm_dp_mst_topology_get_port(port);
 		list_add(&port->next, &mstb->ports);
+		mstb->num_ports++;
 		mutex_unlock(&mgr->lock);
 	}