freedreno: fix coverity negative array index warning
authorRob Clark <robclark@freedesktop.org>
Thu, 2 Jun 2016 14:36:23 +0000 (10:36 -0400)
committerRob Clark <robclark@freedesktop.org>
Thu, 2 Jun 2016 19:44:07 +0000 (15:44 -0400)
Never can happen, since query would not have been created in the first
place if pidx(query_type) return negative.  Lets let coverity realize
this.

CID 1362460

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/freedreno_query_hw.c

index 2ac03f22b4148379942a6c57ccf5388dd927ebf2..04452efadcdfad59cfccc86d46f6863d356ce73a 100644 (file)
@@ -61,6 +61,8 @@ get_sample(struct fd_context *ctx, struct fd_ringbuffer *ring,
        struct fd_hw_sample *samp = NULL;
        int idx = pidx(query_type);
 
+       assume(idx >= 0);   /* query never would have been created otherwise */
+
        if (!ctx->sample_cache[idx]) {
                ctx->sample_cache[idx] =
                        ctx->sample_providers[idx]->get_sample(ctx, ring);