[PATCH] PowerPC: Remove trailing comma in cpu_name.

Carl Love <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
OProfile maintainers:

A recent kernel for a Power 9 platform has the following entry in
/proc/cpuinfo for the cpu, "POWER9, altivec supported".  The comma
after the name POWER9 is being returned as part of the CPU type  string
by the function _get_cpuinfo_cpu_type_line in op_cpu_type.c.  This
results in the call to op_get_cpu_number() in the Power specific
function _get_ppc64_cpu_type() to not find the processor type.  The net
effect is operf and ophelp exit on an invalid CPU type.  The following
patch removes any trailing commas in the Power processor cpu name.

The patch has been tested on a Power 8LE and a Power9 system.

Please let me know if the patch is acceptable.  Thanks.

                        Carl Love


----------------------------------------
PowerPC: Remove trailing comma in cpu_name.

The processor type for some Power 9 systems had a comma after POWER9.
Remove the comma before returning the string for the CPU.
---
 libop/op_cpu_type.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
index feea948..e96360f 100644
--- a/libop/op_cpu_type.c
+++ b/libop/op_cpu_type.c
@@ -171,6 +171,11 @@ static char * _get_cpuinfo_cpu_type_line(char * buf, int len, const char * prefi
 		}
 	}
 
+	/* Remove comma the end of the name if it exists.   */
+	end = buf;
+	if (*(--end) == ',')
+		*(--buf) = '\0';
+
 	fclose(fp);
 	return ret;
 }
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.