summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/armada/armada_gem.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2015-06-15 10:14:51 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2015-07-15 16:45:29 +0100
commit0481c8c47f5e858bfc020a825fd178004c14702d (patch)
tree9a2d3fbb7a65918792fbd9b8b36c4602137b074a /drivers/gpu/drm/armada/armada_gem.c
parent41dbb2dba20ab951033d71de79d1f9863c8d1c34 (diff)
drm/armada: fix gem object free after failed prime import
Fix the gem object freeing after a partial import of a dma buffer, eg, one which has been imported, but not mapped. This was provoking a warning from the dma_buf code. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/armada/armada_gem.c')
-rw-r--r--drivers/gpu/drm/armada/armada_gem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c
index 580e10acaa3a..60a688ef81c7 100644
--- a/drivers/gpu/drm/armada/armada_gem.c
+++ b/drivers/gpu/drm/armada/armada_gem.c
@@ -69,8 +69,9 @@ void armada_gem_free_object(struct drm_gem_object *obj)
if (dobj->obj.import_attach) {
/* We only ever display imported data */
- dma_buf_unmap_attachment(dobj->obj.import_attach, dobj->sgt,
- DMA_TO_DEVICE);
+ if (dobj->sgt)
+ dma_buf_unmap_attachment(dobj->obj.import_attach,
+ dobj->sgt, DMA_TO_DEVICE);
drm_prime_gem_destroy(&dobj->obj, NULL);
}