Skip to content

Commit

Permalink
cirrus: avoid crash if driver fails to load
Browse files Browse the repository at this point in the history
If we haven't inited the mm code, don't try and tear it down.

Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Dave Airlie committed May 31, 2012
1 parent bc42aab commit 93b4cc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/cirrus/cirrus_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ struct cirrus_device {
struct ttm_bo_device bdev;
atomic_t validate_sequence;
} ttm;

bool mm_inited;
};


Expand Down
5 changes: 5 additions & 0 deletions drivers/gpu/drm/cirrus/cirrus_ttm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 93b4cc5

Please sign in to comment.