hardware/intel/intel-driver
Revision | 19cf264f30919b872dd8d4517ab9cdbf1057860d (tree) |
---|---|
Zeit | 2015-09-06 16:13:57 |
Autor | Xu Guangxin <Guangxin.Xu@inte...> |
Commiter | Xiang, Haihao |
CreateSurfaces2: forward function return to caller
we did not check following function's return:
i965_surface_native_memory
i965_suface_external_memory
i965_check_alloc_surface_bo
It will be in trouble if underlay buffer allocation is failed.
(cherry picked from commit 12b3d9ef379e6159e30c2aafc040f1137cd4141a)
@@ -989,9 +989,7 @@ i965_surface_native_memory(VADriverContextP ctx, | ||
989 | 989 | expected_fourcc == VA_FOURCC_YV16) |
990 | 990 | tiling = 0; |
991 | 991 | |
992 | - i965_check_alloc_surface_bo(ctx, obj_surface, tiling, expected_fourcc, get_sampling_from_fourcc(expected_fourcc)); | |
993 | - | |
994 | - return VA_STATUS_SUCCESS; | |
992 | + return i965_check_alloc_surface_bo(ctx, obj_surface, tiling, expected_fourcc, get_sampling_from_fourcc(expected_fourcc)); | |
995 | 993 | } |
996 | 994 | |
997 | 995 | static VAStatus |
@@ -1327,19 +1325,23 @@ i965_CreateSurfaces2( | ||
1327 | 1325 | } |
1328 | 1326 | } |
1329 | 1327 | } |
1330 | - i965_surface_native_memory(ctx, | |
1331 | - obj_surface, | |
1332 | - format, | |
1333 | - expected_fourcc); | |
1328 | + vaStatus = i965_surface_native_memory(ctx, | |
1329 | + obj_surface, | |
1330 | + format, | |
1331 | + expected_fourcc); | |
1334 | 1332 | break; |
1335 | 1333 | |
1336 | 1334 | case I965_SURFACE_MEM_GEM_FLINK: |
1337 | 1335 | case I965_SURFACE_MEM_DRM_PRIME: |
1338 | - i965_suface_external_memory(ctx, | |
1339 | - obj_surface, | |
1340 | - memory_type, | |
1341 | - memory_attibute, | |
1342 | - i); | |
1336 | + vaStatus = i965_suface_external_memory(ctx, | |
1337 | + obj_surface, | |
1338 | + memory_type, | |
1339 | + memory_attibute, | |
1340 | + i); | |
1341 | + break; | |
1342 | + } | |
1343 | + if (VA_STATUS_SUCCESS != vaStatus) { | |
1344 | + i965_destroy_surface(&i965->surface_heap, (struct object_base *)obj_surface); | |
1343 | 1345 | break; |
1344 | 1346 | } |
1345 | 1347 | } |