From: Lucas Stach <l.stach@pengutronix.de>
To: Russell King <linux+etnaviv@arm.linux.org.uk>,
Christian Gmeiner <christian.gmeiner@gmail.com>,
dri-devel@lists.freedesktop.org
Subject: [PATCH 1/2] drm/etnaviv: fix get pages error path in etnaviv_gem_vaddr
Date: Tue, 26 Jan 2016 16:45:25 +0100 [thread overview]
Message-ID: <1453823126-3899-1-git-send-email-l.stach@pengutronix.de> (raw)
In case that etnaviv_gem_get_pages is unable to get the required
pages the object mutex needs to be unlocked. Also return NULL in
this case instead of propagating the error, as callers of this
function might not be prepared to handle a pointer error, but
expect this call to follow the semantics of a plain vmap to return
NULL in case of an error.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
drivers/gpu/drm/etnaviv/etnaviv_dump.c | 2 +-
drivers/gpu/drm/etnaviv/etnaviv_gem.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
index fd7d3e989e79..09a759e69dd2 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
@@ -216,7 +216,7 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
iter.hdr->iova = cpu_to_le64(vram->iova);
vaddr = etnaviv_gem_vaddr(&obj->base);
- if (vaddr && !IS_ERR(vaddr))
+ if (vaddr)
memcpy(iter.data, vaddr, obj->base.size);
etnaviv_core_dump_header(&iter, ETDUMP_BUF_BO, iter.data +
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index 9f77c3b94cc6..b22712fdd31e 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -361,8 +361,10 @@ void *etnaviv_gem_vaddr(struct drm_gem_object *obj)
if (!etnaviv_obj->vaddr) {
struct page **pages = etnaviv_gem_get_pages(etnaviv_obj);
- if (IS_ERR(pages))
- return ERR_CAST(pages);
+ if (IS_ERR(pages)) {
+ mutex_unlock(&etnaviv_obj->lock);
+ return NULL;
+ }
etnaviv_obj->vaddr = vmap(pages, obj->size >> PAGE_SHIFT,
VM_MAP, pgprot_writecombine(PAGE_KERNEL));
--
2.7.0.rc3
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2016-01-26 15:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-26 15:45 Lucas Stach [this message]
2016-01-26 15:45 ` [PATCH 2/2] drm/etnaviv: call correct function when trying to vmap a DMABUF Lucas Stach
2016-01-26 16:48 ` Russell King - ARM Linux
2016-01-26 16:45 ` [PATCH 1/2] drm/etnaviv: fix get pages error path in etnaviv_gem_vaddr Russell King - ARM Linux
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=1453823126-3899-1-git-send-email-l.stach@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=christian.gmeiner@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux+etnaviv@arm.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).