diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2013-09-27 08:50:06 -0400 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2013-11-06 00:11:41 -0500 |
commit | 0a4c40a3b702730c8b1ad0952e6501e84fadd395 (patch) | |
tree | 13a1b5cf43a2ba4bb1aa43b944c91367200b20d2 /arch/arc | |
parent | 0dafafc3ef42bad34fd446725cb9778c3bdd83a8 (diff) |
ARC: Fix bogus gcc warning and micro-optimise TLB iteration loop
------------------>8----------------------
arch/arc/mm/tlb.c: In function ‘do_tlb_overlap_fault’:
arch/arc/mm/tlb.c:688:13: warning: array subscript is above array bounds
[-Warray-bounds]
(pd0[n] & PAGE_MASK)) {
^
------------------>8----------------------
While at it, remove the usless last iteration of outer loop when reading
a TLB SET for duplicate entries.
Suggested-by: Mischa Jonker <mjonker@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc')
-rw-r--r-- | arch/arc/mm/tlb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c index 71cb26df4255..5f53050abf60 100644 --- a/arch/arc/mm/tlb.c +++ b/arch/arc/mm/tlb.c | |||
@@ -610,9 +610,9 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address, | |||
610 | struct pt_regs *regs) | 610 | struct pt_regs *regs) |
611 | { | 611 | { |
612 | int set, way, n; | 612 | int set, way, n; |
613 | unsigned int pd0[4], pd1[4]; /* assume max 4 ways */ | ||
614 | unsigned long flags, is_valid; | 613 | unsigned long flags, is_valid; |
615 | struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu; | 614 | struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu; |
615 | unsigned int pd0[mmu->ways], pd1[mmu->ways]; | ||
616 | 616 | ||
617 | local_irq_save(flags); | 617 | local_irq_save(flags); |
618 | 618 | ||
@@ -637,7 +637,7 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address, | |||
637 | continue; | 637 | continue; |
638 | 638 | ||
639 | /* Scan the set for duplicate ways: needs a nested loop */ | 639 | /* Scan the set for duplicate ways: needs a nested loop */ |
640 | for (way = 0; way < mmu->ways; way++) { | 640 | for (way = 0; way < mmu->ways - 1; way++) { |
641 | if (!pd0[way]) | 641 | if (!pd0[way]) |
642 | continue; | 642 | continue; |
643 | 643 | ||