pan/cs: Fix cs_builder allocation failure robustness
There's more than one error-path out of cs_alloc_ins_block(), but only one of them got the discar_instr_slot treatment. Instead of plugging this in one more time, let's move this handling up to cs_alloc_ins(), where we can easily whack two birds with one stone. This makes us consistently return NULL on error here.
At the same time, we need to patch up cs_flush_block_instrs() here, because we don't actually set the buffer invalid here. So let's check for NULL here instead, which is the new contract.
Fixes: 0e6aaab0 ("pan/cs: add block to handle registers backup in exception handler") Signed-off-by: Boris Brezillon boris.brezillon@collabora.com Tested-by: Erik Faye-Lund erik.faye-lund@collabora.com Reviewed-by: Eric R. Smith eric.smith@collabora.com (cherry picked from commit 3006c2a7)