aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-06-19 05:39:41 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-06-19 06:29:39 -0400
commit6a78371acebfe1e9d9eda218a835d712193d35a5 (patch)
tree1db75548afd45a72fd968949372c01330a608a51
parenta641f3a6abce7e884d15adf073599bb2f2651203 (diff)
ARM: perf: fix compiler warning with gcc 4.6.4 (and tidy code)
GCC 4.6.4 spits out the following warning when building perf_event_v7.c: arch/arm/kernel/perf_event_v7.c: In function 'krait_pmu_get_event_idx': arch/arm/kernel/perf_event_v7.c:1927:6: warning: 'bit' may be used uninitialized in this function While upgrading the version of gcc may solve this, the code can also be organised to be more efficient by not carrying more local variables than is necessary across the armv7pmu_get_event_idx function call. If we set 'bit' to -1 (which is invalid for clear_bit) we can use that as an indication whether we need to clear a bit after this function. Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/kernel/perf_event_v7.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index 2037f7205987..1d37568c547a 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -1924,7 +1924,7 @@ static int krait_pmu_get_event_idx(struct pmu_hw_events *cpuc,
1924 struct perf_event *event) 1924 struct perf_event *event)
1925{ 1925{
1926 int idx; 1926 int idx;
1927 int bit; 1927 int bit = -1;
1928 unsigned int prefix; 1928 unsigned int prefix;
1929 unsigned int region; 1929 unsigned int region;
1930 unsigned int code; 1930 unsigned int code;
@@ -1953,7 +1953,7 @@ static int krait_pmu_get_event_idx(struct pmu_hw_events *cpuc,
1953 } 1953 }
1954 1954
1955 idx = armv7pmu_get_event_idx(cpuc, event); 1955 idx = armv7pmu_get_event_idx(cpuc, event);
1956 if (idx < 0 && krait_event) 1956 if (idx < 0 && bit >= 0)
1957 clear_bit(bit, cpuc->used_mask); 1957 clear_bit(bit, cpuc->used_mask);
1958 1958
1959 return idx; 1959 return idx;