]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/arc-fix-build-warnings.patch
fixes for 4.14
[thirdparty/kernel/stable-queue.git] / queue-4.14 / arc-fix-build-warnings.patch
1 From c9426cce5b2d967299248c6e20d89361e5ee9154 Mon Sep 17 00:00:00 2001
2 From: Vineet Gupta <vgupta@synopsys.com>
3 Date: Tue, 7 May 2019 10:45:24 -0700
4 Subject: ARC: fix build warnings
5
6 [ Upstream commit 89c92142f75eb80064f5b9f1111484b1b4d81790 ]
7
8 | arch/arc/mm/tlb.c:914:2: warning: variable length array 'pd0' is used [-Wvla]
9 | arch/arc/include/asm/cmpxchg.h:95:29: warning: value computed is not used [-Wunused-value]
10
11 Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
12 Signed-off-by: Sasha Levin <sashal@kernel.org>
13 ---
14 arch/arc/include/asm/cmpxchg.h | 14 ++++++++++----
15 arch/arc/mm/tlb.c | 13 ++++++++-----
16 2 files changed, 18 insertions(+), 9 deletions(-)
17
18 diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h
19 index d819de1c5d10..3ea4112c8302 100644
20 --- a/arch/arc/include/asm/cmpxchg.h
21 +++ b/arch/arc/include/asm/cmpxchg.h
22 @@ -92,8 +92,11 @@ __cmpxchg(volatile void *ptr, unsigned long expected, unsigned long new)
23
24 #endif /* CONFIG_ARC_HAS_LLSC */
25
26 -#define cmpxchg(ptr, o, n) ((typeof(*(ptr)))__cmpxchg((ptr), \
27 - (unsigned long)(o), (unsigned long)(n)))
28 +#define cmpxchg(ptr, o, n) ({ \
29 + (typeof(*(ptr)))__cmpxchg((ptr), \
30 + (unsigned long)(o), \
31 + (unsigned long)(n)); \
32 +})
33
34 /*
35 * atomic_cmpxchg is same as cmpxchg
36 @@ -198,8 +201,11 @@ static inline unsigned long __xchg(unsigned long val, volatile void *ptr,
37 return __xchg_bad_pointer();
38 }
39
40 -#define xchg(ptr, with) ((typeof(*(ptr)))__xchg((unsigned long)(with), (ptr), \
41 - sizeof(*(ptr))))
42 +#define xchg(ptr, with) ({ \
43 + (typeof(*(ptr)))__xchg((unsigned long)(with), \
44 + (ptr), \
45 + sizeof(*(ptr))); \
46 +})
47
48 #endif /* CONFIG_ARC_PLAT_EZNPS */
49
50 diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c
51 index 8ceefbf72fb0..e5817b9b2c3f 100644
52 --- a/arch/arc/mm/tlb.c
53 +++ b/arch/arc/mm/tlb.c
54 @@ -902,9 +902,11 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
55 struct pt_regs *regs)
56 {
57 struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu;
58 - unsigned int pd0[mmu->ways];
59 unsigned long flags;
60 - int set;
61 + int set, n_ways = mmu->ways;
62 +
63 + n_ways = min(n_ways, 4);
64 + BUG_ON(mmu->ways > 4);
65
66 local_irq_save(flags);
67
68 @@ -912,9 +914,10 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
69 for (set = 0; set < mmu->sets; set++) {
70
71 int is_valid, way;
72 + unsigned int pd0[4];
73
74 /* read out all the ways of current set */
75 - for (way = 0, is_valid = 0; way < mmu->ways; way++) {
76 + for (way = 0, is_valid = 0; way < n_ways; way++) {
77 write_aux_reg(ARC_REG_TLBINDEX,
78 SET_WAY_TO_IDX(mmu, set, way));
79 write_aux_reg(ARC_REG_TLBCOMMAND, TLBRead);
80 @@ -928,14 +931,14 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
81 continue;
82
83 /* Scan the set for duplicate ways: needs a nested loop */
84 - for (way = 0; way < mmu->ways - 1; way++) {
85 + for (way = 0; way < n_ways - 1; way++) {
86
87 int n;
88
89 if (!pd0[way])
90 continue;
91
92 - for (n = way + 1; n < mmu->ways; n++) {
93 + for (n = way + 1; n < n_ways; n++) {
94 if (pd0[way] != pd0[n])
95 continue;
96
97 --
98 2.20.1
99