Blame SOURCES/oprofile-power9_recog.patch

56142a
commit c474cd3ddfcb2fe68f38745675f4c4d9ef79dfc5
56142a
Author: Carl Love <cel@us.ibm.com>
56142a
Date:   Tue Mar 27 13:07:37 2018 -0700
56142a
56142a
    PowerPC: Remove trailing comma in cpu_name.
56142a
    
56142a
    Will:
56142a
    
56142a
    I redid the patch as follows per your suggestions.  I was able to get
56142a
    on to a system where the issue occurs and test the patch.  The patch
56142a
    seems to work fine.
56142a
    
56142a
                       Carl Love
56142a
    
56142a
    -----------------------------------------------------------------------
56142a
    
56142a
    The processor type for some Power 9 systems had a comma after POWER9.
56142a
    Remove the comma before returning the string for the CPU.
56142a
56142a
diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
56142a
index feea9487..d2babd18 100644
56142a
--- a/libop/op_cpu_type.c
56142a
+++ b/libop/op_cpu_type.c
56142a
@@ -154,17 +154,17 @@ static char * _get_cpuinfo_cpu_type_line(char * buf, int len, const char * prefi
56142a
 			/* if token param 0 then read the whole line else
56142a
 			 * first token only. */
56142a
 			if (token == 0) {
56142a
-				/* Trim trailing whitespace */
56142a
+				/* Trim trailing whitespace and commas */
56142a
 				end = buf + strlen(buf) - 1;
56142a
-				while (isspace(*end))
56142a
+				while (isspace(*end) || *end == ',')
56142a
 					--end;
56142a
 				*(++end) = '\0';
56142a
 				break;
56142a
 			} else {
56142a
 				/* Scan ahead to the end of the token */
56142a
-				while (*buf && !isspace(*buf))
56142a
+				while (*buf && !(isspace(*buf) || *buf == ','))
56142a
 					++buf;
56142a
-				/* Trim trailing whitespace */
56142a
+				/* Trim trailing whitespace and commas */
56142a
 				*buf = '\0';
56142a
 				break;
56142a
 			}