Commit 8953645f authored by Ingo Molnar's avatar Ingo Molnar

perf_counter tools: Fix error condition in parse_aliases()

gcc warned about this bug:

util/parse-events.c: In function ‘parse_generic_hw_symbols’:
util/parse-events.c:175: warning: comparison is always false due to limited range of data type
util/parse-events.c:182: warning: comparison is always false due to limited range of data type
util/parse-events.c:190: warning: comparison is always false due to limited range of data type

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 7d37a0cb
...@@ -160,12 +160,12 @@ static int parse_aliases(const char *str, char *names[][MAX_ALIASES], int size) ...@@ -160,12 +160,12 @@ static int parse_aliases(const char *str, char *names[][MAX_ALIASES], int size)
} }
} }
return 0; return -1;
} }
static int parse_generic_hw_symbols(const char *str, struct perf_counter_attr *attr) static int parse_generic_hw_symbols(const char *str, struct perf_counter_attr *attr)
{ {
__u8 cache_type = -1, cache_op = 0, cache_result = 0; int cache_type = -1, cache_op = 0, cache_result = 0;
cache_type = parse_aliases(str, hw_cache, PERF_COUNT_HW_CACHE_MAX); cache_type = parse_aliases(str, hw_cache, PERF_COUNT_HW_CACHE_MAX);
/* /*
...@@ -179,8 +179,8 @@ static int parse_generic_hw_symbols(const char *str, struct perf_counter_attr *a ...@@ -179,8 +179,8 @@ static int parse_generic_hw_symbols(const char *str, struct perf_counter_attr *a
/* /*
* Fall back to reads: * Fall back to reads:
*/ */
if (cache_type == -1) if (cache_op == -1)
cache_type = PERF_COUNT_HW_CACHE_OP_READ; cache_op = PERF_COUNT_HW_CACHE_OP_READ;
cache_result = parse_aliases(str, hw_cache_result, cache_result = parse_aliases(str, hw_cache_result,
PERF_COUNT_HW_CACHE_RESULT_MAX); PERF_COUNT_HW_CACHE_RESULT_MAX);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment