[Mesa-dev] [PATCH 4/4] mesa/main: drop needless condition check in _mesa_GetPerfCounterInfoINTEL

Rob Herring robh at kernel.org
Tue May 30 20:47:09 UTC 2017


Fixes the following warning:

external/mesa3d/src/mesa/main/performance_query.c:352:21: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
   if (counterIndex < 0 || counterIndex >= queryNumCounters) {
       ~~~~~~~~~~~~ ^ ~

counterIndex will be ~0 if invalid and the 2nd condition is sufficient to
catch that case.

Signed-off-by: Rob Herring <robh at kernel.org>
---
 src/mesa/main/performance_query.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/performance_query.c b/src/mesa/main/performance_query.c
index 56f6a7da8b9f..b9e7cf9961b5 100644
--- a/src/mesa/main/performance_query.c
+++ b/src/mesa/main/performance_query.c
@@ -349,7 +349,7 @@ _mesa_GetPerfCounterInfoINTEL(GLuint queryId, GLuint counterId,
 
    counterIndex = counterid_to_index(counterId);
 
-   if (counterIndex < 0 || counterIndex >= queryNumCounters) {
+   if (counterIndex >= queryNumCounters) {
       _mesa_error(ctx, GL_INVALID_VALUE,
                   "glGetPerfCounterInfoINTEL(invalid counterId)");
       return;
-- 
2.11.0



More information about the mesa-dev mailing list