summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/cirrus/cirrus_ttm.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-05-31 16:53:56 +0400
committerDave Airlie <airlied@redhat.com>2012-05-31 16:53:56 +0400
commit93b4cc56aa09df24dc011ab9fc1d3a1c3f86ba1a (patch)
treea64e270ec2ab8f3f27e264d5581b9f0569b302f3 /drivers/gpu/drm/cirrus/cirrus_ttm.c
parentbc42aabc6a01b92b0f961d65671564e0e1cd7592 (diff)
downloadlinux-93b4cc56aa09df24dc011ab9fc1d3a1c3f86ba1a.tar.xz
cirrus: avoid crash if driver fails to load
If we haven't inited the mm code, don't try and tear it down. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/cirrus/cirrus_ttm.c')
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_ttm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index 2ebcd11a5023..50e170f879de 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -275,12 +275,17 @@ int cirrus_mm_init(struct cirrus_device *cirrus)
pci_resource_len(dev->pdev, 0),
DRM_MTRR_WC);
+ cirrus->mm_inited = true;
return 0;
}
void cirrus_mm_fini(struct cirrus_device *cirrus)
{
struct drm_device *dev = cirrus->dev;
+
+ if (!cirrus->mm_inited)
+ return;
+
ttm_bo_device_release(&cirrus->ttm.bdev);
cirrus_ttm_global_release(cirrus);