diff options
author | Jerome Glisse <jglisse@redhat.com> | 2009-12-11 14:36:19 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-12-22 20:14:04 -0500 |
commit | 0a0c7596c643239e8d4c3eaaba43b74a96f2411e (patch) | |
tree | bb387597d7c8260a8cd2a18235cde90cc72c757d /drivers/gpu/drm/radeon/radeon_ttm.c | |
parent | d2efdf6d6f425950a61fa5cc3aa22e6718e7f3c8 (diff) |
drm/radeon/kms: Avoid crash when trying to cleanup uninitialized structure
Add boolean to record if some part of the driver are initialized or
not this allow to avoid a crash when trying to cleanup uninitialized
structure members.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_ttm.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ttm.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 7bed4122528c..a00450743d60 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -494,6 +494,7 @@ int radeon_ttm_init(struct radeon_device *rdev) | |||
494 | DRM_ERROR("failed initializing buffer object driver(%d).\n", r); | 494 | DRM_ERROR("failed initializing buffer object driver(%d).\n", r); |
495 | return r; | 495 | return r; |
496 | } | 496 | } |
497 | rdev->mman.initialized = true; | ||
497 | r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_VRAM, | 498 | r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_VRAM, |
498 | rdev->mc.real_vram_size >> PAGE_SHIFT); | 499 | rdev->mc.real_vram_size >> PAGE_SHIFT); |
499 | if (r) { | 500 | if (r) { |
@@ -541,6 +542,8 @@ void radeon_ttm_fini(struct radeon_device *rdev) | |||
541 | { | 542 | { |
542 | int r; | 543 | int r; |
543 | 544 | ||
545 | if (!rdev->mman.initialized) | ||
546 | return; | ||
544 | if (rdev->stollen_vga_memory) { | 547 | if (rdev->stollen_vga_memory) { |
545 | r = radeon_bo_reserve(rdev->stollen_vga_memory, false); | 548 | r = radeon_bo_reserve(rdev->stollen_vga_memory, false); |
546 | if (r == 0) { | 549 | if (r == 0) { |
@@ -554,6 +557,7 @@ void radeon_ttm_fini(struct radeon_device *rdev) | |||
554 | ttm_bo_device_release(&rdev->mman.bdev); | 557 | ttm_bo_device_release(&rdev->mman.bdev); |
555 | radeon_gart_fini(rdev); | 558 | radeon_gart_fini(rdev); |
556 | radeon_ttm_global_fini(rdev); | 559 | radeon_ttm_global_fini(rdev); |
560 | rdev->mman.initialized = false; | ||
557 | DRM_INFO("radeon: ttm finalized\n"); | 561 | DRM_INFO("radeon: ttm finalized\n"); |
558 | } | 562 | } |
559 | 563 | ||