]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: perf: fix compiler warning with gcc 4.6.4 (and tidy code)
authorRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 19 Jun 2014 09:39:41 +0000 (10:39 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 19 Jun 2014 10:29:39 +0000 (11:29 +0100)
commita329e0c633bc9f5caab629d1e743b9638f77c293
tree1db75548afd45a72fd968949372c01330a608a51
parentc40e61d5f1091677d778607f15c9251e02b35088
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>
arch/arm/kernel/perf_event_v7.c