mirror of
https://github.com/torvalds/linux.git
synced 2024-12-05 02:23:16 +00:00
drm/radeon/kms: Fix r600 blit cleanup path
r600 blit cleanup path need to check if a bo was allocated before trying to free or unpin it. This patch add this check and avoid oops when the initialization on r6xx or r7xx hw fails. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
6398d42454
commit
30d2d9a54d
@ -1961,11 +1961,13 @@ int r600_suspend(struct radeon_device *rdev)
|
|||||||
r600_wb_disable(rdev);
|
r600_wb_disable(rdev);
|
||||||
r600_pcie_gart_disable(rdev);
|
r600_pcie_gart_disable(rdev);
|
||||||
/* unpin shaders bo */
|
/* unpin shaders bo */
|
||||||
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
|
if (rdev->r600_blit.shader_obj) {
|
||||||
if (unlikely(r != 0))
|
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
|
||||||
return r;
|
if (!r) {
|
||||||
radeon_bo_unpin(rdev->r600_blit.shader_obj);
|
radeon_bo_unpin(rdev->r600_blit.shader_obj);
|
||||||
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
|
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,14 +512,16 @@ void r600_blit_fini(struct radeon_device *rdev)
|
|||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
if (rdev->r600_blit.shader_obj == NULL)
|
||||||
|
return;
|
||||||
|
/* If we can't reserve the bo, unref should be enough to destroy
|
||||||
|
* it when it becomes idle.
|
||||||
|
*/
|
||||||
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
|
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
|
||||||
if (unlikely(r != 0)) {
|
if (!r) {
|
||||||
dev_err(rdev->dev, "(%d) can't finish r600 blit\n", r);
|
radeon_bo_unpin(rdev->r600_blit.shader_obj);
|
||||||
goto out_unref;
|
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
|
||||||
}
|
}
|
||||||
radeon_bo_unpin(rdev->r600_blit.shader_obj);
|
|
||||||
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
|
|
||||||
out_unref:
|
|
||||||
radeon_bo_unref(&rdev->r600_blit.shader_obj);
|
radeon_bo_unref(&rdev->r600_blit.shader_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,10 +975,12 @@ int rv770_suspend(struct radeon_device *rdev)
|
|||||||
r600_wb_disable(rdev);
|
r600_wb_disable(rdev);
|
||||||
rv770_pcie_gart_disable(rdev);
|
rv770_pcie_gart_disable(rdev);
|
||||||
/* unpin shaders bo */
|
/* unpin shaders bo */
|
||||||
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
|
if (rdev->r600_blit.shader_obj) {
|
||||||
if (likely(r == 0)) {
|
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
|
||||||
radeon_bo_unpin(rdev->r600_blit.shader_obj);
|
if (likely(r == 0)) {
|
||||||
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
|
radeon_bo_unpin(rdev->r600_blit.shader_obj);
|
||||||
|
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user