diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 4bfccd83e17..4fe5e88dcfe 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -181,6 +181,7 @@ lp_mem_type_from_format_desc(const struct util_format_description *format_desc, } int chan = util_format_get_first_non_void_channel(format_desc->format); + assert(chan >= 0); memset(type, 0, sizeof(struct lp_type)); type->floating = format_desc->channel[chan].type == UTIL_FORMAT_TYPE_FLOAT; @@ -1783,7 +1784,8 @@ lp_blend_type_from_format_desc(const struct util_format_description *format_desc return; } - const int chan = util_format_get_first_non_void_channel(format_desc->format); + int chan = util_format_get_first_non_void_channel(format_desc->format); + assert(chan >= 0); memset(type, 0, sizeof(struct lp_type)); type->floating = format_desc->channel[chan].type == UTIL_FORMAT_TYPE_FLOAT;