All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Wentland <harry.wentland@amd.com>
To: Insu Yun <wuninsu@gmail.com>, <airlied@linux.ie>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Cc: <yeongjin.jang@gatech.edu>, <taesoo@gatech.edu>,
	<insu@gatech.edu>, <changwoo@gatech.edu>,
	"Lysenko, Mykola" <Mykola.Lysenko@amd.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>
Subject: Re: [PATCH] drm: fix missing reference counting decrease
Date: Tue, 9 Feb 2016 09:48:35 -0500	[thread overview]
Message-ID: <56B9FC43.3040407@amd.com> (raw)
In-Reply-To: <1454342909-15327-1-git-send-email-wuninsu@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]

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;
>   		}
>   	}


[-- Attachment #2: 0001-drm-dp-mst-Fix-missing-ref-count-decrease.patch --]
[-- Type: text/x-patch, Size: 1441 bytes --]

>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


WARNING: multiple messages have this Message-ID (diff)
From: Harry Wentland <harry.wentland@amd.com>
To: Insu Yun <wuninsu@gmail.com>,
	airlied@linux.ie, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Cc: yeongjin.jang@gatech.edu, taesoo@gatech.edu, insu@gatech.edu,
	changwoo@gatech.edu, "Deucher,
	Alexander" <Alexander.Deucher@amd.com>,
	"Lysenko, Mykola" <Mykola.Lysenko@amd.com>
Subject: Re: [PATCH] drm: fix missing reference counting decrease
Date: Tue, 9 Feb 2016 09:48:35 -0500	[thread overview]
Message-ID: <56B9FC43.3040407@amd.com> (raw)
In-Reply-To: <1454342909-15327-1-git-send-email-wuninsu@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]

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;
>   		}
>   	}


[-- Attachment #2: 0001-drm-dp-mst-Fix-missing-ref-count-decrease.patch --]
[-- Type: text/x-patch, Size: 1441 bytes --]

>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


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-02-09 16:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 16:08 [PATCH] drm: fix missing reference counting decrease Insu Yun
2016-02-09 14:48 ` Harry Wentland [this message]
2016-02-09 14:48   ` Harry Wentland
2016-02-09 16:07   ` Insu Yun

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=56B9FC43.3040407@amd.com \
    --to=harry.wentland@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Mykola.Lysenko@amd.com \
    --cc=airlied@linux.ie \
    --cc=changwoo@gatech.edu \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=insu@gatech.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=taesoo@gatech.edu \
    --cc=wuninsu@gmail.com \
    --cc=yeongjin.jang@gatech.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.