lkml.org 
[lkml]   [2016]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] drm: fix missing reference counting decrease
From
Date
This looks good but we should probably do the same for all return paths 
when reference for port has been acquired.

Please see attached patch.

Thanks,
Harry

On 2016-02-01 11:08 AM, Insu Yun wrote:
> In drm_dp_mst_allocate_vcpi, it returns true in two paths,
> but in one path, there is no reference couting decrease.
>
> Signed-off-by: Insu Yun <wuninsu@gmail.com>
> ---
> drivers/gpu/drm/drm_dp_mst_topology.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 6ed90a2..fe273b6 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -2446,6 +2446,7 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp
> DRM_DEBUG_KMS("payload: vcpi %d already allocated for pbn %d - requested pbn %d\n", port->vcpi.vcpi, port->vcpi.pbn, pbn);
> if (pbn == port->vcpi.pbn) {
> *slots = port->vcpi.num_slots;
> + drm_dp_put_port(port);
> return true;
> }
> }

From a6d4dc6206f06a3d1acc05ea5bf3b4885cc96a0a Mon Sep 17 00:00:00 2001
From: Harry Wentland <harry.wentland@amd.com>
Date: Tue, 9 Feb 2016 09:33:11 -0500
Subject: [PATCH] drm/dp/mst: Fix missing ref count decrease

Decrease ref count for port on all exit conditions.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Mykola Lysenko <mykola.lysenko@amd.com>
---
drivers/gpu/drm/drm_dp_mst_topology.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 5662e68ecccd..fa50fd0cb5ef 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2498,7 +2498,8 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp
DRM_DEBUG_KMS("payload: vcpi %d already allocated for pbn %d - requested pbn %d\n", port->vcpi.vcpi, port->vcpi.pbn, pbn);
if (pbn == port->vcpi.pbn) {
*slots = port->vcpi.num_slots;
- return true;
+ ret = 0;
+ goto out;
}
}

@@ -2510,10 +2511,10 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp
DRM_DEBUG_KMS("initing vcpi for %d %d\n", pbn, port->vcpi.num_slots);
*slots = port->vcpi.num_slots;

- drm_dp_put_port(port);
- return true;
+ ret = 0;
out:
- return false;
+ drm_dp_put_port(port);
+ return ret == 0;
}
EXPORT_SYMBOL(drm_dp_mst_allocate_vcpi);

--
2.1.4
\
 
 \ /
  Last update: 2016-02-09 17:41    [W:0.042 / U:2.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site