diff --git a/src/panfrost/lib/genxml/cs_builder.h b/src/panfrost/lib/genxml/cs_builder.h index f4e32e27fc8..cb7448cd9b0 100644 --- a/src/panfrost/lib/genxml/cs_builder.h +++ b/src/panfrost/lib/genxml/cs_builder.h @@ -535,7 +535,7 @@ cs_alloc_ins_block(struct cs_builder *b, uint32_t num_instrs) return util_dynarray_grow(&b->blocks.instrs, uint64_t, num_instrs); if (!cs_reserve_instrs(b, num_instrs)) - return &b->discard_instr_slot; + return NULL; assert(b->cur_chunk.size + num_instrs - 1 < b->cur_chunk.buffer.capacity); uint32_t pos = b->cur_chunk.pos; @@ -564,7 +564,7 @@ cs_flush_block_instrs(struct cs_builder *b) void *buffer = cs_alloc_ins_block(b, num_instrs); - if (likely(cs_is_valid(b))) { + if (likely(buffer != NULL)) { /* If we have a LOAD_IP chain, we need to patch each LOAD_IP * instruction before we copy the block to the final memory * region. */ @@ -654,7 +654,7 @@ cs_alloc_ins(struct cs_builder *b) * causing further cs_else_start() instructions to be invalid. */ cs_flush_pending_if(b); - return cs_alloc_ins_block(b, 1); + return cs_alloc_ins_block(b, 1) ?: &b->discard_instr_slot; } /* Call this when you are done building a command stream and want to prepare