@@ -786,6 +786,8 @@ anv_sparse_bind_trtt(struct anv_device *device,
786786 result = anv_trtt_bind_add (device , trtt_addr , dest_addr ,
787787 l3l2_binds , & n_l3l2_binds ,
788788 l1_binds , & n_l1_binds );
789+ if (result != VK_SUCCESS )
790+ goto error_stack_arrays ;
789791 }
790792 }
791793
@@ -795,14 +797,12 @@ anv_sparse_bind_trtt(struct anv_device *device,
795797 /* Convert the L3/L2/L1 TRTT page table updates in anv_trtt_bind elements
796798 * into MI commands.
797799 */
798- if (result == VK_SUCCESS ) {
799- sparse_debug ("trtt_binds: num_vm_binds:%02d l3l2:%04d l1:%04d\n" ,
800- sparse_submit -> binds_len , n_l3l2_binds , n_l1_binds );
800+ sparse_debug ("trtt_binds: num_vm_binds:%02d l3l2:%04d l1:%04d\n" ,
801+ sparse_submit -> binds_len , n_l3l2_binds , n_l1_binds );
801802
802- if (n_l3l2_binds || n_l1_binds ) {
803- anv_genX (device -> info , write_trtt_entries )(
804- & submit -> base , l3l2_binds , n_l3l2_binds , l1_binds , n_l1_binds );
805- }
803+ if (n_l3l2_binds || n_l1_binds ) {
804+ anv_genX (device -> info , write_trtt_entries )(
805+ & submit -> base , l3l2_binds , n_l3l2_binds , l1_binds , n_l1_binds );
806806 }
807807
808808 STACK_ARRAY_FINISH (l1_binds );
@@ -847,6 +847,9 @@ anv_sparse_bind_trtt(struct anv_device *device,
847847
848848 return VK_SUCCESS ;
849849
850+ error_stack_arrays :
851+ STACK_ARRAY_FINISH (l1_binds );
852+ STACK_ARRAY_FINISH (l3l2_binds );
850853 error_add_bind :
851854 simple_mtx_unlock (& trtt -> mutex );
852855 anv_async_submit_fini (& submit -> base );
0 commit comments