[patch] perf_event_open fix unexpected char warning

Vince Weaver <[email protected]> Wed, 17 Aug 2016 13:14:20 -0400 (EDT)
Newsgroups org.kernel.vger.trinity
Message-ID <alpine.DEB.2.20.1608171311370.14822@macbook-air>
The perf_event_open code parses some files under /sys
There are some hex values there, traditionally these were all lowercase
but on RaspberryPi2 machines for whatever reason they use uppercase.
    
This led to warnings like this:
    
    Unexpected char A
    Unexpected char D
    Unexpected char D
    Unexpected char B

Signed-off-by: Vince Weaver <[email protected]>

diff --git a/syscalls/perf_event_open.c b/syscalls/perf_event_open.c
index dd434bb..e299765 100644
--- a/syscalls/perf_event_open.c
+++ b/syscalls/perf_event_open.c
@@ -245,16 +245,20 @@ static int parse_generic(int pmu, const char *value,
 				if (value[ptr]==0) break;
 				if (value[ptr]==',') break;
 				if (! ( ((value[ptr]>='0') && (value[ptr]<='9'))
-                   			|| ((value[ptr]>='a') && (value[ptr]<='f'))) ) {
+					|| ((value[ptr]>='a') && (value[ptr]<='f'))
+					|| ((value[ptr]>='A') && (value[ptr]<='F'))) ) {
 					outputerr("Unexpected char %c\n", value[ptr]);
 				}
 				temp*=base;
 				if ((value[ptr]>='0') && (value[ptr]<='9')) {
 					temp+=value[ptr]-'0';
 				}
-				else {
+				else if ((value[ptr]>='a') && (value[ptr]<='f')) {
 					temp+=(value[ptr]-'a')+10;
 				}
+				else {
+					temp+=(value[ptr]-'A')+10;
+				}
 				i++;
 				ptr++;
 			}