From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: dri-devel@lists.freedesktop.org, airlied@gmail.com,
stable@vger.kernel.org
Subject: Re: [PATCH] drm: cma: fix refcounting on the dmabuf import error path
Date: Fri, 05 Jul 2013 11:46:13 +0200 [thread overview]
Message-ID: <3434953.5V1mGknQYF@avalon> (raw)
In-Reply-To: <1373005955-29835-1-git-send-email-jy0922.shim@samsung.com>
Hi Joonyoung,
Thank you for the patch.
On Friday 05 July 2013 15:32:35 Joonyoung Shim wrote:
> From drm gem CMA helper, it wasn't fixed dma_buf refcount problem fixed
> by commit 011c228. This patch solves it.
Please add a "Cc:stable@vger.kernel.org" here.
> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/gpu/drm/drm_gem_cma_helper.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c
> b/drivers/gpu/drm/drm_gem_cma_helper.c index ce06397..3f3a12b 100644
> --- a/drivers/gpu/drm/drm_gem_cma_helper.c
> +++ b/drivers/gpu/drm/drm_gem_cma_helper.c
> @@ -554,7 +554,6 @@ struct drm_gem_object *drm_gem_cma_dmabuf_import(struct
> drm_device *drm, * refcount on gem itself instead of f_count of dmabuf.
> */
> drm_gem_object_reference(obj);
> - dma_buf_put(dma_buf);
> return obj;
> }
> }
> @@ -573,6 +572,8 @@ struct drm_gem_object *drm_gem_cma_dmabuf_import(struct
> drm_device *drm, goto error_gem_free;
> }
>
> + get_dma_buf(dma_buf);
> +
As a side note, you have probably placed the get_dma_buf() call here to mimic
the drm_prime.c code, but would there be anything wrong by placing it right
before returning the GEM object ? The dma_buf_put() call could then be removed
from the error path.
> sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
> if (IS_ERR_OR_NULL(sgt)) {
> ret = sgt ? PTR_ERR(sgt) : -ENOMEM;
> @@ -597,6 +598,7 @@ error_buf_unmap:
> dma_buf_unmap_attachment(attach, sgt, DMA_BIDIRECTIONAL);
> error_buf_detach:
> dma_buf_detach(dma_buf, attach);
> + dma_buf_put(dma_buf);
> error_gem_free:
> drm_gem_cma_free_object(&cma_obj->base);
> return ERR_PTR(ret);
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2013-07-05 9:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-05 6:32 [PATCH] drm: cma: fix refcounting on the dmabuf import error path Joonyoung Shim
2013-07-05 9:46 ` Laurent Pinchart [this message]
2013-07-08 9:11 ` Joonyoung Shim
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=3434953.5V1mGknQYF@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jy0922.shim@samsung.com \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox