i965: Check result of make_surface() for intel_miptree_create_for_bo

Since make_surface() can fail, if the format isn't support by hw or
simlar error, we need to check the result before dereferencing it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Chris Wilson 2017-07-31 10:22:44 +01:00 committed by Kenneth Graunke
parent 246690b683
commit f28c2e2256
1 changed files with 2 additions and 0 deletions

View File

@ -792,6 +792,8 @@ intel_miptree_create_for_bo(struct brw_context *brw,
0, 0, width, height, depth, 1, ISL_TILING_Y0_BIT,
ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT,
BO_ALLOC_FOR_RENDER, pitch, bo);
if (!mt)
return NULL;
brw_bo_reference(bo);