Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 208add1d authored by Mahesh Sivasubramanian's avatar Mahesh Sivasubramanian Committed by Gerrit - the friendly Code Review server
Browse files

msm: pm: Fix errors with gcc 4.9



Switching to gcc 4.9 throws a "iteration 3u undefined behavior" when
variables are updated by function returns and the function in itself
takes the variable as a parameter. Fix issue by using a local variable
to store the intermediate value

Also, fix a issue where the variable counter_name could be indexed
incorrectly by explicitly declaring the size of the variable.

Change-Id: I5e0adfef36b139ee2173a4242193cabd3413911e
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
parent b5a909ab
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -690,7 +690,7 @@ static inline u32 msm_pc_debug_counters_read_register(
	return readl_relaxed(reg + (index * 4 + offset) * 4);
}

static char *counter_name[] = {
char *counter_name[MSM_PC_NUM_COUNTERS] = {
		"PC Entry Counter",
		"Warmboot Entry Counter",
		"PC Bailout Counter"
@@ -702,19 +702,24 @@ static int msm_pc_debug_counters_copy(
	int j;
	u32 stat;
	unsigned int cpu;
	unsigned int len;

	for_each_possible_cpu(cpu) {
		data->len += scnprintf(data->buf + data->len,
		len = scnprintf(data->buf + data->len,
				sizeof(data->buf)-data->len,
				"CPU%d\n", cpu);

		data->len += len;

		for (j = 0; j < MSM_PC_NUM_COUNTERS; j++) {
			stat = msm_pc_debug_counters_read_register(
				data->reg, cpu, j);
			data->len += scnprintf(data->buf + data->len,
			 len = scnprintf(data->buf + data->len,
					 sizeof(data->buf) - data->len,
					"\t%s : %d\n", counter_name[j],
					stat);
					"\t%s: %d", counter_name[j], stat);

			 data->len += len;

		}

	}