Magellan Linux

Annotation of /trunk/kernel-alx-legacy/patches-4.9/0310-4.9.211-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3608 - (hide annotations) (download)
Fri Aug 14 07:34:29 2020 UTC (4 years, 1 month ago) by niro
File size: 113114 byte(s)
-added kerenl-alx-legacy pkg
1 niro 3608 diff --git a/Documentation/ABI/testing/sysfs-bus-mei b/Documentation/ABI/testing/sysfs-bus-mei
2     index 6bd45346ac7e..3f8701e8fa24 100644
3     --- a/Documentation/ABI/testing/sysfs-bus-mei
4     +++ b/Documentation/ABI/testing/sysfs-bus-mei
5     @@ -4,7 +4,7 @@ KernelVersion: 3.10
6     Contact: Samuel Ortiz <sameo@linux.intel.com>
7     linux-mei@linux.intel.com
8     Description: Stores the same MODALIAS value emitted by uevent
9     - Format: mei:<mei device name>:<device uuid>:
10     + Format: mei:<mei device name>:<device uuid>:<protocol version>
11    
12     What: /sys/bus/mei/devices/.../name
13     Date: May 2015
14     diff --git a/Makefile b/Makefile
15     index aa871ec44dd9..7fd68e080fe4 100644
16     --- a/Makefile
17     +++ b/Makefile
18     @@ -1,6 +1,6 @@
19     VERSION = 4
20     PATCHLEVEL = 9
21     -SUBLEVEL = 210
22     +SUBLEVEL = 211
23     EXTRAVERSION =
24     NAME = Roaring Lionus
25    
26     diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
27     index e79f3defe002..c2ad4f97cef0 100644
28     --- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
29     +++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
30     @@ -56,10 +56,10 @@
31    
32     pmu {
33     compatible = "arm,armv8-pmuv3";
34     - interrupts = <0 120 8>,
35     - <0 121 8>,
36     - <0 122 8>,
37     - <0 123 8>;
38     + interrupts = <0 170 4>,
39     + <0 171 4>,
40     + <0 172 4>,
41     + <0 173 4>;
42     interrupt-affinity = <&cpu0>,
43     <&cpu1>,
44     <&cpu2>,
45     diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
46     index 547519abc751..ff721659eb94 100644
47     --- a/arch/arm64/include/asm/kvm_mmu.h
48     +++ b/arch/arm64/include/asm/kvm_mmu.h
49     @@ -300,6 +300,11 @@ static inline bool __kvm_cpu_uses_extended_idmap(void)
50     return __cpu_uses_extended_idmap();
51     }
52    
53     +/*
54     + * Can't use pgd_populate here, because the extended idmap adds an extra level
55     + * above CONFIG_PGTABLE_LEVELS (which is 2 or 3 if we're using the extended
56     + * idmap), and pgd_populate is only available if CONFIG_PGTABLE_LEVELS = 4.
57     + */
58     static inline void __kvm_extend_hypmap(pgd_t *boot_hyp_pgd,
59     pgd_t *hyp_pgd,
60     pgd_t *merged_hyp_pgd,
61     diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
62     index 56ba1389a95a..199f434f99a4 100644
63     --- a/arch/arm64/include/asm/pgtable.h
64     +++ b/arch/arm64/include/asm/pgtable.h
65     @@ -353,6 +353,7 @@ static inline int pmd_protnone(pmd_t pmd)
66    
67     #define pud_write(pud) pte_write(pud_pte(pud))
68     #define pud_pfn(pud) (((pud_val(pud) & PUD_MASK) & PHYS_MASK) >> PAGE_SHIFT)
69     +#define pfn_pud(pfn,prot) (__pud(((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot)))
70    
71     #define set_pmd_at(mm, addr, pmdp, pmd) set_pte_at(mm, addr, (pte_t *)pmdp, pmd_pte(pmd))
72    
73     diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
74     index 76c9b51fa7f1..c4aec129ed20 100644
75     --- a/arch/arm64/kernel/hibernate.c
76     +++ b/arch/arm64/kernel/hibernate.c
77     @@ -247,8 +247,7 @@ static int create_safe_exec_page(void *src_start, size_t length,
78     }
79    
80     pte = pte_offset_kernel(pmd, dst_addr);
81     - set_pte(pte, __pte(virt_to_phys((void *)dst) |
82     - pgprot_val(PAGE_KERNEL_EXEC)));
83     + set_pte(pte, pfn_pte(virt_to_pfn(dst), PAGE_KERNEL_EXEC));
84    
85     /*
86     * Load our new page tables. A strict BBM approach requires that we
87     diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
88     index efd65fc85238..60be5bc0984a 100644
89     --- a/arch/arm64/mm/mmu.c
90     +++ b/arch/arm64/mm/mmu.c
91     @@ -28,8 +28,6 @@
92     #include <linux/memblock.h>
93     #include <linux/fs.h>
94     #include <linux/io.h>
95     -#include <linux/slab.h>
96     -#include <linux/stop_machine.h>
97    
98     #include <asm/barrier.h>
99     #include <asm/cputype.h>
100     @@ -95,6 +93,17 @@ static phys_addr_t __init early_pgtable_alloc(void)
101     return phys;
102     }
103    
104     +static bool pgattr_change_is_safe(u64 old, u64 new)
105     +{
106     + /*
107     + * The following mapping attributes may be updated in live
108     + * kernel mappings without the need for break-before-make.
109     + */
110     + static const pteval_t mask = PTE_PXN | PTE_RDONLY | PTE_WRITE;
111     +
112     + return old == 0 || new == 0 || ((old ^ new) & ~mask) == 0;
113     +}
114     +
115     static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
116     unsigned long end, unsigned long pfn,
117     pgprot_t prot,
118     @@ -115,8 +124,17 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
119    
120     pte = pte_set_fixmap_offset(pmd, addr);
121     do {
122     + pte_t old_pte = *pte;
123     +
124     set_pte(pte, pfn_pte(pfn, prot));
125     pfn++;
126     +
127     + /*
128     + * After the PTE entry has been populated once, we
129     + * only allow updates to the permission attributes.
130     + */
131     + BUG_ON(!pgattr_change_is_safe(pte_val(old_pte), pte_val(*pte)));
132     +
133     } while (pte++, addr += PAGE_SIZE, addr != end);
134    
135     pte_clear_fixmap();
136     @@ -146,27 +164,27 @@ static void alloc_init_pmd(pud_t *pud, unsigned long addr, unsigned long end,
137    
138     pmd = pmd_set_fixmap_offset(pud, addr);
139     do {
140     + pmd_t old_pmd = *pmd;
141     +
142     next = pmd_addr_end(addr, end);
143     +
144     /* try section mapping first */
145     if (((addr | next | phys) & ~SECTION_MASK) == 0 &&
146     allow_block_mappings) {
147     - pmd_t old_pmd =*pmd;
148     pmd_set_huge(pmd, phys, prot);
149     +
150     /*
151     - * Check for previous table entries created during
152     - * boot (__create_page_tables) and flush them.
153     + * After the PMD entry has been populated once, we
154     + * only allow updates to the permission attributes.
155     */
156     - if (!pmd_none(old_pmd)) {
157     - flush_tlb_all();
158     - if (pmd_table(old_pmd)) {
159     - phys_addr_t table = pmd_page_paddr(old_pmd);
160     - if (!WARN_ON_ONCE(slab_is_available()))
161     - memblock_free(table, PAGE_SIZE);
162     - }
163     - }
164     + BUG_ON(!pgattr_change_is_safe(pmd_val(old_pmd),
165     + pmd_val(*pmd)));
166     } else {
167     alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys),
168     prot, pgtable_alloc);
169     +
170     + BUG_ON(pmd_val(old_pmd) != 0 &&
171     + pmd_val(old_pmd) != pmd_val(*pmd));
172     }
173     phys += next - addr;
174     } while (pmd++, addr = next, addr != end);
175     @@ -204,33 +222,28 @@ static void alloc_init_pud(pgd_t *pgd, unsigned long addr, unsigned long end,
176    
177     pud = pud_set_fixmap_offset(pgd, addr);
178     do {
179     + pud_t old_pud = *pud;
180     +
181     next = pud_addr_end(addr, end);
182    
183     /*
184     * For 4K granule only, attempt to put down a 1GB block
185     */
186     if (use_1G_block(addr, next, phys) && allow_block_mappings) {
187     - pud_t old_pud = *pud;
188     pud_set_huge(pud, phys, prot);
189    
190     /*
191     - * If we have an old value for a pud, it will
192     - * be pointing to a pmd table that we no longer
193     - * need (from swapper_pg_dir).
194     - *
195     - * Look up the old pmd table and free it.
196     + * After the PUD entry has been populated once, we
197     + * only allow updates to the permission attributes.
198     */
199     - if (!pud_none(old_pud)) {
200     - flush_tlb_all();
201     - if (pud_table(old_pud)) {
202     - phys_addr_t table = pud_page_paddr(old_pud);
203     - if (!WARN_ON_ONCE(slab_is_available()))
204     - memblock_free(table, PAGE_SIZE);
205     - }
206     - }
207     + BUG_ON(!pgattr_change_is_safe(pud_val(old_pud),
208     + pud_val(*pud)));
209     } else {
210     alloc_init_pmd(pud, addr, next, phys, prot,
211     pgtable_alloc, allow_block_mappings);
212     +
213     + BUG_ON(pud_val(old_pud) != 0 &&
214     + pud_val(old_pud) != pud_val(*pud));
215     }
216     phys += next - addr;
217     } while (pud++, addr = next, addr != end);
218     @@ -396,6 +409,9 @@ void mark_rodata_ro(void)
219     section_size = (unsigned long)__init_begin - (unsigned long)__start_rodata;
220     create_mapping_late(__pa(__start_rodata), (unsigned long)__start_rodata,
221     section_size, PAGE_KERNEL_RO);
222     +
223     + /* flush the TLBs after updating live kernel mappings */
224     + flush_tlb_all();
225     }
226    
227     static void __init map_kernel_segment(pgd_t *pgd, void *va_start, void *va_end,
228     @@ -479,8 +495,8 @@ static void __init map_kernel(pgd_t *pgd)
229     * entry instead.
230     */
231     BUG_ON(!IS_ENABLED(CONFIG_ARM64_16K_PAGES));
232     - set_pud(pud_set_fixmap_offset(pgd, FIXADDR_START),
233     - __pud(__pa(bm_pmd) | PUD_TYPE_TABLE));
234     + pud_populate(&init_mm, pud_set_fixmap_offset(pgd, FIXADDR_START),
235     + lm_alias(bm_pmd));
236     pud_clear_fixmap();
237     } else {
238     BUG();
239     @@ -595,7 +611,7 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
240     if (!p)
241     return -ENOMEM;
242    
243     - set_pmd(pmd, __pmd(__pa(p) | PROT_SECT_NORMAL));
244     + pmd_set_huge(pmd, __pa(p), __pgprot(PROT_SECT_NORMAL));
245     } else
246     vmemmap_verify((pte_t *)pmd, node, addr, next);
247     } while (addr = next, addr != end);
248     @@ -779,17 +795,35 @@ int __init arch_ioremap_pmd_supported(void)
249     return !IS_ENABLED(CONFIG_ARM64_PTDUMP_DEBUGFS);
250     }
251    
252     -int pud_set_huge(pud_t *pud, phys_addr_t phys, pgprot_t prot)
253     +int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot)
254     {
255     + pgprot_t sect_prot = __pgprot(PUD_TYPE_SECT |
256     + pgprot_val(mk_sect_prot(prot)));
257     + pud_t new_pud = pfn_pud(__phys_to_pfn(phys), sect_prot);
258     +
259     + /* Only allow permission changes for now */
260     + if (!pgattr_change_is_safe(READ_ONCE(pud_val(*pudp)),
261     + pud_val(new_pud)))
262     + return 0;
263     +
264     BUG_ON(phys & ~PUD_MASK);
265     - set_pud(pud, __pud(phys | PUD_TYPE_SECT | pgprot_val(mk_sect_prot(prot))));
266     + set_pud(pudp, new_pud);
267     return 1;
268     }
269    
270     -int pmd_set_huge(pmd_t *pmd, phys_addr_t phys, pgprot_t prot)
271     +int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot)
272     {
273     + pgprot_t sect_prot = __pgprot(PMD_TYPE_SECT |
274     + pgprot_val(mk_sect_prot(prot)));
275     + pmd_t new_pmd = pfn_pmd(__phys_to_pfn(phys), sect_prot);
276     +
277     + /* Only allow permission changes for now */
278     + if (!pgattr_change_is_safe(READ_ONCE(pmd_val(*pmdp)),
279     + pmd_val(new_pmd)))
280     + return 0;
281     +
282     BUG_ON(phys & ~PMD_MASK);
283     - set_pmd(pmd, __pmd(phys | PMD_TYPE_SECT | pgprot_val(mk_sect_prot(prot))));
284     + set_pmd(pmdp, new_pmd);
285     return 1;
286     }
287    
288     diff --git a/arch/hexagon/include/asm/atomic.h b/arch/hexagon/include/asm/atomic.h
289     index a62ba368b27d..1ae06190b68f 100644
290     --- a/arch/hexagon/include/asm/atomic.h
291     +++ b/arch/hexagon/include/asm/atomic.h
292     @@ -103,7 +103,7 @@ static inline void atomic_##op(int i, atomic_t *v) \
293     "1: %0 = memw_locked(%1);\n" \
294     " %0 = "#op "(%0,%2);\n" \
295     " memw_locked(%1,P3)=%0;\n" \
296     - " if !P3 jump 1b;\n" \
297     + " if (!P3) jump 1b;\n" \
298     : "=&r" (output) \
299     : "r" (&v->counter), "r" (i) \
300     : "memory", "p3" \
301     @@ -119,7 +119,7 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \
302     "1: %0 = memw_locked(%1);\n" \
303     " %0 = "#op "(%0,%2);\n" \
304     " memw_locked(%1,P3)=%0;\n" \
305     - " if !P3 jump 1b;\n" \
306     + " if (!P3) jump 1b;\n" \
307     : "=&r" (output) \
308     : "r" (&v->counter), "r" (i) \
309     : "memory", "p3" \
310     @@ -136,7 +136,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \
311     "1: %0 = memw_locked(%2);\n" \
312     " %1 = "#op "(%0,%3);\n" \
313     " memw_locked(%2,P3)=%1;\n" \
314     - " if !P3 jump 1b;\n" \
315     + " if (!P3) jump 1b;\n" \
316     : "=&r" (output), "=&r" (val) \
317     : "r" (&v->counter), "r" (i) \
318     : "memory", "p3" \
319     @@ -185,7 +185,7 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
320     " }"
321     " memw_locked(%2, p3) = %1;"
322     " {"
323     - " if !p3 jump 1b;"
324     + " if (!p3) jump 1b;"
325     " }"
326     "2:"
327     : "=&r" (__oldval), "=&r" (tmp)
328     diff --git a/arch/hexagon/include/asm/bitops.h b/arch/hexagon/include/asm/bitops.h
329     index 2691a1857d20..634306cda006 100644
330     --- a/arch/hexagon/include/asm/bitops.h
331     +++ b/arch/hexagon/include/asm/bitops.h
332     @@ -52,7 +52,7 @@ static inline int test_and_clear_bit(int nr, volatile void *addr)
333     "1: R12 = memw_locked(R10);\n"
334     " { P0 = tstbit(R12,R11); R12 = clrbit(R12,R11); }\n"
335     " memw_locked(R10,P1) = R12;\n"
336     - " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n"
337     + " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n"
338     : "=&r" (oldval)
339     : "r" (addr), "r" (nr)
340     : "r10", "r11", "r12", "p0", "p1", "memory"
341     @@ -76,7 +76,7 @@ static inline int test_and_set_bit(int nr, volatile void *addr)
342     "1: R12 = memw_locked(R10);\n"
343     " { P0 = tstbit(R12,R11); R12 = setbit(R12,R11); }\n"
344     " memw_locked(R10,P1) = R12;\n"
345     - " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n"
346     + " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n"
347     : "=&r" (oldval)
348     : "r" (addr), "r" (nr)
349     : "r10", "r11", "r12", "p0", "p1", "memory"
350     @@ -102,7 +102,7 @@ static inline int test_and_change_bit(int nr, volatile void *addr)
351     "1: R12 = memw_locked(R10);\n"
352     " { P0 = tstbit(R12,R11); R12 = togglebit(R12,R11); }\n"
353     " memw_locked(R10,P1) = R12;\n"
354     - " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n"
355     + " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n"
356     : "=&r" (oldval)
357     : "r" (addr), "r" (nr)
358     : "r10", "r11", "r12", "p0", "p1", "memory"
359     @@ -237,7 +237,7 @@ static inline int ffs(int x)
360     int r;
361    
362     asm("{ P0 = cmp.eq(%1,#0); %0 = ct0(%1);}\n"
363     - "{ if P0 %0 = #0; if !P0 %0 = add(%0,#1);}\n"
364     + "{ if (P0) %0 = #0; if (!P0) %0 = add(%0,#1);}\n"
365     : "=&r" (r)
366     : "r" (x)
367     : "p0");
368     diff --git a/arch/hexagon/include/asm/cmpxchg.h b/arch/hexagon/include/asm/cmpxchg.h
369     index a6e34e2acbba..db258424059f 100644
370     --- a/arch/hexagon/include/asm/cmpxchg.h
371     +++ b/arch/hexagon/include/asm/cmpxchg.h
372     @@ -44,7 +44,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
373     __asm__ __volatile__ (
374     "1: %0 = memw_locked(%1);\n" /* load into retval */
375     " memw_locked(%1,P0) = %2;\n" /* store into memory */
376     - " if !P0 jump 1b;\n"
377     + " if (!P0) jump 1b;\n"
378     : "=&r" (retval)
379     : "r" (ptr), "r" (x)
380     : "memory", "p0"
381     diff --git a/arch/hexagon/include/asm/futex.h b/arch/hexagon/include/asm/futex.h
382     index c607b77c8215..12bd92f3ea41 100644
383     --- a/arch/hexagon/include/asm/futex.h
384     +++ b/arch/hexagon/include/asm/futex.h
385     @@ -15,7 +15,7 @@
386     /* For example: %1 = %4 */ \
387     insn \
388     "2: memw_locked(%3,p2) = %1;\n" \
389     - " if !p2 jump 1b;\n" \
390     + " if (!p2) jump 1b;\n" \
391     " %1 = #0;\n" \
392     "3:\n" \
393     ".section .fixup,\"ax\"\n" \
394     @@ -83,10 +83,10 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval,
395     "1: %1 = memw_locked(%3)\n"
396     " {\n"
397     " p2 = cmp.eq(%1,%4)\n"
398     - " if !p2.new jump:NT 3f\n"
399     + " if (!p2.new) jump:NT 3f\n"
400     " }\n"
401     "2: memw_locked(%3,p2) = %5\n"
402     - " if !p2 jump 1b\n"
403     + " if (!p2) jump 1b\n"
404     "3:\n"
405     ".section .fixup,\"ax\"\n"
406     "4: %0 = #%6\n"
407     diff --git a/arch/hexagon/include/asm/spinlock.h b/arch/hexagon/include/asm/spinlock.h
408     index a1c55788c5d6..f61bb3185305 100644
409     --- a/arch/hexagon/include/asm/spinlock.h
410     +++ b/arch/hexagon/include/asm/spinlock.h
411     @@ -44,9 +44,9 @@ static inline void arch_read_lock(arch_rwlock_t *lock)
412     __asm__ __volatile__(
413     "1: R6 = memw_locked(%0);\n"
414     " { P3 = cmp.ge(R6,#0); R6 = add(R6,#1);}\n"
415     - " { if !P3 jump 1b; }\n"
416     + " { if (!P3) jump 1b; }\n"
417     " memw_locked(%0,P3) = R6;\n"
418     - " { if !P3 jump 1b; }\n"
419     + " { if (!P3) jump 1b; }\n"
420     :
421     : "r" (&lock->lock)
422     : "memory", "r6", "p3"
423     @@ -60,7 +60,7 @@ static inline void arch_read_unlock(arch_rwlock_t *lock)
424     "1: R6 = memw_locked(%0);\n"
425     " R6 = add(R6,#-1);\n"
426     " memw_locked(%0,P3) = R6\n"
427     - " if !P3 jump 1b;\n"
428     + " if (!P3) jump 1b;\n"
429     :
430     : "r" (&lock->lock)
431     : "memory", "r6", "p3"
432     @@ -75,7 +75,7 @@ static inline int arch_read_trylock(arch_rwlock_t *lock)
433     __asm__ __volatile__(
434     " R6 = memw_locked(%1);\n"
435     " { %0 = #0; P3 = cmp.ge(R6,#0); R6 = add(R6,#1);}\n"
436     - " { if !P3 jump 1f; }\n"
437     + " { if (!P3) jump 1f; }\n"
438     " memw_locked(%1,P3) = R6;\n"
439     " { %0 = P3 }\n"
440     "1:\n"
441     @@ -102,9 +102,9 @@ static inline void arch_write_lock(arch_rwlock_t *lock)
442     __asm__ __volatile__(
443     "1: R6 = memw_locked(%0)\n"
444     " { P3 = cmp.eq(R6,#0); R6 = #-1;}\n"
445     - " { if !P3 jump 1b; }\n"
446     + " { if (!P3) jump 1b; }\n"
447     " memw_locked(%0,P3) = R6;\n"
448     - " { if !P3 jump 1b; }\n"
449     + " { if (!P3) jump 1b; }\n"
450     :
451     : "r" (&lock->lock)
452     : "memory", "r6", "p3"
453     @@ -118,7 +118,7 @@ static inline int arch_write_trylock(arch_rwlock_t *lock)
454     __asm__ __volatile__(
455     " R6 = memw_locked(%1)\n"
456     " { %0 = #0; P3 = cmp.eq(R6,#0); R6 = #-1;}\n"
457     - " { if !P3 jump 1f; }\n"
458     + " { if (!P3) jump 1f; }\n"
459     " memw_locked(%1,P3) = R6;\n"
460     " %0 = P3;\n"
461     "1:\n"
462     @@ -141,9 +141,9 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
463     __asm__ __volatile__(
464     "1: R6 = memw_locked(%0);\n"
465     " P3 = cmp.eq(R6,#0);\n"
466     - " { if !P3 jump 1b; R6 = #1; }\n"
467     + " { if (!P3) jump 1b; R6 = #1; }\n"
468     " memw_locked(%0,P3) = R6;\n"
469     - " { if !P3 jump 1b; }\n"
470     + " { if (!P3) jump 1b; }\n"
471     :
472     : "r" (&lock->lock)
473     : "memory", "r6", "p3"
474     @@ -163,7 +163,7 @@ static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock)
475     __asm__ __volatile__(
476     " R6 = memw_locked(%1);\n"
477     " P3 = cmp.eq(R6,#0);\n"
478     - " { if !P3 jump 1f; R6 = #1; %0 = #0; }\n"
479     + " { if (!P3) jump 1f; R6 = #1; %0 = #0; }\n"
480     " memw_locked(%1,P3) = R6;\n"
481     " %0 = P3;\n"
482     "1:\n"
483     diff --git a/arch/hexagon/kernel/stacktrace.c b/arch/hexagon/kernel/stacktrace.c
484     index f94918b449a8..03a0e10ecdcc 100644
485     --- a/arch/hexagon/kernel/stacktrace.c
486     +++ b/arch/hexagon/kernel/stacktrace.c
487     @@ -23,8 +23,6 @@
488     #include <linux/thread_info.h>
489     #include <linux/module.h>
490    
491     -register unsigned long current_frame_pointer asm("r30");
492     -
493     struct stackframe {
494     unsigned long fp;
495     unsigned long rets;
496     @@ -42,7 +40,7 @@ void save_stack_trace(struct stack_trace *trace)
497    
498     low = (unsigned long)task_stack_page(current);
499     high = low + THREAD_SIZE;
500     - fp = current_frame_pointer;
501     + fp = (unsigned long)__builtin_frame_address(0);
502    
503     while (fp >= low && fp <= (high - sizeof(*frame))) {
504     frame = (struct stackframe *)fp;
505     diff --git a/arch/hexagon/kernel/vm_entry.S b/arch/hexagon/kernel/vm_entry.S
506     index 67c6ccc14770..9f4a73ff7203 100644
507     --- a/arch/hexagon/kernel/vm_entry.S
508     +++ b/arch/hexagon/kernel/vm_entry.S
509     @@ -382,7 +382,7 @@ ret_from_fork:
510     R26.L = #LO(do_work_pending);
511     R0 = #VM_INT_DISABLE;
512     }
513     - if P0 jump check_work_pending
514     + if (P0) jump check_work_pending
515     {
516     R0 = R25;
517     callr R24
518     diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
519     index ad31c76c7a29..2f77e250b91d 100644
520     --- a/arch/mips/boot/compressed/Makefile
521     +++ b/arch/mips/boot/compressed/Makefile
522     @@ -29,6 +29,9 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
523     -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
524     -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
525    
526     +# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
527     +KCOV_INSTRUMENT := n
528     +
529     # decompressor objects (linked with vmlinuz)
530     vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o
531    
532     diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
533     index 98cc8ba07c23..00dbf1e895a9 100644
534     --- a/arch/powerpc/platforms/powernv/pci.c
535     +++ b/arch/powerpc/platforms/powernv/pci.c
536     @@ -923,6 +923,23 @@ void __init pnv_pci_init(void)
537     if (!firmware_has_feature(FW_FEATURE_OPAL))
538     return;
539    
540     +#ifdef CONFIG_PCIEPORTBUS
541     + /*
542     + * On PowerNV PCIe devices are (currently) managed in cooperation
543     + * with firmware. This isn't *strictly* required, but there's enough
544     + * assumptions baked into both firmware and the platform code that
545     + * it's unwise to allow the portbus services to be used.
546     + *
547     + * We need to fix this eventually, but for now set this flag to disable
548     + * the portbus driver. The AER service isn't required since that AER
549     + * events are handled via EEH. The pciehp hotplug driver can't work
550     + * without kernel changes (and portbus binding breaks pnv_php). The
551     + * other services also require some thinking about how we're going
552     + * to integrate them.
553     + */
554     + pcie_ports_disabled = true;
555     +#endif
556     +
557     /* Look for IODA IO-Hubs. */
558     for_each_compatible_node(np, NULL, "ibm,ioda-hub") {
559     pnv_pci_init_ioda_hub(np);
560     diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
561     index efdfba21a5b2..9e3a183561a9 100644
562     --- a/arch/x86/boot/compressed/head_64.S
563     +++ b/arch/x86/boot/compressed/head_64.S
564     @@ -227,6 +227,11 @@ ENTRY(efi32_stub_entry)
565     leal efi32_config(%ebp), %eax
566     movl %eax, efi_config(%ebp)
567    
568     + /* Disable paging */
569     + movl %cr0, %eax
570     + btrl $X86_CR0_PG_BIT, %eax
571     + movl %eax, %cr0
572     +
573     jmp startup_32
574     ENDPROC(efi32_stub_entry)
575     #endif
576     diff --git a/block/blk-settings.c b/block/blk-settings.c
577     index f679ae122843..0d644f37e3c6 100644
578     --- a/block/blk-settings.c
579     +++ b/block/blk-settings.c
580     @@ -349,7 +349,7 @@ EXPORT_SYMBOL(blk_queue_max_segment_size);
581     * storage device can address. The default of 512 covers most
582     * hardware.
583     **/
584     -void blk_queue_logical_block_size(struct request_queue *q, unsigned short size)
585     +void blk_queue_logical_block_size(struct request_queue *q, unsigned int size)
586     {
587     q->limits.logical_block_size = size;
588    
589     diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
590     index c08ee8cf1e29..6ee3e928ebf1 100644
591     --- a/drivers/block/xen-blkfront.c
592     +++ b/drivers/block/xen-blkfront.c
593     @@ -1104,8 +1104,8 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
594     if (!VDEV_IS_EXTENDED(info->vdevice)) {
595     err = xen_translate_vdev(info->vdevice, &minor, &offset);
596     if (err)
597     - return err;
598     - nr_parts = PARTS_PER_DISK;
599     + return err;
600     + nr_parts = PARTS_PER_DISK;
601     } else {
602     minor = BLKIF_MINOR_EXT(info->vdevice);
603     nr_parts = PARTS_PER_EXT_DISK;
604     diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
605     index c745dad7f85e..af4f2ffc4fc5 100644
606     --- a/drivers/clk/clk.c
607     +++ b/drivers/clk/clk.c
608     @@ -2448,11 +2448,17 @@ static int __clk_core_init(struct clk_core *core)
609     if (core->flags & CLK_IS_CRITICAL) {
610     unsigned long flags;
611    
612     - clk_core_prepare(core);
613     + ret = clk_core_prepare(core);
614     + if (ret)
615     + goto out;
616    
617     flags = clk_enable_lock();
618     - clk_core_enable(core);
619     + ret = clk_core_enable(core);
620     clk_enable_unlock(flags);
621     + if (ret) {
622     + clk_core_unprepare(core);
623     + goto out;
624     + }
625     }
626    
627     /*
628     diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c
629     index 2bb88d125113..7f8c7cf3c2ab 100644
630     --- a/drivers/clk/samsung/clk-exynos5420.c
631     +++ b/drivers/clk/samsung/clk-exynos5420.c
632     @@ -170,6 +170,8 @@ static const unsigned long exynos5x_clk_regs[] __initconst = {
633     GATE_BUS_CPU,
634     GATE_SCLK_CPU,
635     CLKOUT_CMU_CPU,
636     + APLL_CON0,
637     + KPLL_CON0,
638     CPLL_CON0,
639     DPLL_CON0,
640     EPLL_CON0,
641     diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
642     index 49386ce04bf5..1389f0582e29 100644
643     --- a/drivers/dma/ioat/dma.c
644     +++ b/drivers/dma/ioat/dma.c
645     @@ -394,10 +394,11 @@ ioat_alloc_ring(struct dma_chan *c, int order, gfp_t flags)
646    
647     descs->virt = dma_alloc_coherent(to_dev(ioat_chan),
648     SZ_2M, &descs->hw, flags);
649     - if (!descs->virt && (i > 0)) {
650     + if (!descs->virt) {
651     int idx;
652    
653     for (idx = 0; idx < i; idx++) {
654     + descs = &ioat_chan->descs[idx];
655     dma_free_coherent(to_dev(ioat_chan), SZ_2M,
656     descs->virt, descs->hw);
657     descs->virt = NULL;
658     diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
659     index bd777687233b..b67f61d31e25 100644
660     --- a/drivers/gpio/gpio-mpc8xxx.c
661     +++ b/drivers/gpio/gpio-mpc8xxx.c
662     @@ -306,6 +306,7 @@ static int mpc8xxx_probe(struct platform_device *pdev)
663     return -ENOMEM;
664    
665     gc = &mpc8xxx_gc->gc;
666     + gc->parent = &pdev->dev;
667    
668     if (of_property_read_bool(np, "little-endian")) {
669     ret = bgpio_init(gc, &pdev->dev, 4,
670     diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
671     index 58193c939691..505dead07619 100644
672     --- a/drivers/gpio/gpiolib.c
673     +++ b/drivers/gpio/gpiolib.c
674     @@ -3049,8 +3049,9 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id,
675    
676     if (chip->ngpio <= p->chip_hwnum) {
677     dev_err(dev,
678     - "requested GPIO %d is out of range [0..%d] for chip %s\n",
679     - idx, chip->ngpio, chip->label);
680     + "requested GPIO %u (%u) is out of range [0..%u] for chip %s\n",
681     + idx, p->chip_hwnum, chip->ngpio - 1,
682     + chip->label);
683     return ERR_PTR(-EINVAL);
684     }
685    
686     diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
687     index 750c16897130..ed6591f92f71 100644
688     --- a/drivers/hid/hidraw.c
689     +++ b/drivers/hid/hidraw.c
690     @@ -257,13 +257,14 @@ out:
691     static unsigned int hidraw_poll(struct file *file, poll_table *wait)
692     {
693     struct hidraw_list *list = file->private_data;
694     + unsigned int mask = POLLOUT | POLLWRNORM; /* hidraw is always writable */
695    
696     poll_wait(file, &list->hidraw->wait, wait);
697     if (list->head != list->tail)
698     - return POLLIN | POLLRDNORM;
699     + mask |= POLLIN | POLLRDNORM;
700     if (!list->hidraw->exist)
701     - return POLLERR | POLLHUP;
702     - return 0;
703     + mask |= POLLERR | POLLHUP;
704     + return mask;
705     }
706    
707     static int hidraw_open(struct inode *inode, struct file *file)
708     diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
709     index d9b46da0e0aa..731a7b3e0187 100644
710     --- a/drivers/hid/uhid.c
711     +++ b/drivers/hid/uhid.c
712     @@ -769,13 +769,14 @@ unlock:
713     static unsigned int uhid_char_poll(struct file *file, poll_table *wait)
714     {
715     struct uhid_device *uhid = file->private_data;
716     + unsigned int mask = POLLOUT | POLLWRNORM; /* uhid is always writable */
717    
718     poll_wait(file, &uhid->waitq, wait);
719    
720     if (uhid->head != uhid->tail)
721     - return POLLIN | POLLRDNORM;
722     + mask |= POLLIN | POLLRDNORM;
723    
724     - return EPOLLOUT | EPOLLWRNORM;
725     + return mask;
726     }
727    
728     static const struct file_operations uhid_fops = {
729     diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
730     index c950aa10d0ae..5abe095901c8 100644
731     --- a/drivers/iio/imu/adis16480.c
732     +++ b/drivers/iio/imu/adis16480.c
733     @@ -372,12 +372,14 @@ static int adis16480_get_calibbias(struct iio_dev *indio_dev,
734     case IIO_MAGN:
735     case IIO_PRESSURE:
736     ret = adis_read_reg_16(&st->adis, reg, &val16);
737     - *bias = sign_extend32(val16, 15);
738     + if (ret == 0)
739     + *bias = sign_extend32(val16, 15);
740     break;
741     case IIO_ANGL_VEL:
742     case IIO_ACCEL:
743     ret = adis_read_reg_32(&st->adis, reg, &val32);
744     - *bias = sign_extend32(val32, 31);
745     + if (ret == 0)
746     + *bias = sign_extend32(val32, 31);
747     break;
748     default:
749     ret = -EINVAL;
750     diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
751     index 5d05c38c4ba9..2f037cd59d53 100644
752     --- a/drivers/iio/industrialio-buffer.c
753     +++ b/drivers/iio/industrialio-buffer.c
754     @@ -546,7 +546,7 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev,
755     const unsigned long *mask, bool timestamp)
756     {
757     unsigned bytes = 0;
758     - int length, i;
759     + int length, i, largest = 0;
760    
761     /* How much space will the demuxed element take? */
762     for_each_set_bit(i, mask,
763     @@ -554,13 +554,17 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev,
764     length = iio_storage_bytes_for_si(indio_dev, i);
765     bytes = ALIGN(bytes, length);
766     bytes += length;
767     + largest = max(largest, length);
768     }
769    
770     if (timestamp) {
771     length = iio_storage_bytes_for_timestamp(indio_dev);
772     bytes = ALIGN(bytes, length);
773     bytes += length;
774     + largest = max(largest, length);
775     }
776     +
777     + bytes = ALIGN(bytes, largest);
778     return bytes;
779     }
780    
781     diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
782     index 6914cc18b4a1..8acf337c3691 100644
783     --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
784     +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
785     @@ -1234,9 +1234,11 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch,
786     struct srpt_send_ioctx *ioctx, u64 tag,
787     int status)
788     {
789     + struct se_cmd *cmd = &ioctx->cmd;
790     struct srp_rsp *srp_rsp;
791     const u8 *sense_data;
792     int sense_data_len, max_sense_len;
793     + u32 resid = cmd->residual_count;
794    
795     /*
796     * The lowest bit of all SAM-3 status codes is zero (see also
797     @@ -1258,6 +1260,28 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch,
798     srp_rsp->tag = tag;
799     srp_rsp->status = status;
800    
801     + if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) {
802     + if (cmd->data_direction == DMA_TO_DEVICE) {
803     + /* residual data from an underflow write */
804     + srp_rsp->flags = SRP_RSP_FLAG_DOUNDER;
805     + srp_rsp->data_out_res_cnt = cpu_to_be32(resid);
806     + } else if (cmd->data_direction == DMA_FROM_DEVICE) {
807     + /* residual data from an underflow read */
808     + srp_rsp->flags = SRP_RSP_FLAG_DIUNDER;
809     + srp_rsp->data_in_res_cnt = cpu_to_be32(resid);
810     + }
811     + } else if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) {
812     + if (cmd->data_direction == DMA_TO_DEVICE) {
813     + /* residual data from an overflow write */
814     + srp_rsp->flags = SRP_RSP_FLAG_DOOVER;
815     + srp_rsp->data_out_res_cnt = cpu_to_be32(resid);
816     + } else if (cmd->data_direction == DMA_FROM_DEVICE) {
817     + /* residual data from an overflow read */
818     + srp_rsp->flags = SRP_RSP_FLAG_DIOVER;
819     + srp_rsp->data_in_res_cnt = cpu_to_be32(resid);
820     + }
821     + }
822     +
823     if (sense_data_len) {
824     BUILD_BUG_ON(MIN_MAX_RSP_SIZE <= sizeof(*srp_rsp));
825     max_sense_len = ch->max_ti_iu_len - sizeof(*srp_rsp);
826     diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
827     index 87d3060f8609..71b89e47e952 100644
828     --- a/drivers/iommu/iommu.c
829     +++ b/drivers/iommu/iommu.c
830     @@ -439,6 +439,7 @@ err_put_group:
831     mutex_unlock(&group->mutex);
832     dev->iommu_group = NULL;
833     kobject_put(group->devices_kobj);
834     + sysfs_remove_link(group->devices_kobj, device->name);
835     err_free_name:
836     kfree(device->name);
837     err_remove_link:
838     diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
839     index b8cf956b577b..771ec28e87cb 100644
840     --- a/drivers/md/dm-snap-persistent.c
841     +++ b/drivers/md/dm-snap-persistent.c
842     @@ -17,7 +17,7 @@
843     #include "dm-bufio.h"
844    
845     #define DM_MSG_PREFIX "persistent snapshot"
846     -#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32 /* 16KB */
847     +#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32U /* 16KB */
848    
849     #define DM_PREFETCH_CHUNKS 12
850    
851     diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
852     index 258986a2699d..cf745211799f 100644
853     --- a/drivers/md/raid0.c
854     +++ b/drivers/md/raid0.c
855     @@ -82,7 +82,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
856     char b[BDEVNAME_SIZE];
857     char b2[BDEVNAME_SIZE];
858     struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
859     - unsigned short blksize = 512;
860     + unsigned blksize = 512;
861    
862     *private_conf = ERR_PTR(-ENOMEM);
863     if (!conf)
864     diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
865     index e00fa03ddc3e..0c0eec671d49 100644
866     --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
867     +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
868     @@ -316,7 +316,7 @@ static int isp_video_release(struct file *file)
869     ivc->streaming = 0;
870     }
871    
872     - vb2_fop_release(file);
873     + _vb2_fop_release(file, NULL);
874    
875     if (v4l2_fh_is_singular_file(file)) {
876     fimc_pipeline_call(&ivc->ve, close);
877     diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c
878     index e3735bfcc02f..c5513f55e64e 100644
879     --- a/drivers/media/usb/zr364xx/zr364xx.c
880     +++ b/drivers/media/usb/zr364xx/zr364xx.c
881     @@ -711,7 +711,8 @@ static int zr364xx_vidioc_querycap(struct file *file, void *priv,
882     struct zr364xx_camera *cam = video_drvdata(file);
883    
884     strlcpy(cap->driver, DRIVER_DESC, sizeof(cap->driver));
885     - strlcpy(cap->card, cam->udev->product, sizeof(cap->card));
886     + if (cam->udev->product)
887     + strlcpy(cap->card, cam->udev->product, sizeof(cap->card));
888     strlcpy(cap->bus_info, dev_name(&cam->udev->dev),
889     sizeof(cap->bus_info));
890     cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
891     diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
892     index 14cf6dfc3b14..4d837bcad5db 100644
893     --- a/drivers/message/fusion/mptctl.c
894     +++ b/drivers/message/fusion/mptctl.c
895     @@ -100,19 +100,19 @@ struct buflist {
896     * Function prototypes. Called from OS entry point mptctl_ioctl.
897     * arg contents specific to function.
898     */
899     -static int mptctl_fw_download(unsigned long arg);
900     -static int mptctl_getiocinfo(unsigned long arg, unsigned int cmd);
901     -static int mptctl_gettargetinfo(unsigned long arg);
902     -static int mptctl_readtest(unsigned long arg);
903     -static int mptctl_mpt_command(unsigned long arg);
904     -static int mptctl_eventquery(unsigned long arg);
905     -static int mptctl_eventenable(unsigned long arg);
906     -static int mptctl_eventreport(unsigned long arg);
907     -static int mptctl_replace_fw(unsigned long arg);
908     -
909     -static int mptctl_do_reset(unsigned long arg);
910     -static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd);
911     -static int mptctl_hp_targetinfo(unsigned long arg);
912     +static int mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg);
913     +static int mptctl_getiocinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd);
914     +static int mptctl_gettargetinfo(MPT_ADAPTER *iocp, unsigned long arg);
915     +static int mptctl_readtest(MPT_ADAPTER *iocp, unsigned long arg);
916     +static int mptctl_mpt_command(MPT_ADAPTER *iocp, unsigned long arg);
917     +static int mptctl_eventquery(MPT_ADAPTER *iocp, unsigned long arg);
918     +static int mptctl_eventenable(MPT_ADAPTER *iocp, unsigned long arg);
919     +static int mptctl_eventreport(MPT_ADAPTER *iocp, unsigned long arg);
920     +static int mptctl_replace_fw(MPT_ADAPTER *iocp, unsigned long arg);
921     +
922     +static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg);
923     +static int mptctl_hp_hostinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd);
924     +static int mptctl_hp_targetinfo(MPT_ADAPTER *iocp, unsigned long arg);
925    
926     static int mptctl_probe(struct pci_dev *, const struct pci_device_id *);
927     static void mptctl_remove(struct pci_dev *);
928     @@ -123,8 +123,8 @@ static long compat_mpctl_ioctl(struct file *f, unsigned cmd, unsigned long arg);
929     /*
930     * Private function calls.
931     */
932     -static int mptctl_do_mpt_command(struct mpt_ioctl_command karg, void __user *mfPtr);
933     -static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen);
934     +static int mptctl_do_mpt_command(MPT_ADAPTER *iocp, struct mpt_ioctl_command karg, void __user *mfPtr);
935     +static int mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen);
936     static MptSge_t *kbuf_alloc_2_sgl(int bytes, u32 dir, int sge_offset, int *frags,
937     struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc);
938     static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma,
939     @@ -656,19 +656,19 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
940     * by TM and FW reloads.
941     */
942     if ((cmd & ~IOCSIZE_MASK) == (MPTIOCINFO & ~IOCSIZE_MASK)) {
943     - return mptctl_getiocinfo(arg, _IOC_SIZE(cmd));
944     + return mptctl_getiocinfo(iocp, arg, _IOC_SIZE(cmd));
945     } else if (cmd == MPTTARGETINFO) {
946     - return mptctl_gettargetinfo(arg);
947     + return mptctl_gettargetinfo(iocp, arg);
948     } else if (cmd == MPTTEST) {
949     - return mptctl_readtest(arg);
950     + return mptctl_readtest(iocp, arg);
951     } else if (cmd == MPTEVENTQUERY) {
952     - return mptctl_eventquery(arg);
953     + return mptctl_eventquery(iocp, arg);
954     } else if (cmd == MPTEVENTENABLE) {
955     - return mptctl_eventenable(arg);
956     + return mptctl_eventenable(iocp, arg);
957     } else if (cmd == MPTEVENTREPORT) {
958     - return mptctl_eventreport(arg);
959     + return mptctl_eventreport(iocp, arg);
960     } else if (cmd == MPTFWREPLACE) {
961     - return mptctl_replace_fw(arg);
962     + return mptctl_replace_fw(iocp, arg);
963     }
964    
965     /* All of these commands require an interrupt or
966     @@ -678,15 +678,15 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
967     return ret;
968    
969     if (cmd == MPTFWDOWNLOAD)
970     - ret = mptctl_fw_download(arg);
971     + ret = mptctl_fw_download(iocp, arg);
972     else if (cmd == MPTCOMMAND)
973     - ret = mptctl_mpt_command(arg);
974     + ret = mptctl_mpt_command(iocp, arg);
975     else if (cmd == MPTHARDRESET)
976     - ret = mptctl_do_reset(arg);
977     + ret = mptctl_do_reset(iocp, arg);
978     else if ((cmd & ~IOCSIZE_MASK) == (HP_GETHOSTINFO & ~IOCSIZE_MASK))
979     - ret = mptctl_hp_hostinfo(arg, _IOC_SIZE(cmd));
980     + ret = mptctl_hp_hostinfo(iocp, arg, _IOC_SIZE(cmd));
981     else if (cmd == HP_GETTARGETINFO)
982     - ret = mptctl_hp_targetinfo(arg);
983     + ret = mptctl_hp_targetinfo(iocp, arg);
984     else
985     ret = -EINVAL;
986    
987     @@ -705,11 +705,10 @@ mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
988     return ret;
989     }
990    
991     -static int mptctl_do_reset(unsigned long arg)
992     +static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg)
993     {
994     struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg;
995     struct mpt_ioctl_diag_reset krinfo;
996     - MPT_ADAPTER *iocp;
997    
998     if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) {
999     printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - "
1000     @@ -718,12 +717,6 @@ static int mptctl_do_reset(unsigned long arg)
1001     return -EFAULT;
1002     }
1003    
1004     - if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) {
1005     - printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n",
1006     - __FILE__, __LINE__, krinfo.hdr.iocnum);
1007     - return -ENODEV; /* (-6) No such device or address */
1008     - }
1009     -
1010     dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "mptctl_do_reset called.\n",
1011     iocp->name));
1012    
1013     @@ -754,7 +747,7 @@ static int mptctl_do_reset(unsigned long arg)
1014     * -ENOMSG if FW upload returned bad status
1015     */
1016     static int
1017     -mptctl_fw_download(unsigned long arg)
1018     +mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg)
1019     {
1020     struct mpt_fw_xfer __user *ufwdl = (void __user *) arg;
1021     struct mpt_fw_xfer kfwdl;
1022     @@ -766,7 +759,7 @@ mptctl_fw_download(unsigned long arg)
1023     return -EFAULT;
1024     }
1025    
1026     - return mptctl_do_fw_download(kfwdl.iocnum, kfwdl.bufp, kfwdl.fwlen);
1027     + return mptctl_do_fw_download(iocp, kfwdl.bufp, kfwdl.fwlen);
1028     }
1029    
1030     /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1031     @@ -784,11 +777,10 @@ mptctl_fw_download(unsigned long arg)
1032     * -ENOMSG if FW upload returned bad status
1033     */
1034     static int
1035     -mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
1036     +mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen)
1037     {
1038     FWDownload_t *dlmsg;
1039     MPT_FRAME_HDR *mf;
1040     - MPT_ADAPTER *iocp;
1041     FWDownloadTCSGE_t *ptsge;
1042     MptSge_t *sgl, *sgIn;
1043     char *sgOut;
1044     @@ -808,17 +800,10 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
1045     pFWDownloadReply_t ReplyMsg = NULL;
1046     unsigned long timeleft;
1047    
1048     - if (mpt_verify_adapter(ioc, &iocp) < 0) {
1049     - printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n",
1050     - ioc);
1051     - return -ENODEV; /* (-6) No such device or address */
1052     - } else {
1053     -
1054     - /* Valid device. Get a message frame and construct the FW download message.
1055     - */
1056     - if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL)
1057     - return -EAGAIN;
1058     - }
1059     + /* Valid device. Get a message frame and construct the FW download message.
1060     + */
1061     + if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL)
1062     + return -EAGAIN;
1063    
1064     dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT
1065     "mptctl_do_fwdl called. mptctl_id = %xh.\n", iocp->name, mptctl_id));
1066     @@ -826,8 +811,6 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
1067     iocp->name, ufwbuf));
1068     dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.fwlen = %d\n",
1069     iocp->name, (int)fwlen));
1070     - dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.ioc = %04xh\n",
1071     - iocp->name, ioc));
1072    
1073     dlmsg = (FWDownload_t*) mf;
1074     ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL;
1075     @@ -1238,13 +1221,11 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
1076     * -ENODEV if no such device/adapter
1077     */
1078     static int
1079     -mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1080     +mptctl_getiocinfo (MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
1081     {
1082     struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg;
1083     struct mpt_ioctl_iocinfo *karg;
1084     - MPT_ADAPTER *ioc;
1085     struct pci_dev *pdev;
1086     - int iocnum;
1087     unsigned int port;
1088     int cim_rev;
1089     struct scsi_device *sdev;
1090     @@ -1272,14 +1253,6 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1091     return PTR_ERR(karg);
1092     }
1093    
1094     - if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) ||
1095     - (ioc == NULL)) {
1096     - printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
1097     - __FILE__, __LINE__, iocnum);
1098     - kfree(karg);
1099     - return -ENODEV;
1100     - }
1101     -
1102     /* Verify the data transfer size is correct. */
1103     if (karg->hdr.maxDataSize != data_size) {
1104     printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - "
1105     @@ -1385,15 +1358,13 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1106     * -ENODEV if no such device/adapter
1107     */
1108     static int
1109     -mptctl_gettargetinfo (unsigned long arg)
1110     +mptctl_gettargetinfo (MPT_ADAPTER *ioc, unsigned long arg)
1111     {
1112     struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg;
1113     struct mpt_ioctl_targetinfo karg;
1114     - MPT_ADAPTER *ioc;
1115     VirtDevice *vdevice;
1116     char *pmem;
1117     int *pdata;
1118     - int iocnum;
1119     int numDevices = 0;
1120     int lun;
1121     int maxWordsLeft;
1122     @@ -1408,13 +1379,6 @@ mptctl_gettargetinfo (unsigned long arg)
1123     return -EFAULT;
1124     }
1125    
1126     - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1127     - (ioc == NULL)) {
1128     - printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n",
1129     - __FILE__, __LINE__, iocnum);
1130     - return -ENODEV;
1131     - }
1132     -
1133     dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_gettargetinfo called.\n",
1134     ioc->name));
1135     /* Get the port number and set the maximum number of bytes
1136     @@ -1510,12 +1474,10 @@ mptctl_gettargetinfo (unsigned long arg)
1137     * -ENODEV if no such device/adapter
1138     */
1139     static int
1140     -mptctl_readtest (unsigned long arg)
1141     +mptctl_readtest (MPT_ADAPTER *ioc, unsigned long arg)
1142     {
1143     struct mpt_ioctl_test __user *uarg = (void __user *) arg;
1144     struct mpt_ioctl_test karg;
1145     - MPT_ADAPTER *ioc;
1146     - int iocnum;
1147    
1148     if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) {
1149     printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - "
1150     @@ -1524,13 +1486,6 @@ mptctl_readtest (unsigned long arg)
1151     return -EFAULT;
1152     }
1153    
1154     - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1155     - (ioc == NULL)) {
1156     - printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n",
1157     - __FILE__, __LINE__, iocnum);
1158     - return -ENODEV;
1159     - }
1160     -
1161     dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_readtest called.\n",
1162     ioc->name));
1163     /* Fill in the data and return the structure to the calling
1164     @@ -1571,12 +1526,10 @@ mptctl_readtest (unsigned long arg)
1165     * -ENODEV if no such device/adapter
1166     */
1167     static int
1168     -mptctl_eventquery (unsigned long arg)
1169     +mptctl_eventquery (MPT_ADAPTER *ioc, unsigned long arg)
1170     {
1171     struct mpt_ioctl_eventquery __user *uarg = (void __user *) arg;
1172     struct mpt_ioctl_eventquery karg;
1173     - MPT_ADAPTER *ioc;
1174     - int iocnum;
1175    
1176     if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) {
1177     printk(KERN_ERR MYNAM "%s@%d::mptctl_eventquery - "
1178     @@ -1585,13 +1538,6 @@ mptctl_eventquery (unsigned long arg)
1179     return -EFAULT;
1180     }
1181    
1182     - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1183     - (ioc == NULL)) {
1184     - printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n",
1185     - __FILE__, __LINE__, iocnum);
1186     - return -ENODEV;
1187     - }
1188     -
1189     dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventquery called.\n",
1190     ioc->name));
1191     karg.eventEntries = MPTCTL_EVENT_LOG_SIZE;
1192     @@ -1610,12 +1556,10 @@ mptctl_eventquery (unsigned long arg)
1193    
1194     /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1195     static int
1196     -mptctl_eventenable (unsigned long arg)
1197     +mptctl_eventenable (MPT_ADAPTER *ioc, unsigned long arg)
1198     {
1199     struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg;
1200     struct mpt_ioctl_eventenable karg;
1201     - MPT_ADAPTER *ioc;
1202     - int iocnum;
1203    
1204     if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) {
1205     printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - "
1206     @@ -1624,13 +1568,6 @@ mptctl_eventenable (unsigned long arg)
1207     return -EFAULT;
1208     }
1209    
1210     - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1211     - (ioc == NULL)) {
1212     - printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n",
1213     - __FILE__, __LINE__, iocnum);
1214     - return -ENODEV;
1215     - }
1216     -
1217     dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventenable called.\n",
1218     ioc->name));
1219     if (ioc->events == NULL) {
1220     @@ -1658,12 +1595,10 @@ mptctl_eventenable (unsigned long arg)
1221    
1222     /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1223     static int
1224     -mptctl_eventreport (unsigned long arg)
1225     +mptctl_eventreport (MPT_ADAPTER *ioc, unsigned long arg)
1226     {
1227     struct mpt_ioctl_eventreport __user *uarg = (void __user *) arg;
1228     struct mpt_ioctl_eventreport karg;
1229     - MPT_ADAPTER *ioc;
1230     - int iocnum;
1231     int numBytes, maxEvents, max;
1232    
1233     if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) {
1234     @@ -1673,12 +1608,6 @@ mptctl_eventreport (unsigned long arg)
1235     return -EFAULT;
1236     }
1237    
1238     - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1239     - (ioc == NULL)) {
1240     - printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n",
1241     - __FILE__, __LINE__, iocnum);
1242     - return -ENODEV;
1243     - }
1244     dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventreport called.\n",
1245     ioc->name));
1246    
1247     @@ -1712,12 +1641,10 @@ mptctl_eventreport (unsigned long arg)
1248    
1249     /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1250     static int
1251     -mptctl_replace_fw (unsigned long arg)
1252     +mptctl_replace_fw (MPT_ADAPTER *ioc, unsigned long arg)
1253     {
1254     struct mpt_ioctl_replace_fw __user *uarg = (void __user *) arg;
1255     struct mpt_ioctl_replace_fw karg;
1256     - MPT_ADAPTER *ioc;
1257     - int iocnum;
1258     int newFwSize;
1259    
1260     if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) {
1261     @@ -1727,13 +1654,6 @@ mptctl_replace_fw (unsigned long arg)
1262     return -EFAULT;
1263     }
1264    
1265     - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1266     - (ioc == NULL)) {
1267     - printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n",
1268     - __FILE__, __LINE__, iocnum);
1269     - return -ENODEV;
1270     - }
1271     -
1272     dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_replace_fw called.\n",
1273     ioc->name));
1274     /* If caching FW, Free the old FW image
1275     @@ -1780,12 +1700,10 @@ mptctl_replace_fw (unsigned long arg)
1276     * -ENOMEM if memory allocation error
1277     */
1278     static int
1279     -mptctl_mpt_command (unsigned long arg)
1280     +mptctl_mpt_command (MPT_ADAPTER *ioc, unsigned long arg)
1281     {
1282     struct mpt_ioctl_command __user *uarg = (void __user *) arg;
1283     struct mpt_ioctl_command karg;
1284     - MPT_ADAPTER *ioc;
1285     - int iocnum;
1286     int rc;
1287    
1288    
1289     @@ -1796,14 +1714,7 @@ mptctl_mpt_command (unsigned long arg)
1290     return -EFAULT;
1291     }
1292    
1293     - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1294     - (ioc == NULL)) {
1295     - printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n",
1296     - __FILE__, __LINE__, iocnum);
1297     - return -ENODEV;
1298     - }
1299     -
1300     - rc = mptctl_do_mpt_command (karg, &uarg->MF);
1301     + rc = mptctl_do_mpt_command (ioc, karg, &uarg->MF);
1302    
1303     return rc;
1304     }
1305     @@ -1821,9 +1732,8 @@ mptctl_mpt_command (unsigned long arg)
1306     * -EPERM if SCSI I/O and target is untagged
1307     */
1308     static int
1309     -mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1310     +mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __user *mfPtr)
1311     {
1312     - MPT_ADAPTER *ioc;
1313     MPT_FRAME_HDR *mf = NULL;
1314     MPIHeader_t *hdr;
1315     char *psge;
1316     @@ -1832,7 +1742,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1317     dma_addr_t dma_addr_in;
1318     dma_addr_t dma_addr_out;
1319     int sgSize = 0; /* Num SG elements */
1320     - int iocnum, flagsLength;
1321     + int flagsLength;
1322     int sz, rc = 0;
1323     int msgContext;
1324     u16 req_idx;
1325     @@ -1847,13 +1757,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1326     bufIn.kptr = bufOut.kptr = NULL;
1327     bufIn.len = bufOut.len = 0;
1328    
1329     - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1330     - (ioc == NULL)) {
1331     - printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n",
1332     - __FILE__, __LINE__, iocnum);
1333     - return -ENODEV;
1334     - }
1335     -
1336     spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
1337     if (ioc->ioc_reset_in_progress) {
1338     spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
1339     @@ -2418,17 +2321,15 @@ done_free_mem:
1340     * -ENOMEM if memory allocation error
1341     */
1342     static int
1343     -mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
1344     +mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
1345     {
1346     hp_host_info_t __user *uarg = (void __user *) arg;
1347     - MPT_ADAPTER *ioc;
1348     struct pci_dev *pdev;
1349     char *pbuf=NULL;
1350     dma_addr_t buf_dma;
1351     hp_host_info_t karg;
1352     CONFIGPARMS cfg;
1353     ConfigPageHeader_t hdr;
1354     - int iocnum;
1355     int rc, cim_rev;
1356     ToolboxIstwiReadWriteRequest_t *IstwiRWRequest;
1357     MPT_FRAME_HDR *mf = NULL;
1358     @@ -2452,12 +2353,6 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
1359     return -EFAULT;
1360     }
1361    
1362     - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1363     - (ioc == NULL)) {
1364     - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n",
1365     - __FILE__, __LINE__, iocnum);
1366     - return -ENODEV;
1367     - }
1368     dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_hostinfo called.\n",
1369     ioc->name));
1370    
1371     @@ -2670,15 +2565,13 @@ retry_wait:
1372     * -ENOMEM if memory allocation error
1373     */
1374     static int
1375     -mptctl_hp_targetinfo(unsigned long arg)
1376     +mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg)
1377     {
1378     hp_target_info_t __user *uarg = (void __user *) arg;
1379     SCSIDevicePage0_t *pg0_alloc;
1380     SCSIDevicePage3_t *pg3_alloc;
1381     - MPT_ADAPTER *ioc;
1382     MPT_SCSI_HOST *hd = NULL;
1383     hp_target_info_t karg;
1384     - int iocnum;
1385     int data_sz;
1386     dma_addr_t page_dma;
1387     CONFIGPARMS cfg;
1388     @@ -2692,12 +2585,6 @@ mptctl_hp_targetinfo(unsigned long arg)
1389     return -EFAULT;
1390     }
1391    
1392     - if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1393     - (ioc == NULL)) {
1394     - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n",
1395     - __FILE__, __LINE__, iocnum);
1396     - return -ENODEV;
1397     - }
1398     if (karg.hdr.id >= MPT_MAX_FC_DEVICES)
1399     return -EINVAL;
1400     dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n",
1401     @@ -2865,7 +2752,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
1402     kfw.fwlen = kfw32.fwlen;
1403     kfw.bufp = compat_ptr(kfw32.bufp);
1404    
1405     - ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen);
1406     + ret = mptctl_do_fw_download(iocp, kfw.bufp, kfw.fwlen);
1407    
1408     mutex_unlock(&iocp->ioctl_cmds.mutex);
1409    
1410     @@ -2919,7 +2806,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
1411    
1412     /* Pass new structure to do_mpt_command
1413     */
1414     - ret = mptctl_do_mpt_command (karg, &uarg->MF);
1415     + ret = mptctl_do_mpt_command (iocp, karg, &uarg->MF);
1416    
1417     mutex_unlock(&iocp->ioctl_cmds.mutex);
1418    
1419     diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
1420     index eb29113e0bac..b11737f7bdca 100644
1421     --- a/drivers/misc/enclosure.c
1422     +++ b/drivers/misc/enclosure.c
1423     @@ -419,10 +419,9 @@ int enclosure_remove_device(struct enclosure_device *edev, struct device *dev)
1424     cdev = &edev->component[i];
1425     if (cdev->dev == dev) {
1426     enclosure_remove_links(cdev);
1427     - device_del(&cdev->cdev);
1428     put_device(dev);
1429     cdev->dev = NULL;
1430     - return device_add(&cdev->cdev);
1431     + return 0;
1432     }
1433     }
1434     return -ENODEV;
1435     diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
1436     index c42523b7d5ed..63a9b53a65ed 100644
1437     --- a/drivers/mtd/spi-nor/spi-nor.c
1438     +++ b/drivers/mtd/spi-nor/spi-nor.c
1439     @@ -1046,7 +1046,7 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
1440     size_t *retlen, u_char *buf)
1441     {
1442     struct spi_nor *nor = mtd_to_spi_nor(mtd);
1443     - int ret;
1444     + ssize_t ret;
1445    
1446     dev_dbg(nor->dev, "from 0x%08x, len %zd\n", (u32)from, len);
1447    
1448     diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
1449     index e11920d12774..27c49d400bcd 100644
1450     --- a/drivers/net/ethernet/stmicro/stmmac/common.h
1451     +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
1452     @@ -326,8 +326,8 @@ struct dma_features {
1453     unsigned int enh_desc;
1454     };
1455    
1456     -/* GMAC TX FIFO is 8K, Rx FIFO is 16K */
1457     -#define BUF_SIZE_16KiB 16384
1458     +/* RX Buffer size must be multiple of 4/8/16 bytes */
1459     +#define BUF_SIZE_16KiB 16368
1460     #define BUF_SIZE_8KiB 8192
1461     #define BUF_SIZE_4KiB 4096
1462     #define BUF_SIZE_2KiB 2048
1463     diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1464     index a2b7c685cbf1..8c1a5361f661 100644
1465     --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1466     +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1467     @@ -929,7 +929,9 @@ static int stmmac_set_bfsize(int mtu, int bufsize)
1468     {
1469     int ret = bufsize;
1470    
1471     - if (mtu >= BUF_SIZE_4KiB)
1472     + if (mtu >= BUF_SIZE_8KiB)
1473     + ret = BUF_SIZE_16KiB;
1474     + else if (mtu >= BUF_SIZE_4KiB)
1475     ret = BUF_SIZE_8KiB;
1476     else if (mtu >= BUF_SIZE_2KiB)
1477     ret = BUF_SIZE_4KiB;
1478     diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
1479     index 854947b9db4e..e2b3d3c4d4df 100644
1480     --- a/drivers/net/macvlan.c
1481     +++ b/drivers/net/macvlan.c
1482     @@ -234,7 +234,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
1483     struct net_device *src,
1484     enum macvlan_mode mode)
1485     {
1486     - const struct ethhdr *eth = skb_eth_hdr(skb);
1487     + const struct ethhdr *eth = eth_hdr(skb);
1488     const struct macvlan_dev *vlan;
1489     struct sk_buff *nskb;
1490     unsigned int i;
1491     @@ -487,10 +487,11 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
1492     const struct macvlan_dev *dest;
1493    
1494     if (vlan->mode == MACVLAN_MODE_BRIDGE) {
1495     - const struct ethhdr *eth = (void *)skb->data;
1496     + const struct ethhdr *eth = skb_eth_hdr(skb);
1497    
1498     /* send to other bridge ports directly */
1499     if (is_multicast_ether_addr(eth->h_dest)) {
1500     + skb_reset_mac_header(skb);
1501     macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE);
1502     goto xmit_world;
1503     }
1504     diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
1505     index 8045cc401009..473dd79e167b 100644
1506     --- a/drivers/net/usb/lan78xx.c
1507     +++ b/drivers/net/usb/lan78xx.c
1508     @@ -3375,6 +3375,7 @@ static int lan78xx_probe(struct usb_interface *intf,
1509    
1510     if (netdev->mtu > (dev->hard_mtu - netdev->hard_header_len))
1511     netdev->mtu = dev->hard_mtu - netdev->hard_header_len;
1512     + netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER);
1513    
1514     dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0;
1515     dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1;
1516     diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
1517     index 15dc70c11857..3c037b76a0cc 100644
1518     --- a/drivers/net/usb/r8152.c
1519     +++ b/drivers/net/usb/r8152.c
1520     @@ -4365,6 +4365,9 @@ static int rtl8152_probe(struct usb_interface *intf,
1521     return -ENODEV;
1522     }
1523    
1524     + if (intf->cur_altsetting->desc.bNumEndpoints < 3)
1525     + return -ENODEV;
1526     +
1527     usb_reset_device(udev);
1528     netdev = alloc_etherdev(sizeof(struct r8152));
1529     if (!netdev) {
1530     diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
1531     index b2c1e872d5ed..af85a1b3135e 100644
1532     --- a/drivers/net/wan/fsl_ucc_hdlc.c
1533     +++ b/drivers/net/wan/fsl_ucc_hdlc.c
1534     @@ -77,7 +77,7 @@ static struct ucc_tdm_info utdm_primary_info = {
1535     },
1536     };
1537    
1538     -static struct ucc_tdm_info utdm_info[MAX_HDLC_NUM];
1539     +static struct ucc_tdm_info utdm_info[UCC_MAX_NUM];
1540    
1541     static int uhdlc_init(struct ucc_hdlc_private *priv)
1542     {
1543     diff --git a/drivers/net/wimax/i2400m/op-rfkill.c b/drivers/net/wimax/i2400m/op-rfkill.c
1544     index b0dba35a8ad2..dc6fe93ce71f 100644
1545     --- a/drivers/net/wimax/i2400m/op-rfkill.c
1546     +++ b/drivers/net/wimax/i2400m/op-rfkill.c
1547     @@ -147,6 +147,7 @@ error_msg_to_dev:
1548     error_alloc:
1549     d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n",
1550     wimax_dev, state, result);
1551     + kfree(cmd);
1552     return result;
1553     }
1554    
1555     diff --git a/drivers/net/wireless/realtek/rtlwifi/regd.c b/drivers/net/wireless/realtek/rtlwifi/regd.c
1556     index 6ee6bf8e7eaf..ab53cf42cf42 100644
1557     --- a/drivers/net/wireless/realtek/rtlwifi/regd.c
1558     +++ b/drivers/net/wireless/realtek/rtlwifi/regd.c
1559     @@ -427,7 +427,7 @@ int rtl_regd_init(struct ieee80211_hw *hw,
1560     struct wiphy *wiphy = hw->wiphy;
1561     struct country_code_to_enum_rd *country = NULL;
1562    
1563     - if (wiphy == NULL || &rtlpriv->regd == NULL)
1564     + if (!wiphy)
1565     return -EINVAL;
1566    
1567     /* init country_code from efuse channel plan */
1568     diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
1569     index dbb23899ddcb..891295ebd875 100644
1570     --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
1571     +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
1572     @@ -199,6 +199,7 @@ void rsi_mac80211_detach(struct rsi_hw *adapter)
1573     ieee80211_stop_queues(hw);
1574     ieee80211_unregister_hw(hw);
1575     ieee80211_free_hw(hw);
1576     + adapter->hw = NULL;
1577     }
1578    
1579     rsi_remove_dbgfs(adapter);
1580     diff --git a/drivers/net/wireless/st/cw1200/fwio.c b/drivers/net/wireless/st/cw1200/fwio.c
1581     index 30e7646d04af..16be7fa82a23 100644
1582     --- a/drivers/net/wireless/st/cw1200/fwio.c
1583     +++ b/drivers/net/wireless/st/cw1200/fwio.c
1584     @@ -323,12 +323,12 @@ int cw1200_load_firmware(struct cw1200_common *priv)
1585     goto out;
1586     }
1587    
1588     - priv->hw_type = cw1200_get_hw_type(val32, &major_revision);
1589     - if (priv->hw_type < 0) {
1590     + ret = cw1200_get_hw_type(val32, &major_revision);
1591     + if (ret < 0) {
1592     pr_err("Can't deduce hardware type.\n");
1593     - ret = -ENOTSUPP;
1594     goto out;
1595     }
1596     + priv->hw_type = ret;
1597    
1598     /* Set DPLL Reg value, and read back to confirm writes work */
1599     ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID,
1600     diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c
1601     index bab8ac63c4f3..3008bba360f3 100644
1602     --- a/drivers/pci/pcie/ptm.c
1603     +++ b/drivers/pci/pcie/ptm.c
1604     @@ -29,7 +29,7 @@ static void pci_ptm_info(struct pci_dev *dev)
1605     snprintf(clock_desc, sizeof(clock_desc), ">254ns");
1606     break;
1607     default:
1608     - snprintf(clock_desc, sizeof(clock_desc), "%udns",
1609     + snprintf(clock_desc, sizeof(clock_desc), "%uns",
1610     dev->ptm_granularity);
1611     break;
1612     }
1613     diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
1614     index aede41a92cac..4ae758c3d8ba 100644
1615     --- a/drivers/platform/x86/asus-wmi.c
1616     +++ b/drivers/platform/x86/asus-wmi.c
1617     @@ -461,13 +461,7 @@ static void kbd_led_update(struct work_struct *work)
1618    
1619     asus = container_of(work, struct asus_wmi, kbd_led_work);
1620    
1621     - /*
1622     - * bits 0-2: level
1623     - * bit 7: light on/off
1624     - */
1625     - if (asus->kbd_led_wk > 0)
1626     - ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F);
1627     -
1628     + ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F);
1629     asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL);
1630     }
1631    
1632     diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c
1633     index c1c5c4e3b3b4..c981301efbe5 100644
1634     --- a/drivers/rtc/rtc-msm6242.c
1635     +++ b/drivers/rtc/rtc-msm6242.c
1636     @@ -132,7 +132,8 @@ static int msm6242_read_time(struct device *dev, struct rtc_time *tm)
1637     msm6242_read(priv, MSM6242_SECOND1);
1638     tm->tm_min = msm6242_read(priv, MSM6242_MINUTE10) * 10 +
1639     msm6242_read(priv, MSM6242_MINUTE1);
1640     - tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10 & 3)) * 10 +
1641     + tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10) &
1642     + MSM6242_HOUR10_HR_MASK) * 10 +
1643     msm6242_read(priv, MSM6242_HOUR1);
1644     tm->tm_mday = msm6242_read(priv, MSM6242_DAY10) * 10 +
1645     msm6242_read(priv, MSM6242_DAY1);
1646     diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
1647     index 1a61fa56f3ad..494a7fbd512b 100644
1648     --- a/drivers/rtc/rtc-mt6397.c
1649     +++ b/drivers/rtc/rtc-mt6397.c
1650     @@ -55,6 +55,14 @@
1651    
1652     #define RTC_AL_SEC 0x0018
1653    
1654     +#define RTC_AL_SEC_MASK 0x003f
1655     +#define RTC_AL_MIN_MASK 0x003f
1656     +#define RTC_AL_HOU_MASK 0x001f
1657     +#define RTC_AL_DOM_MASK 0x001f
1658     +#define RTC_AL_DOW_MASK 0x0007
1659     +#define RTC_AL_MTH_MASK 0x000f
1660     +#define RTC_AL_YEA_MASK 0x007f
1661     +
1662     #define RTC_PDN2 0x002e
1663     #define RTC_PDN2_PWRON_ALARM BIT(4)
1664    
1665     @@ -111,7 +119,7 @@ static irqreturn_t mtk_rtc_irq_handler_thread(int irq, void *data)
1666     irqen = irqsta & ~RTC_IRQ_EN_AL;
1667     mutex_lock(&rtc->lock);
1668     if (regmap_write(rtc->regmap, rtc->addr_base + RTC_IRQ_EN,
1669     - irqen) < 0)
1670     + irqen) == 0)
1671     mtk_rtc_write_trigger(rtc);
1672     mutex_unlock(&rtc->lock);
1673    
1674     @@ -233,12 +241,12 @@ static int mtk_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
1675     alm->pending = !!(pdn2 & RTC_PDN2_PWRON_ALARM);
1676     mutex_unlock(&rtc->lock);
1677    
1678     - tm->tm_sec = data[RTC_OFFSET_SEC];
1679     - tm->tm_min = data[RTC_OFFSET_MIN];
1680     - tm->tm_hour = data[RTC_OFFSET_HOUR];
1681     - tm->tm_mday = data[RTC_OFFSET_DOM];
1682     - tm->tm_mon = data[RTC_OFFSET_MTH];
1683     - tm->tm_year = data[RTC_OFFSET_YEAR];
1684     + tm->tm_sec = data[RTC_OFFSET_SEC] & RTC_AL_SEC_MASK;
1685     + tm->tm_min = data[RTC_OFFSET_MIN] & RTC_AL_MIN_MASK;
1686     + tm->tm_hour = data[RTC_OFFSET_HOUR] & RTC_AL_HOU_MASK;
1687     + tm->tm_mday = data[RTC_OFFSET_DOM] & RTC_AL_DOM_MASK;
1688     + tm->tm_mon = data[RTC_OFFSET_MTH] & RTC_AL_MTH_MASK;
1689     + tm->tm_year = data[RTC_OFFSET_YEAR] & RTC_AL_YEA_MASK;
1690    
1691     tm->tm_year += RTC_MIN_YEAR_OFFSET;
1692     tm->tm_mon--;
1693     @@ -259,14 +267,25 @@ static int mtk_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
1694     tm->tm_year -= RTC_MIN_YEAR_OFFSET;
1695     tm->tm_mon++;
1696    
1697     - data[RTC_OFFSET_SEC] = tm->tm_sec;
1698     - data[RTC_OFFSET_MIN] = tm->tm_min;
1699     - data[RTC_OFFSET_HOUR] = tm->tm_hour;
1700     - data[RTC_OFFSET_DOM] = tm->tm_mday;
1701     - data[RTC_OFFSET_MTH] = tm->tm_mon;
1702     - data[RTC_OFFSET_YEAR] = tm->tm_year;
1703     -
1704     mutex_lock(&rtc->lock);
1705     + ret = regmap_bulk_read(rtc->regmap, rtc->addr_base + RTC_AL_SEC,
1706     + data, RTC_OFFSET_COUNT);
1707     + if (ret < 0)
1708     + goto exit;
1709     +
1710     + data[RTC_OFFSET_SEC] = ((data[RTC_OFFSET_SEC] & ~(RTC_AL_SEC_MASK)) |
1711     + (tm->tm_sec & RTC_AL_SEC_MASK));
1712     + data[RTC_OFFSET_MIN] = ((data[RTC_OFFSET_MIN] & ~(RTC_AL_MIN_MASK)) |
1713     + (tm->tm_min & RTC_AL_MIN_MASK));
1714     + data[RTC_OFFSET_HOUR] = ((data[RTC_OFFSET_HOUR] & ~(RTC_AL_HOU_MASK)) |
1715     + (tm->tm_hour & RTC_AL_HOU_MASK));
1716     + data[RTC_OFFSET_DOM] = ((data[RTC_OFFSET_DOM] & ~(RTC_AL_DOM_MASK)) |
1717     + (tm->tm_mday & RTC_AL_DOM_MASK));
1718     + data[RTC_OFFSET_MTH] = ((data[RTC_OFFSET_MTH] & ~(RTC_AL_MTH_MASK)) |
1719     + (tm->tm_mon & RTC_AL_MTH_MASK));
1720     + data[RTC_OFFSET_YEAR] = ((data[RTC_OFFSET_YEAR] & ~(RTC_AL_YEA_MASK)) |
1721     + (tm->tm_year & RTC_AL_YEA_MASK));
1722     +
1723     if (alm->enabled) {
1724     ret = regmap_bulk_write(rtc->regmap,
1725     rtc->addr_base + RTC_AL_SEC,
1726     diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
1727     index 133901fd3e35..6d1f8b22bd83 100644
1728     --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
1729     +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
1730     @@ -915,12 +915,12 @@ void bnx2i_free_hba(struct bnx2i_hba *hba)
1731     INIT_LIST_HEAD(&hba->ep_ofld_list);
1732     INIT_LIST_HEAD(&hba->ep_active_list);
1733     INIT_LIST_HEAD(&hba->ep_destroy_list);
1734     - pci_dev_put(hba->pcidev);
1735    
1736     if (hba->regview) {
1737     pci_iounmap(hba->pcidev, hba->regview);
1738     hba->regview = NULL;
1739     }
1740     + pci_dev_put(hba->pcidev);
1741     bnx2i_free_mp_bdt(hba);
1742     bnx2i_release_free_cid_que(hba);
1743     iscsi_host_free(shost);
1744     diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
1745     index e974106f2bb5..3d6e653f5147 100644
1746     --- a/drivers/scsi/cxgbi/libcxgbi.c
1747     +++ b/drivers/scsi/cxgbi/libcxgbi.c
1748     @@ -121,7 +121,8 @@ static inline void cxgbi_device_destroy(struct cxgbi_device *cdev)
1749     "cdev 0x%p, p# %u.\n", cdev, cdev->nports);
1750     cxgbi_hbas_remove(cdev);
1751     cxgbi_device_portmap_cleanup(cdev);
1752     - cxgbi_ppm_release(cdev->cdev2ppm(cdev));
1753     + if (cdev->cdev2ppm)
1754     + cxgbi_ppm_release(cdev->cdev2ppm(cdev));
1755     if (cdev->pmap.max_connect)
1756     cxgbi_free_big_mem(cdev->pmap.port_csk);
1757     kfree(cdev);
1758     diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c
1759     index 7bd376d95ed5..b02ac389e6c6 100644
1760     --- a/drivers/scsi/esas2r/esas2r_flash.c
1761     +++ b/drivers/scsi/esas2r/esas2r_flash.c
1762     @@ -1197,6 +1197,7 @@ bool esas2r_nvram_read_direct(struct esas2r_adapter *a)
1763     if (!esas2r_read_flash_block(a, a->nvram, FLS_OFFSET_NVR,
1764     sizeof(struct esas2r_sas_nvram))) {
1765     esas2r_hdebug("NVRAM read failed, using defaults");
1766     + up(&a->nvram_semaphore);
1767     return false;
1768     }
1769    
1770     diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c
1771     index 9795d6f3e197..c5b89a003d2a 100644
1772     --- a/drivers/scsi/fnic/vnic_dev.c
1773     +++ b/drivers/scsi/fnic/vnic_dev.c
1774     @@ -445,26 +445,26 @@ int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done)
1775    
1776     int vnic_dev_hang_notify(struct vnic_dev *vdev)
1777     {
1778     - u64 a0, a1;
1779     + u64 a0 = 0, a1 = 0;
1780     int wait = 1000;
1781     return vnic_dev_cmd(vdev, CMD_HANG_NOTIFY, &a0, &a1, wait);
1782     }
1783    
1784     int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr)
1785     {
1786     - u64 a0, a1;
1787     + u64 a[2] = {};
1788     int wait = 1000;
1789     int err, i;
1790    
1791     for (i = 0; i < ETH_ALEN; i++)
1792     mac_addr[i] = 0;
1793    
1794     - err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a0, &a1, wait);
1795     + err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a[0], &a[1], wait);
1796     if (err)
1797     return err;
1798    
1799     for (i = 0; i < ETH_ALEN; i++)
1800     - mac_addr[i] = ((u8 *)&a0)[i];
1801     + mac_addr[i] = ((u8 *)&a)[i];
1802    
1803     return 0;
1804     }
1805     @@ -489,38 +489,32 @@ void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
1806    
1807     void vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr)
1808     {
1809     - u64 a0 = 0, a1 = 0;
1810     + u64 a[2] = {};
1811     int wait = 1000;
1812     int err;
1813     int i;
1814    
1815     for (i = 0; i < ETH_ALEN; i++)
1816     - ((u8 *)&a0)[i] = addr[i];
1817     + ((u8 *)&a)[i] = addr[i];
1818    
1819     - err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait);
1820     + err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a[0], &a[1], wait);
1821     if (err)
1822     - printk(KERN_ERR
1823     - "Can't add addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n",
1824     - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5],
1825     - err);
1826     + pr_err("Can't add addr [%pM], %d\n", addr, err);
1827     }
1828    
1829     void vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr)
1830     {
1831     - u64 a0 = 0, a1 = 0;
1832     + u64 a[2] = {};
1833     int wait = 1000;
1834     int err;
1835     int i;
1836    
1837     for (i = 0; i < ETH_ALEN; i++)
1838     - ((u8 *)&a0)[i] = addr[i];
1839     + ((u8 *)&a)[i] = addr[i];
1840    
1841     - err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait);
1842     + err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a[0], &a[1], wait);
1843     if (err)
1844     - printk(KERN_ERR
1845     - "Can't del addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n",
1846     - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5],
1847     - err);
1848     + pr_err("Can't del addr [%pM], %d\n", addr, err);
1849     }
1850    
1851     int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr)
1852     diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
1853     index c291fdff1b33..ea3b77ba12a2 100644
1854     --- a/drivers/scsi/qla4xxx/ql4_mbx.c
1855     +++ b/drivers/scsi/qla4xxx/ql4_mbx.c
1856     @@ -641,9 +641,6 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
1857    
1858     if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) !=
1859     QLA_SUCCESS) {
1860     - dma_free_coherent(&ha->pdev->dev,
1861     - sizeof(struct addr_ctrl_blk),
1862     - init_fw_cb, init_fw_cb_dma);
1863     goto exit_init_fw_cb;
1864     }
1865    
1866     diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
1867     index 617a60737590..22472d140ef7 100644
1868     --- a/drivers/scsi/scsi_trace.c
1869     +++ b/drivers/scsi/scsi_trace.c
1870     @@ -21,7 +21,7 @@
1871     #include <trace/events/scsi.h>
1872    
1873     #define SERVICE_ACTION16(cdb) (cdb[1] & 0x1f)
1874     -#define SERVICE_ACTION32(cdb) ((cdb[8] << 8) | cdb[9])
1875     +#define SERVICE_ACTION32(cdb) (get_unaligned_be16(&cdb[8]))
1876    
1877     static const char *
1878     scsi_trace_misc(struct trace_seq *, unsigned char *, int);
1879     @@ -51,17 +51,12 @@ static const char *
1880     scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len)
1881     {
1882     const char *ret = trace_seq_buffer_ptr(p);
1883     - sector_t lba = 0, txlen = 0;
1884     + u32 lba, txlen;
1885    
1886     - lba |= (cdb[2] << 24);
1887     - lba |= (cdb[3] << 16);
1888     - lba |= (cdb[4] << 8);
1889     - lba |= cdb[5];
1890     - txlen |= (cdb[7] << 8);
1891     - txlen |= cdb[8];
1892     + lba = get_unaligned_be32(&cdb[2]);
1893     + txlen = get_unaligned_be16(&cdb[7]);
1894    
1895     - trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u",
1896     - (unsigned long long)lba, (unsigned long long)txlen,
1897     + trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen,
1898     cdb[1] >> 5);
1899    
1900     if (cdb[0] == WRITE_SAME)
1901     @@ -76,19 +71,12 @@ static const char *
1902     scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len)
1903     {
1904     const char *ret = trace_seq_buffer_ptr(p);
1905     - sector_t lba = 0, txlen = 0;
1906     -
1907     - lba |= (cdb[2] << 24);
1908     - lba |= (cdb[3] << 16);
1909     - lba |= (cdb[4] << 8);
1910     - lba |= cdb[5];
1911     - txlen |= (cdb[6] << 24);
1912     - txlen |= (cdb[7] << 16);
1913     - txlen |= (cdb[8] << 8);
1914     - txlen |= cdb[9];
1915     -
1916     - trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u",
1917     - (unsigned long long)lba, (unsigned long long)txlen,
1918     + u32 lba, txlen;
1919     +
1920     + lba = get_unaligned_be32(&cdb[2]);
1921     + txlen = get_unaligned_be32(&cdb[6]);
1922     +
1923     + trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen,
1924     cdb[1] >> 5);
1925     trace_seq_putc(p, 0);
1926    
1927     @@ -99,23 +87,13 @@ static const char *
1928     scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len)
1929     {
1930     const char *ret = trace_seq_buffer_ptr(p);
1931     - sector_t lba = 0, txlen = 0;
1932     -
1933     - lba |= ((u64)cdb[2] << 56);
1934     - lba |= ((u64)cdb[3] << 48);
1935     - lba |= ((u64)cdb[4] << 40);
1936     - lba |= ((u64)cdb[5] << 32);
1937     - lba |= (cdb[6] << 24);
1938     - lba |= (cdb[7] << 16);
1939     - lba |= (cdb[8] << 8);
1940     - lba |= cdb[9];
1941     - txlen |= (cdb[10] << 24);
1942     - txlen |= (cdb[11] << 16);
1943     - txlen |= (cdb[12] << 8);
1944     - txlen |= cdb[13];
1945     -
1946     - trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u",
1947     - (unsigned long long)lba, (unsigned long long)txlen,
1948     + u64 lba;
1949     + u32 txlen;
1950     +
1951     + lba = get_unaligned_be64(&cdb[2]);
1952     + txlen = get_unaligned_be32(&cdb[10]);
1953     +
1954     + trace_seq_printf(p, "lba=%llu txlen=%u protect=%u", lba, txlen,
1955     cdb[1] >> 5);
1956    
1957     if (cdb[0] == WRITE_SAME_16)
1958     @@ -130,8 +108,8 @@ static const char *
1959     scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len)
1960     {
1961     const char *ret = trace_seq_buffer_ptr(p), *cmd;
1962     - sector_t lba = 0, txlen = 0;
1963     - u32 ei_lbrt = 0;
1964     + u64 lba;
1965     + u32 ei_lbrt, txlen;
1966    
1967     switch (SERVICE_ACTION32(cdb)) {
1968     case READ_32:
1969     @@ -151,26 +129,12 @@ scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len)
1970     goto out;
1971     }
1972    
1973     - lba |= ((u64)cdb[12] << 56);
1974     - lba |= ((u64)cdb[13] << 48);
1975     - lba |= ((u64)cdb[14] << 40);
1976     - lba |= ((u64)cdb[15] << 32);
1977     - lba |= (cdb[16] << 24);
1978     - lba |= (cdb[17] << 16);
1979     - lba |= (cdb[18] << 8);
1980     - lba |= cdb[19];
1981     - ei_lbrt |= (cdb[20] << 24);
1982     - ei_lbrt |= (cdb[21] << 16);
1983     - ei_lbrt |= (cdb[22] << 8);
1984     - ei_lbrt |= cdb[23];
1985     - txlen |= (cdb[28] << 24);
1986     - txlen |= (cdb[29] << 16);
1987     - txlen |= (cdb[30] << 8);
1988     - txlen |= cdb[31];
1989     -
1990     - trace_seq_printf(p, "%s_32 lba=%llu txlen=%llu protect=%u ei_lbrt=%u",
1991     - cmd, (unsigned long long)lba,
1992     - (unsigned long long)txlen, cdb[10] >> 5, ei_lbrt);
1993     + lba = get_unaligned_be64(&cdb[12]);
1994     + ei_lbrt = get_unaligned_be32(&cdb[20]);
1995     + txlen = get_unaligned_be32(&cdb[28]);
1996     +
1997     + trace_seq_printf(p, "%s_32 lba=%llu txlen=%u protect=%u ei_lbrt=%u",
1998     + cmd, lba, txlen, cdb[10] >> 5, ei_lbrt);
1999    
2000     if (SERVICE_ACTION32(cdb) == WRITE_SAME_32)
2001     trace_seq_printf(p, " unmap=%u", cdb[10] >> 3 & 1);
2002     @@ -185,7 +149,7 @@ static const char *
2003     scsi_trace_unmap(struct trace_seq *p, unsigned char *cdb, int len)
2004     {
2005     const char *ret = trace_seq_buffer_ptr(p);
2006     - unsigned int regions = cdb[7] << 8 | cdb[8];
2007     + unsigned int regions = get_unaligned_be16(&cdb[7]);
2008    
2009     trace_seq_printf(p, "regions=%u", (regions - 8) / 16);
2010     trace_seq_putc(p, 0);
2011     @@ -197,8 +161,8 @@ static const char *
2012     scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len)
2013     {
2014     const char *ret = trace_seq_buffer_ptr(p), *cmd;
2015     - sector_t lba = 0;
2016     - u32 alloc_len = 0;
2017     + u64 lba;
2018     + u32 alloc_len;
2019    
2020     switch (SERVICE_ACTION16(cdb)) {
2021     case SAI_READ_CAPACITY_16:
2022     @@ -212,21 +176,10 @@ scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len)
2023     goto out;
2024     }
2025    
2026     - lba |= ((u64)cdb[2] << 56);
2027     - lba |= ((u64)cdb[3] << 48);
2028     - lba |= ((u64)cdb[4] << 40);
2029     - lba |= ((u64)cdb[5] << 32);
2030     - lba |= (cdb[6] << 24);
2031     - lba |= (cdb[7] << 16);
2032     - lba |= (cdb[8] << 8);
2033     - lba |= cdb[9];
2034     - alloc_len |= (cdb[10] << 24);
2035     - alloc_len |= (cdb[11] << 16);
2036     - alloc_len |= (cdb[12] << 8);
2037     - alloc_len |= cdb[13];
2038     -
2039     - trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd,
2040     - (unsigned long long)lba, alloc_len);
2041     + lba = get_unaligned_be64(&cdb[2]);
2042     + alloc_len = get_unaligned_be32(&cdb[10]);
2043     +
2044     + trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, lba, alloc_len);
2045    
2046     out:
2047     trace_seq_putc(p, 0);
2048     diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
2049     index b40fe8d583c0..62d6955ac69b 100644
2050     --- a/drivers/scsi/sd.c
2051     +++ b/drivers/scsi/sd.c
2052     @@ -2005,8 +2005,10 @@ static int sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer
2053     u8 type;
2054     int ret = 0;
2055    
2056     - if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0)
2057     + if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) {
2058     + sdkp->protection_type = 0;
2059     return ret;
2060     + }
2061    
2062     type = ((buffer[12] >> 1) & 7) + 1; /* P_TYPE 0 = Type 1 */
2063    
2064     diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
2065     index 691c04b3e5b6..938840af9c50 100644
2066     --- a/drivers/spi/spi-atmel.c
2067     +++ b/drivers/spi/spi-atmel.c
2068     @@ -315,7 +315,6 @@ struct atmel_spi {
2069     struct atmel_spi_dma dma;
2070    
2071     bool keep_cs;
2072     - bool cs_active;
2073    
2074     u32 fifo_size;
2075     };
2076     @@ -1404,11 +1403,9 @@ static int atmel_spi_one_transfer(struct spi_master *master,
2077     &msg->transfers)) {
2078     as->keep_cs = true;
2079     } else {
2080     - as->cs_active = !as->cs_active;
2081     - if (as->cs_active)
2082     - cs_activate(as, msg->spi);
2083     - else
2084     - cs_deactivate(as, msg->spi);
2085     + cs_deactivate(as, msg->spi);
2086     + udelay(10);
2087     + cs_activate(as, msg->spi);
2088     }
2089     }
2090    
2091     @@ -1431,7 +1428,6 @@ static int atmel_spi_transfer_one_message(struct spi_master *master,
2092     atmel_spi_lock(as);
2093     cs_activate(as, spi);
2094    
2095     - as->cs_active = true;
2096     as->keep_cs = false;
2097    
2098     msg->status = 0;
2099     diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c
2100     index cb6497ce4b61..6e75095af681 100644
2101     --- a/drivers/target/target_core_fabric_lib.c
2102     +++ b/drivers/target/target_core_fabric_lib.c
2103     @@ -130,7 +130,7 @@ static int srp_get_pr_transport_id(
2104     memset(buf + 8, 0, leading_zero_bytes);
2105     rc = hex2bin(buf + 8 + leading_zero_bytes, p, count);
2106     if (rc < 0) {
2107     - pr_debug("hex2bin failed for %s: %d\n", __func__, rc);
2108     + pr_debug("hex2bin failed for %s: %d\n", p, rc);
2109     return rc;
2110     }
2111    
2112     diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
2113     index 6d596c635159..e75bd8d7e6f6 100644
2114     --- a/drivers/tty/serial/imx.c
2115     +++ b/drivers/tty/serial/imx.c
2116     @@ -548,7 +548,7 @@ static void imx_dma_tx(struct imx_port *sport)
2117     dev_err(dev, "DMA mapping error for TX.\n");
2118     return;
2119     }
2120     - desc = dmaengine_prep_slave_sg(chan, sgl, sport->dma_tx_nents,
2121     + desc = dmaengine_prep_slave_sg(chan, sgl, ret,
2122     DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT);
2123     if (!desc) {
2124     dma_unmap_sg(dev, sgl, sport->dma_tx_nents,
2125     diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
2126     index 42caccb5e87e..30b577384a1d 100644
2127     --- a/drivers/tty/serial/pch_uart.c
2128     +++ b/drivers/tty/serial/pch_uart.c
2129     @@ -252,6 +252,7 @@ struct eg20t_port {
2130     struct dma_chan *chan_rx;
2131     struct scatterlist *sg_tx_p;
2132     int nent;
2133     + int orig_nent;
2134     struct scatterlist sg_rx;
2135     int tx_dma_use;
2136     void *rx_buf_virt;
2137     @@ -806,9 +807,10 @@ static void pch_dma_tx_complete(void *arg)
2138     }
2139     xmit->tail &= UART_XMIT_SIZE - 1;
2140     async_tx_ack(priv->desc_tx);
2141     - dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE);
2142     + dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE);
2143     priv->tx_dma_use = 0;
2144     priv->nent = 0;
2145     + priv->orig_nent = 0;
2146     kfree(priv->sg_tx_p);
2147     pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT);
2148     }
2149     @@ -1033,6 +1035,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
2150     dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__);
2151     return 0;
2152     }
2153     + priv->orig_nent = num;
2154     priv->nent = nent;
2155    
2156     for (i = 0; i < nent; i++, sg++) {
2157     diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
2158     index acf4752302a6..9f05f9a81f69 100644
2159     --- a/drivers/usb/core/hub.c
2160     +++ b/drivers/usb/core/hub.c
2161     @@ -1162,6 +1162,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
2162     * PORT_OVER_CURRENT is not. So check for any of them.
2163     */
2164     if (udev || (portstatus & USB_PORT_STAT_CONNECTION) ||
2165     + (portchange & USB_PORT_STAT_C_CONNECTION) ||
2166     (portstatus & USB_PORT_STAT_OVERCURRENT) ||
2167     (portchange & USB_PORT_STAT_C_OVERCURRENT))
2168     set_bit(port1, hub->change_bits);
2169     diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
2170     index 9a2c0c76d11b..0291dc7cd284 100644
2171     --- a/drivers/usb/serial/ch341.c
2172     +++ b/drivers/usb/serial/ch341.c
2173     @@ -555,9 +555,13 @@ static int ch341_tiocmget(struct tty_struct *tty)
2174     static int ch341_reset_resume(struct usb_serial *serial)
2175     {
2176     struct usb_serial_port *port = serial->port[0];
2177     - struct ch341_private *priv = usb_get_serial_port_data(port);
2178     + struct ch341_private *priv;
2179     int ret;
2180    
2181     + priv = usb_get_serial_port_data(port);
2182     + if (!priv)
2183     + return 0;
2184     +
2185     /* reconfigure ch341 serial port after bus-reset */
2186     ch341_configure(serial->dev, priv);
2187    
2188     diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
2189     index e5649adcc84c..191588006e0e 100644
2190     --- a/drivers/usb/serial/io_edgeport.c
2191     +++ b/drivers/usb/serial/io_edgeport.c
2192     @@ -572,6 +572,7 @@ static void edge_interrupt_callback(struct urb *urb)
2193     struct usb_serial_port *port;
2194     unsigned char *data = urb->transfer_buffer;
2195     int length = urb->actual_length;
2196     + unsigned long flags;
2197     int bytes_avail;
2198     int position;
2199     int txCredits;
2200     @@ -603,7 +604,7 @@ static void edge_interrupt_callback(struct urb *urb)
2201     if (length > 1) {
2202     bytes_avail = data[0] | (data[1] << 8);
2203     if (bytes_avail) {
2204     - spin_lock(&edge_serial->es_lock);
2205     + spin_lock_irqsave(&edge_serial->es_lock, flags);
2206     edge_serial->rxBytesAvail += bytes_avail;
2207     dev_dbg(dev,
2208     "%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d\n",
2209     @@ -626,7 +627,8 @@ static void edge_interrupt_callback(struct urb *urb)
2210     edge_serial->read_in_progress = false;
2211     }
2212     }
2213     - spin_unlock(&edge_serial->es_lock);
2214     + spin_unlock_irqrestore(&edge_serial->es_lock,
2215     + flags);
2216     }
2217     }
2218     /* grab the txcredits for the ports if available */
2219     @@ -638,10 +640,12 @@ static void edge_interrupt_callback(struct urb *urb)
2220     if (txCredits) {
2221     port = edge_serial->serial->port[portNumber];
2222     edge_port = usb_get_serial_port_data(port);
2223     - if (edge_port->open) {
2224     - spin_lock(&edge_port->ep_lock);
2225     + if (edge_port && edge_port->open) {
2226     + spin_lock_irqsave(&edge_port->ep_lock,
2227     + flags);
2228     edge_port->txCredits += txCredits;
2229     - spin_unlock(&edge_port->ep_lock);
2230     + spin_unlock_irqrestore(&edge_port->ep_lock,
2231     + flags);
2232     dev_dbg(dev, "%s - txcredits for port%d = %d\n",
2233     __func__, portNumber,
2234     edge_port->txCredits);
2235     @@ -682,6 +686,7 @@ static void edge_bulk_in_callback(struct urb *urb)
2236     int retval;
2237     __u16 raw_data_length;
2238     int status = urb->status;
2239     + unsigned long flags;
2240    
2241     if (status) {
2242     dev_dbg(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n",
2243     @@ -701,7 +706,7 @@ static void edge_bulk_in_callback(struct urb *urb)
2244    
2245     usb_serial_debug_data(dev, __func__, raw_data_length, data);
2246    
2247     - spin_lock(&edge_serial->es_lock);
2248     + spin_lock_irqsave(&edge_serial->es_lock, flags);
2249    
2250     /* decrement our rxBytes available by the number that we just got */
2251     edge_serial->rxBytesAvail -= raw_data_length;
2252     @@ -725,7 +730,7 @@ static void edge_bulk_in_callback(struct urb *urb)
2253     edge_serial->read_in_progress = false;
2254     }
2255    
2256     - spin_unlock(&edge_serial->es_lock);
2257     + spin_unlock_irqrestore(&edge_serial->es_lock, flags);
2258     }
2259    
2260    
2261     @@ -1662,7 +1667,8 @@ static void edge_break(struct tty_struct *tty, int break_state)
2262     static void process_rcvd_data(struct edgeport_serial *edge_serial,
2263     unsigned char *buffer, __u16 bufferLength)
2264     {
2265     - struct device *dev = &edge_serial->serial->dev->dev;
2266     + struct usb_serial *serial = edge_serial->serial;
2267     + struct device *dev = &serial->dev->dev;
2268     struct usb_serial_port *port;
2269     struct edgeport_port *edge_port;
2270     __u16 lastBufferLength;
2271     @@ -1767,11 +1773,10 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
2272    
2273     /* spit this data back into the tty driver if this
2274     port is open */
2275     - if (rxLen) {
2276     - port = edge_serial->serial->port[
2277     - edge_serial->rxPort];
2278     + if (rxLen && edge_serial->rxPort < serial->num_ports) {
2279     + port = serial->port[edge_serial->rxPort];
2280     edge_port = usb_get_serial_port_data(port);
2281     - if (edge_port->open) {
2282     + if (edge_port && edge_port->open) {
2283     dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n",
2284     __func__, rxLen,
2285     edge_serial->rxPort);
2286     @@ -1779,8 +1784,8 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
2287     rxLen);
2288     edge_port->port->icount.rx += rxLen;
2289     }
2290     - buffer += rxLen;
2291     }
2292     + buffer += rxLen;
2293     break;
2294    
2295     case EXPECT_HDR3: /* Expect 3rd byte of status header */
2296     @@ -1815,6 +1820,8 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
2297     __u8 code = edge_serial->rxStatusCode;
2298    
2299     /* switch the port pointer to the one being currently talked about */
2300     + if (edge_serial->rxPort >= edge_serial->serial->num_ports)
2301     + return;
2302     port = edge_serial->serial->port[edge_serial->rxPort];
2303     edge_port = usb_get_serial_port_data(port);
2304     if (edge_port == NULL) {
2305     diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
2306     index 185ef1d8c6cd..e08755e9b612 100644
2307     --- a/drivers/usb/serial/keyspan.c
2308     +++ b/drivers/usb/serial/keyspan.c
2309     @@ -567,6 +567,8 @@ static void usa49_glocont_callback(struct urb *urb)
2310     for (i = 0; i < serial->num_ports; ++i) {
2311     port = serial->port[i];
2312     p_priv = usb_get_serial_port_data(port);
2313     + if (!p_priv)
2314     + continue;
2315    
2316     if (p_priv->resend_cont) {
2317     dev_dbg(&port->dev, "%s - sending setup\n", __func__);
2318     @@ -968,6 +970,8 @@ static void usa67_glocont_callback(struct urb *urb)
2319     for (i = 0; i < serial->num_ports; ++i) {
2320     port = serial->port[i];
2321     p_priv = usb_get_serial_port_data(port);
2322     + if (!p_priv)
2323     + continue;
2324    
2325     if (p_priv->resend_cont) {
2326     dev_dbg(&port->dev, "%s - sending setup\n", __func__);
2327     diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
2328     index 64bf258e7e00..9606dde3194c 100644
2329     --- a/drivers/usb/serial/opticon.c
2330     +++ b/drivers/usb/serial/opticon.c
2331     @@ -116,7 +116,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype,
2332     retval = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
2333     requesttype,
2334     USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
2335     - 0, 0, buffer, 1, 0);
2336     + 0, 0, buffer, 1, USB_CTRL_SET_TIMEOUT);
2337     kfree(buffer);
2338    
2339     if (retval < 0)
2340     diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
2341     index 1d17779b2203..19952ccd028a 100644
2342     --- a/drivers/usb/serial/quatech2.c
2343     +++ b/drivers/usb/serial/quatech2.c
2344     @@ -872,7 +872,10 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch)
2345     u8 newMSR = (u8) *ch;
2346     unsigned long flags;
2347    
2348     + /* May be called from qt2_process_read_urb() for an unbound port. */
2349     port_priv = usb_get_serial_port_data(port);
2350     + if (!port_priv)
2351     + return;
2352    
2353     spin_lock_irqsave(&port_priv->lock, flags);
2354     port_priv->shadowMSR = newMSR;
2355     @@ -900,7 +903,10 @@ static void qt2_update_lsr(struct usb_serial_port *port, unsigned char *ch)
2356     unsigned long flags;
2357     u8 newLSR = (u8) *ch;
2358    
2359     + /* May be called from qt2_process_read_urb() for an unbound port. */
2360     port_priv = usb_get_serial_port_data(port);
2361     + if (!port_priv)
2362     + return;
2363    
2364     if (newLSR & UART_LSR_BI)
2365     newLSR &= (u8) (UART_LSR_OE | UART_LSR_BI);
2366     diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c
2367     index 511242111403..15e05ebf37ac 100644
2368     --- a/drivers/usb/serial/usb-serial-simple.c
2369     +++ b/drivers/usb/serial/usb-serial-simple.c
2370     @@ -89,6 +89,8 @@ DEVICE(moto_modem, MOTO_IDS);
2371     #define MOTOROLA_TETRA_IDS() \
2372     { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \
2373     { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \
2374     + { USB_DEVICE(0x0cad, 0x9013) }, /* MTP3xxx */ \
2375     + { USB_DEVICE(0x0cad, 0x9015) }, /* MTP85xx */ \
2376     { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */
2377     DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS);
2378    
2379     diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
2380     index a894c0fdc04b..8a24a11b7ffc 100644
2381     --- a/drivers/usb/serial/usb-serial.c
2382     +++ b/drivers/usb/serial/usb-serial.c
2383     @@ -1351,6 +1351,9 @@ static int usb_serial_register(struct usb_serial_driver *driver)
2384     return -EINVAL;
2385     }
2386    
2387     + /* Prevent individual ports from being unbound. */
2388     + driver->driver.suppress_bind_attrs = true;
2389     +
2390     usb_serial_operations_init(driver);
2391    
2392     /* Add this device to our list of devices */
2393     diff --git a/firmware/Makefile b/firmware/Makefile
2394     index e297e1b52636..03232621cc08 100644
2395     --- a/firmware/Makefile
2396     +++ b/firmware/Makefile
2397     @@ -156,7 +156,7 @@ quiet_cmd_fwbin = MK_FW $@
2398     PROGBITS=$(if $(CONFIG_ARM),%,@)progbits; \
2399     echo "/* Generated by firmware/Makefile */" > $@;\
2400     echo " .section .rodata" >>$@;\
2401     - echo " .p2align $${ASM_ALIGN}" >>$@;\
2402     + echo " .p2align 4" >>$@;\
2403     echo "_fw_$${FWSTR}_bin:" >>$@;\
2404     echo " .incbin \"$(2)\"" >>$@;\
2405     echo "_fw_end:" >>$@;\
2406     diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
2407     index 41f1a5dd33a5..4dcce3f034f4 100644
2408     --- a/fs/cifs/smb2file.c
2409     +++ b/fs/cifs/smb2file.c
2410     @@ -69,7 +69,7 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms,
2411     goto out;
2412    
2413    
2414     - if (oparms->tcon->use_resilient) {
2415     + if (oparms->tcon->use_resilient) {
2416     nr_ioctl_req.Timeout = 0; /* use server default (120 seconds) */
2417     nr_ioctl_req.Reserved = 0;
2418     rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid,
2419     diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
2420     index 00c320e2ba1e..8133e6529994 100644
2421     --- a/fs/ext4/inode.c
2422     +++ b/fs/ext4/inode.c
2423     @@ -5472,10 +5472,25 @@ static int ext4_expand_extra_isize(struct inode *inode,
2424     {
2425     struct ext4_inode *raw_inode;
2426     struct ext4_xattr_ibody_header *header;
2427     + unsigned int inode_size = EXT4_INODE_SIZE(inode->i_sb);
2428     + struct ext4_inode_info *ei = EXT4_I(inode);
2429    
2430     if (EXT4_I(inode)->i_extra_isize >= new_extra_isize)
2431     return 0;
2432    
2433     + /* this was checked at iget time, but double check for good measure */
2434     + if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) ||
2435     + (ei->i_extra_isize & 3)) {
2436     + EXT4_ERROR_INODE(inode, "bad extra_isize %u (inode size %u)",
2437     + ei->i_extra_isize,
2438     + EXT4_INODE_SIZE(inode->i_sb));
2439     + return -EFSCORRUPTED;
2440     + }
2441     + if ((new_extra_isize < ei->i_extra_isize) ||
2442     + (new_extra_isize < 4) ||
2443     + (new_extra_isize > inode_size - EXT4_GOOD_OLD_INODE_SIZE))
2444     + return -EINVAL; /* Should never happen */
2445     +
2446     raw_inode = ext4_raw_inode(&iloc);
2447    
2448     header = IHDR(inode, raw_inode);
2449     diff --git a/fs/ext4/super.c b/fs/ext4/super.c
2450     index 3261478bfc32..391ab55808c9 100644
2451     --- a/fs/ext4/super.c
2452     +++ b/fs/ext4/super.c
2453     @@ -3342,6 +3342,40 @@ int ext4_calculate_overhead(struct super_block *sb)
2454     return 0;
2455     }
2456    
2457     +static void ext4_clamp_want_extra_isize(struct super_block *sb)
2458     +{
2459     + struct ext4_sb_info *sbi = EXT4_SB(sb);
2460     + struct ext4_super_block *es = sbi->s_es;
2461     + unsigned def_extra_isize = sizeof(struct ext4_inode) -
2462     + EXT4_GOOD_OLD_INODE_SIZE;
2463     +
2464     + if (sbi->s_inode_size == EXT4_GOOD_OLD_INODE_SIZE) {
2465     + sbi->s_want_extra_isize = 0;
2466     + return;
2467     + }
2468     + if (sbi->s_want_extra_isize < 4) {
2469     + sbi->s_want_extra_isize = def_extra_isize;
2470     + if (ext4_has_feature_extra_isize(sb)) {
2471     + if (sbi->s_want_extra_isize <
2472     + le16_to_cpu(es->s_want_extra_isize))
2473     + sbi->s_want_extra_isize =
2474     + le16_to_cpu(es->s_want_extra_isize);
2475     + if (sbi->s_want_extra_isize <
2476     + le16_to_cpu(es->s_min_extra_isize))
2477     + sbi->s_want_extra_isize =
2478     + le16_to_cpu(es->s_min_extra_isize);
2479     + }
2480     + }
2481     + /* Check if enough inode space is available */
2482     + if ((sbi->s_want_extra_isize > sbi->s_inode_size) ||
2483     + (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
2484     + sbi->s_inode_size)) {
2485     + sbi->s_want_extra_isize = def_extra_isize;
2486     + ext4_msg(sb, KERN_INFO,
2487     + "required extra inode space not available");
2488     + }
2489     +}
2490     +
2491     static void ext4_set_resv_clusters(struct super_block *sb)
2492     {
2493     ext4_fsblk_t resv_clusters;
2494     @@ -4156,29 +4190,7 @@ no_journal:
2495     if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY))
2496     sb->s_flags |= MS_RDONLY;
2497    
2498     - /* determine the minimum size of new large inodes, if present */
2499     - if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {
2500     - sbi->s_want_extra_isize = sizeof(struct ext4_inode) -
2501     - EXT4_GOOD_OLD_INODE_SIZE;
2502     - if (ext4_has_feature_extra_isize(sb)) {
2503     - if (sbi->s_want_extra_isize <
2504     - le16_to_cpu(es->s_want_extra_isize))
2505     - sbi->s_want_extra_isize =
2506     - le16_to_cpu(es->s_want_extra_isize);
2507     - if (sbi->s_want_extra_isize <
2508     - le16_to_cpu(es->s_min_extra_isize))
2509     - sbi->s_want_extra_isize =
2510     - le16_to_cpu(es->s_min_extra_isize);
2511     - }
2512     - }
2513     - /* Check if enough inode space is available */
2514     - if (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize >
2515     - sbi->s_inode_size) {
2516     - sbi->s_want_extra_isize = sizeof(struct ext4_inode) -
2517     - EXT4_GOOD_OLD_INODE_SIZE;
2518     - ext4_msg(sb, KERN_INFO, "required extra inode space not"
2519     - "available");
2520     - }
2521     + ext4_clamp_want_extra_isize(sb);
2522    
2523     ext4_set_resv_clusters(sb);
2524    
2525     @@ -4959,6 +4971,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
2526     goto restore_opts;
2527     }
2528    
2529     + ext4_clamp_want_extra_isize(sb);
2530     +
2531     if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^
2532     test_opt(sb, JOURNAL_CHECKSUM)) {
2533     ext4_msg(sb, KERN_ERR, "changing journal_checksum "
2534     diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
2535     index 0206c8c20784..b2cccd4083b8 100644
2536     --- a/fs/f2fs/data.c
2537     +++ b/fs/f2fs/data.c
2538     @@ -1267,7 +1267,7 @@ static int f2fs_write_data_page(struct page *page,
2539     loff_t i_size = i_size_read(inode);
2540     const pgoff_t end_index = ((unsigned long long) i_size)
2541     >> PAGE_SHIFT;
2542     - loff_t psize = (page->index + 1) << PAGE_SHIFT;
2543     + loff_t psize = (loff_t)(page->index + 1) << PAGE_SHIFT;
2544     unsigned offset = 0;
2545     bool need_balance_fs = false;
2546     int err = 0;
2547     diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
2548     index f46ac1651bd5..e3c438c8b8ce 100644
2549     --- a/fs/f2fs/file.c
2550     +++ b/fs/f2fs/file.c
2551     @@ -980,7 +980,7 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode,
2552     }
2553     dn.ofs_in_node++;
2554     i++;
2555     - new_size = (dst + i) << PAGE_SHIFT;
2556     + new_size = (loff_t)(dst + i) << PAGE_SHIFT;
2557     if (dst_inode->i_size < new_size)
2558     f2fs_i_size_write(dst_inode, new_size);
2559     } while (--ilen && (do_replace[i] || blkaddr[i] == NULL_ADDR));
2560     diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
2561     index 13cf69aa4cae..733c05135305 100644
2562     --- a/fs/ocfs2/journal.c
2563     +++ b/fs/ocfs2/journal.c
2564     @@ -1080,6 +1080,14 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed)
2565    
2566     ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num);
2567    
2568     + if (replayed) {
2569     + jbd2_journal_lock_updates(journal->j_journal);
2570     + status = jbd2_journal_flush(journal->j_journal);
2571     + jbd2_journal_unlock_updates(journal->j_journal);
2572     + if (status < 0)
2573     + mlog_errno(status);
2574     + }
2575     +
2576     status = ocfs2_journal_toggle_dirty(osb, 1, replayed);
2577     if (status < 0) {
2578     mlog_errno(status);
2579     diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
2580     index dbc2ada9884f..07900105523f 100644
2581     --- a/fs/reiserfs/xattr.c
2582     +++ b/fs/reiserfs/xattr.c
2583     @@ -318,8 +318,12 @@ static int reiserfs_for_each_xattr(struct inode *inode,
2584     out_dir:
2585     dput(dir);
2586     out:
2587     - /* -ENODATA isn't an error */
2588     - if (err == -ENODATA)
2589     + /*
2590     + * -ENODATA: this object doesn't have any xattrs
2591     + * -EOPNOTSUPP: this file system doesn't have xattrs enabled on disk.
2592     + * Neither are errors
2593     + */
2594     + if (err == -ENODATA || err == -EOPNOTSUPP)
2595     err = 0;
2596     return err;
2597     }
2598     diff --git a/include/dt-bindings/reset/amlogic,meson8b-reset.h b/include/dt-bindings/reset/amlogic,meson8b-reset.h
2599     index 614aff2c7aff..a03e86fe2c57 100644
2600     --- a/include/dt-bindings/reset/amlogic,meson8b-reset.h
2601     +++ b/include/dt-bindings/reset/amlogic,meson8b-reset.h
2602     @@ -95,9 +95,9 @@
2603     #define RESET_VD_RMEM 64
2604     #define RESET_AUDIN 65
2605     #define RESET_DBLK 66
2606     -#define RESET_PIC_DC 66
2607     -#define RESET_PSC 66
2608     -#define RESET_NAND 66
2609     +#define RESET_PIC_DC 67
2610     +#define RESET_PSC 68
2611     +#define RESET_NAND 69
2612     #define RESET_GE2D 70
2613     #define RESET_PARSER_REG 71
2614     #define RESET_PARSER_FETCH 72
2615     diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
2616     index 7582a5712458..2fc4ba6fa07f 100644
2617     --- a/include/linux/blkdev.h
2618     +++ b/include/linux/blkdev.h
2619     @@ -277,6 +277,7 @@ struct queue_limits {
2620     unsigned int max_sectors;
2621     unsigned int max_segment_size;
2622     unsigned int physical_block_size;
2623     + unsigned int logical_block_size;
2624     unsigned int alignment_offset;
2625     unsigned int io_min;
2626     unsigned int io_opt;
2627     @@ -286,7 +287,6 @@ struct queue_limits {
2628     unsigned int discard_granularity;
2629     unsigned int discard_alignment;
2630    
2631     - unsigned short logical_block_size;
2632     unsigned short max_segments;
2633     unsigned short max_integrity_segments;
2634    
2635     @@ -996,7 +996,7 @@ extern void blk_queue_max_discard_sectors(struct request_queue *q,
2636     unsigned int max_discard_sectors);
2637     extern void blk_queue_max_write_same_sectors(struct request_queue *q,
2638     unsigned int max_write_same_sectors);
2639     -extern void blk_queue_logical_block_size(struct request_queue *, unsigned short);
2640     +extern void blk_queue_logical_block_size(struct request_queue *, unsigned int);
2641     extern void blk_queue_physical_block_size(struct request_queue *, unsigned int);
2642     extern void blk_queue_alignment_offset(struct request_queue *q,
2643     unsigned int alignment);
2644     @@ -1221,7 +1221,7 @@ static inline unsigned int queue_max_segment_size(struct request_queue *q)
2645     return q->limits.max_segment_size;
2646     }
2647    
2648     -static inline unsigned short queue_logical_block_size(struct request_queue *q)
2649     +static inline unsigned queue_logical_block_size(struct request_queue *q)
2650     {
2651     int retval = 512;
2652    
2653     @@ -1231,7 +1231,7 @@ static inline unsigned short queue_logical_block_size(struct request_queue *q)
2654     return retval;
2655     }
2656    
2657     -static inline unsigned short bdev_logical_block_size(struct block_device *bdev)
2658     +static inline unsigned int bdev_logical_block_size(struct block_device *bdev)
2659     {
2660     return queue_logical_block_size(bdev_get_queue(bdev));
2661     }
2662     diff --git a/include/linux/poll.h b/include/linux/poll.h
2663     index 37b057b63b46..4bee398ed2fa 100644
2664     --- a/include/linux/poll.h
2665     +++ b/include/linux/poll.h
2666     @@ -14,7 +14,11 @@
2667     extern struct ctl_table epoll_table[]; /* for sysctl */
2668     /* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
2669     additional memory. */
2670     +#ifdef __clang__
2671     +#define MAX_STACK_ALLOC 768
2672     +#else
2673     #define MAX_STACK_ALLOC 832
2674     +#endif
2675     #define FRONTEND_STACK_ALLOC 256
2676     #define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC
2677     #define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC
2678     diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
2679     index 260c4aa1d976..3f6b8b9ef49d 100644
2680     --- a/include/linux/regulator/ab8500.h
2681     +++ b/include/linux/regulator/ab8500.h
2682     @@ -43,8 +43,6 @@ enum ab8505_regulator_id {
2683     AB8505_LDO_ANAMIC2,
2684     AB8505_LDO_AUX8,
2685     AB8505_LDO_ANA,
2686     - AB8505_SYSCLKREQ_2,
2687     - AB8505_SYSCLKREQ_4,
2688     AB8505_NUM_REGULATORS,
2689     };
2690    
2691     diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
2692     index 9d57639223c3..28a0d7a8c142 100644
2693     --- a/include/net/cfg80211.h
2694     +++ b/include/net/cfg80211.h
2695     @@ -4181,6 +4181,17 @@ static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
2696     const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
2697     const u8 *ies, int len);
2698    
2699     +/**
2700     + * cfg80211_send_layer2_update - send layer 2 update frame
2701     + *
2702     + * @dev: network device
2703     + * @addr: STA MAC address
2704     + *
2705     + * Wireless drivers can use this function to update forwarding tables in bridge
2706     + * devices upon STA association.
2707     + */
2708     +void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
2709     +
2710     /**
2711     * DOC: Regulatory enforcement infrastructure
2712     *
2713     diff --git a/mm/page-writeback.c b/mm/page-writeback.c
2714     index f6a376a51099..462c778b9fb5 100644
2715     --- a/mm/page-writeback.c
2716     +++ b/mm/page-writeback.c
2717     @@ -200,11 +200,11 @@ static void wb_min_max_ratio(struct bdi_writeback *wb,
2718     if (this_bw < tot_bw) {
2719     if (min) {
2720     min *= this_bw;
2721     - do_div(min, tot_bw);
2722     + min = div64_ul(min, tot_bw);
2723     }
2724     if (max < 100) {
2725     max *= this_bw;
2726     - do_div(max, tot_bw);
2727     + max = div64_ul(max, tot_bw);
2728     }
2729     }
2730    
2731     diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
2732     index df7c6a080188..3b440b8d7c05 100644
2733     --- a/net/batman-adv/distributed-arp-table.c
2734     +++ b/net/batman-adv/distributed-arp-table.c
2735     @@ -242,6 +242,7 @@ static u32 batadv_hash_dat(const void *data, u32 size)
2736     u32 hash = 0;
2737     const struct batadv_dat_entry *dat = data;
2738     const unsigned char *key;
2739     + __be16 vid;
2740     u32 i;
2741    
2742     key = (const unsigned char *)&dat->ip;
2743     @@ -251,7 +252,8 @@ static u32 batadv_hash_dat(const void *data, u32 size)
2744     hash ^= (hash >> 6);
2745     }
2746    
2747     - key = (const unsigned char *)&dat->vid;
2748     + vid = htons(dat->vid);
2749     + key = (__force const unsigned char *)&vid;
2750     for (i = 0; i < sizeof(dat->vid); i++) {
2751     hash += key[i];
2752     hash += (hash << 10);
2753     diff --git a/net/core/ethtool.c b/net/core/ethtool.c
2754     index 454f73fcb3a6..476665f917a2 100644
2755     --- a/net/core/ethtool.c
2756     +++ b/net/core/ethtool.c
2757     @@ -2332,9 +2332,10 @@ out:
2758     return ret;
2759     }
2760    
2761     -static int ethtool_get_per_queue_coalesce(struct net_device *dev,
2762     - void __user *useraddr,
2763     - struct ethtool_per_queue_op *per_queue_opt)
2764     +static noinline_for_stack int
2765     +ethtool_get_per_queue_coalesce(struct net_device *dev,
2766     + void __user *useraddr,
2767     + struct ethtool_per_queue_op *per_queue_opt)
2768     {
2769     u32 bit;
2770     int ret;
2771     @@ -2364,9 +2365,10 @@ static int ethtool_get_per_queue_coalesce(struct net_device *dev,
2772     return 0;
2773     }
2774    
2775     -static int ethtool_set_per_queue_coalesce(struct net_device *dev,
2776     - void __user *useraddr,
2777     - struct ethtool_per_queue_op *per_queue_opt)
2778     +static noinline_for_stack int
2779     +ethtool_set_per_queue_coalesce(struct net_device *dev,
2780     + void __user *useraddr,
2781     + struct ethtool_per_queue_op *per_queue_opt)
2782     {
2783     u32 bit;
2784     int i, ret = 0;
2785     @@ -2423,7 +2425,7 @@ roll_back:
2786     return ret;
2787     }
2788    
2789     -static int ethtool_set_per_queue(struct net_device *dev,
2790     +static int noinline_for_stack ethtool_set_per_queue(struct net_device *dev,
2791     void __user *useraddr, u32 sub_cmd)
2792     {
2793     struct ethtool_per_queue_op per_queue_opt;
2794     diff --git a/net/dccp/feat.c b/net/dccp/feat.c
2795     index f227f002c73d..db87d9f58019 100644
2796     --- a/net/dccp/feat.c
2797     +++ b/net/dccp/feat.c
2798     @@ -738,7 +738,12 @@ static int __feat_register_sp(struct list_head *fn, u8 feat, u8 is_local,
2799     if (dccp_feat_clone_sp_val(&fval, sp_val, sp_len))
2800     return -ENOMEM;
2801    
2802     - return dccp_feat_push_change(fn, feat, is_local, mandatory, &fval);
2803     + if (dccp_feat_push_change(fn, feat, is_local, mandatory, &fval)) {
2804     + kfree(fval.sp.vec);
2805     + return -ENOMEM;
2806     + }
2807     +
2808     + return 0;
2809     }
2810    
2811     /**
2812     diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c
2813     index 0c90cacee7aa..8108741cf8fb 100644
2814     --- a/net/dsa/tag_qca.c
2815     +++ b/net/dsa/tag_qca.c
2816     @@ -40,9 +40,6 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev)
2817     struct dsa_slave_priv *p = netdev_priv(dev);
2818     u16 *phdr, hdr;
2819    
2820     - dev->stats.tx_packets++;
2821     - dev->stats.tx_bytes += skb->len;
2822     -
2823     if (skb_cow_head(skb, 0) < 0)
2824     goto out_free;
2825    
2826     diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
2827     index 52694cb759b0..aead5ac4dbf6 100644
2828     --- a/net/hsr/hsr_device.c
2829     +++ b/net/hsr/hsr_device.c
2830     @@ -281,6 +281,8 @@ static void send_hsr_supervision_frame(struct hsr_port *master,
2831     skb->dev->dev_addr, skb->len) <= 0)
2832     goto out;
2833     skb_reset_mac_header(skb);
2834     + skb_reset_network_header(skb);
2835     + skb_reset_transport_header(skb);
2836    
2837     if (hsrVer > 0) {
2838     hsr_tag = (typeof(hsr_tag)) skb_put(skb, sizeof(struct hsr_tag));
2839     diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
2840     index d819e91df90d..e02b86265194 100644
2841     --- a/net/ipv4/netfilter/arp_tables.c
2842     +++ b/net/ipv4/netfilter/arp_tables.c
2843     @@ -515,12 +515,13 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e,
2844     return 0;
2845     }
2846    
2847     -static inline void cleanup_entry(struct arpt_entry *e)
2848     +static void cleanup_entry(struct arpt_entry *e, struct net *net)
2849     {
2850     struct xt_tgdtor_param par;
2851     struct xt_entry_target *t;
2852    
2853     t = arpt_get_target(e);
2854     + par.net = net;
2855     par.target = t->u.kernel.target;
2856     par.targinfo = t->data;
2857     par.family = NFPROTO_ARP;
2858     @@ -612,7 +613,7 @@ static int translate_table(struct net *net,
2859     xt_entry_foreach(iter, entry0, newinfo->size) {
2860     if (i-- == 0)
2861     break;
2862     - cleanup_entry(iter);
2863     + cleanup_entry(iter, net);
2864     }
2865     return ret;
2866     }
2867     @@ -939,7 +940,7 @@ static int __do_replace(struct net *net, const char *name,
2868     /* Decrease module usage counts and free resource */
2869     loc_cpu_old_entry = oldinfo->entries;
2870     xt_entry_foreach(iter, loc_cpu_old_entry, oldinfo->size)
2871     - cleanup_entry(iter);
2872     + cleanup_entry(iter, net);
2873    
2874     xt_free_table_info(oldinfo);
2875     if (copy_to_user(counters_ptr, counters,
2876     @@ -1003,7 +1004,7 @@ static int do_replace(struct net *net, const void __user *user,
2877    
2878     free_newinfo_untrans:
2879     xt_entry_foreach(iter, loc_cpu_entry, newinfo->size)
2880     - cleanup_entry(iter);
2881     + cleanup_entry(iter, net);
2882     free_newinfo:
2883     xt_free_table_info(newinfo);
2884     return ret;
2885     @@ -1300,7 +1301,7 @@ static int compat_do_replace(struct net *net, void __user *user,
2886    
2887     free_newinfo_untrans:
2888     xt_entry_foreach(iter, loc_cpu_entry, newinfo->size)
2889     - cleanup_entry(iter);
2890     + cleanup_entry(iter, net);
2891     free_newinfo:
2892     xt_free_table_info(newinfo);
2893     return ret;
2894     @@ -1527,7 +1528,7 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len
2895     return ret;
2896     }
2897    
2898     -static void __arpt_unregister_table(struct xt_table *table)
2899     +static void __arpt_unregister_table(struct net *net, struct xt_table *table)
2900     {
2901     struct xt_table_info *private;
2902     void *loc_cpu_entry;
2903     @@ -1539,7 +1540,7 @@ static void __arpt_unregister_table(struct xt_table *table)
2904     /* Decrease module usage counts and free resources */
2905     loc_cpu_entry = private->entries;
2906     xt_entry_foreach(iter, loc_cpu_entry, private->size)
2907     - cleanup_entry(iter);
2908     + cleanup_entry(iter, net);
2909     if (private->number > private->initial_entries)
2910     module_put(table_owner);
2911     xt_free_table_info(private);
2912     @@ -1579,7 +1580,7 @@ int arpt_register_table(struct net *net,
2913    
2914     ret = nf_register_net_hooks(net, ops, hweight32(table->valid_hooks));
2915     if (ret != 0) {
2916     - __arpt_unregister_table(new_table);
2917     + __arpt_unregister_table(net, new_table);
2918     *res = NULL;
2919     }
2920    
2921     @@ -1594,7 +1595,7 @@ void arpt_unregister_table(struct net *net, struct xt_table *table,
2922     const struct nf_hook_ops *ops)
2923     {
2924     nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks));
2925     - __arpt_unregister_table(table);
2926     + __arpt_unregister_table(net, table);
2927     }
2928    
2929     /* The built-in targets: standard (NULL) and error. */
2930     diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2931     index 9644dcef5a2b..52014c5312b9 100644
2932     --- a/net/ipv4/tcp_input.c
2933     +++ b/net/ipv4/tcp_input.c
2934     @@ -923,9 +923,10 @@ static void tcp_update_reordering(struct sock *sk, const int metric,
2935     /* This must be called before lost_out is incremented */
2936     static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb)
2937     {
2938     - if (!tp->retransmit_skb_hint ||
2939     - before(TCP_SKB_CB(skb)->seq,
2940     - TCP_SKB_CB(tp->retransmit_skb_hint)->seq))
2941     + if ((!tp->retransmit_skb_hint && tp->retrans_out >= tp->lost_out) ||
2942     + (tp->retransmit_skb_hint &&
2943     + before(TCP_SKB_CB(skb)->seq,
2944     + TCP_SKB_CB(tp->retransmit_skb_hint)->seq)))
2945     tp->retransmit_skb_hint = skb;
2946    
2947     if (!tp->lost_out ||
2948     diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
2949     index 3b2c4692d966..88dd5d218fe3 100644
2950     --- a/net/mac80211/cfg.c
2951     +++ b/net/mac80211/cfg.c
2952     @@ -1048,50 +1048,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
2953     return 0;
2954     }
2955    
2956     -/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
2957     -struct iapp_layer2_update {
2958     - u8 da[ETH_ALEN]; /* broadcast */
2959     - u8 sa[ETH_ALEN]; /* STA addr */
2960     - __be16 len; /* 6 */
2961     - u8 dsap; /* 0 */
2962     - u8 ssap; /* 0 */
2963     - u8 control;
2964     - u8 xid_info[3];
2965     -} __packed;
2966     -
2967     -static void ieee80211_send_layer2_update(struct sta_info *sta)
2968     -{
2969     - struct iapp_layer2_update *msg;
2970     - struct sk_buff *skb;
2971     -
2972     - /* Send Level 2 Update Frame to update forwarding tables in layer 2
2973     - * bridge devices */
2974     -
2975     - skb = dev_alloc_skb(sizeof(*msg));
2976     - if (!skb)
2977     - return;
2978     - msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg));
2979     -
2980     - /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
2981     - * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
2982     -
2983     - eth_broadcast_addr(msg->da);
2984     - memcpy(msg->sa, sta->sta.addr, ETH_ALEN);
2985     - msg->len = htons(6);
2986     - msg->dsap = 0;
2987     - msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */
2988     - msg->control = 0xaf; /* XID response lsb.1111F101.
2989     - * F=0 (no poll command; unsolicited frame) */
2990     - msg->xid_info[0] = 0x81; /* XID format identifier */
2991     - msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */
2992     - msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */
2993     -
2994     - skb->dev = sta->sdata->dev;
2995     - skb->protocol = eth_type_trans(skb, sta->sdata->dev);
2996     - memset(skb->cb, 0, sizeof(skb->cb));
2997     - netif_rx_ni(skb);
2998     -}
2999     -
3000     static int sta_apply_auth_flags(struct ieee80211_local *local,
3001     struct sta_info *sta,
3002     u32 mask, u32 set)
3003     @@ -1401,7 +1357,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
3004     struct sta_info *sta;
3005     struct ieee80211_sub_if_data *sdata;
3006     int err;
3007     - int layer2_update;
3008    
3009     if (params->vlan) {
3010     sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
3011     @@ -1445,18 +1400,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
3012     test_sta_flag(sta, WLAN_STA_ASSOC))
3013     rate_control_rate_init(sta);
3014    
3015     - layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
3016     - sdata->vif.type == NL80211_IFTYPE_AP;
3017     -
3018     err = sta_info_insert_rcu(sta);
3019     if (err) {
3020     rcu_read_unlock();
3021     return err;
3022     }
3023    
3024     - if (layer2_update)
3025     - ieee80211_send_layer2_update(sta);
3026     -
3027     rcu_read_unlock();
3028    
3029     return 0;
3030     @@ -1565,7 +1514,9 @@ static int ieee80211_change_station(struct wiphy *wiphy,
3031     atomic_inc(&sta->sdata->bss->num_mcast_sta);
3032     }
3033    
3034     - ieee80211_send_layer2_update(sta);
3035     + if (sta->sta_state == IEEE80211_STA_AUTHORIZED)
3036     + cfg80211_send_layer2_update(sta->sdata->dev,
3037     + sta->sta.addr);
3038     }
3039    
3040     err = sta_apply_parameters(local, sta, params);
3041     diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
3042     index 8e8a185dbb9b..c800bc7c5176 100644
3043     --- a/net/mac80211/sta_info.c
3044     +++ b/net/mac80211/sta_info.c
3045     @@ -1896,6 +1896,10 @@ int sta_info_move_state(struct sta_info *sta,
3046     ieee80211_check_fast_xmit(sta);
3047     ieee80211_check_fast_rx(sta);
3048     }
3049     + if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
3050     + sta->sdata->vif.type == NL80211_IFTYPE_AP)
3051     + cfg80211_send_layer2_update(sta->sdata->dev,
3052     + sta->sta.addr);
3053     break;
3054     default:
3055     break;
3056     diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h
3057     index 2e8e7e5fb4a6..9b32059dee2d 100644
3058     --- a/net/netfilter/ipset/ip_set_bitmap_gen.h
3059     +++ b/net/netfilter/ipset/ip_set_bitmap_gen.h
3060     @@ -66,9 +66,9 @@ mtype_destroy(struct ip_set *set)
3061     if (SET_WITH_TIMEOUT(set))
3062     del_timer_sync(&map->gc);
3063    
3064     - ip_set_free(map->members);
3065     if (set->dsize && set->extensions & IPSET_EXT_DESTROY)
3066     mtype_ext_cleanup(set);
3067     + ip_set_free(map->members);
3068     ip_set_free(map);
3069    
3070     set->data = NULL;
3071     diff --git a/net/socket.c b/net/socket.c
3072     index bf99bc1fab2c..65afc8ec68d4 100644
3073     --- a/net/socket.c
3074     +++ b/net/socket.c
3075     @@ -3160,6 +3160,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
3076     case SIOCSARP:
3077     case SIOCGARP:
3078     case SIOCDARP:
3079     + case SIOCOUTQNSD:
3080     case SIOCATMARK:
3081     return sock_do_ioctl(net, sock, cmd, arg);
3082     }
3083     diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
3084     index 11cf83c8ad4f..8cd56eaba7d6 100644
3085     --- a/net/wireless/rdev-ops.h
3086     +++ b/net/wireless/rdev-ops.h
3087     @@ -525,6 +525,10 @@ static inline int
3088     rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
3089     {
3090     int ret;
3091     +
3092     + if (!rdev->ops->set_wiphy_params)
3093     + return -EOPNOTSUPP;
3094     +
3095     trace_rdev_set_wiphy_params(&rdev->wiphy, changed);
3096     ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
3097     trace_rdev_return_int(&rdev->wiphy, ret);
3098     diff --git a/net/wireless/util.c b/net/wireless/util.c
3099     index c93f333c675b..262922cf6a0c 100644
3100     --- a/net/wireless/util.c
3101     +++ b/net/wireless/util.c
3102     @@ -653,7 +653,7 @@ __frame_add_frag(struct sk_buff *skb, struct page *page,
3103     struct skb_shared_info *sh = skb_shinfo(skb);
3104     int page_offset;
3105    
3106     - page_ref_inc(page);
3107     + get_page(page);
3108     page_offset = ptr - page_address(page);
3109     skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
3110     }
3111     @@ -1794,3 +1794,48 @@ EXPORT_SYMBOL(rfc1042_header);
3112     const unsigned char bridge_tunnel_header[] __aligned(2) =
3113     { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
3114     EXPORT_SYMBOL(bridge_tunnel_header);
3115     +
3116     +/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
3117     +struct iapp_layer2_update {
3118     + u8 da[ETH_ALEN]; /* broadcast */
3119     + u8 sa[ETH_ALEN]; /* STA addr */
3120     + __be16 len; /* 6 */
3121     + u8 dsap; /* 0 */
3122     + u8 ssap; /* 0 */
3123     + u8 control;
3124     + u8 xid_info[3];
3125     +} __packed;
3126     +
3127     +void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr)
3128     +{
3129     + struct iapp_layer2_update *msg;
3130     + struct sk_buff *skb;
3131     +
3132     + /* Send Level 2 Update Frame to update forwarding tables in layer 2
3133     + * bridge devices */
3134     +
3135     + skb = dev_alloc_skb(sizeof(*msg));
3136     + if (!skb)
3137     + return;
3138     + msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg));
3139     +
3140     + /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
3141     + * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
3142     +
3143     + eth_broadcast_addr(msg->da);
3144     + ether_addr_copy(msg->sa, addr);
3145     + msg->len = htons(6);
3146     + msg->dsap = 0;
3147     + msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */
3148     + msg->control = 0xaf; /* XID response lsb.1111F101.
3149     + * F=0 (no poll command; unsolicited frame) */
3150     + msg->xid_info[0] = 0x81; /* XID format identifier */
3151     + msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */
3152     + msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */
3153     +
3154     + skb->dev = dev;
3155     + skb->protocol = eth_type_trans(skb, dev);
3156     + memset(skb->cb, 0, sizeof(skb->cb));
3157     + netif_rx_ni(skb);
3158     +}
3159     +EXPORT_SYMBOL(cfg80211_send_layer2_update);
3160     diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c
3161     index b80985fbc334..0e1feb597586 100644
3162     --- a/sound/core/seq/seq_timer.c
3163     +++ b/sound/core/seq/seq_timer.c
3164     @@ -479,15 +479,19 @@ void snd_seq_info_timer_read(struct snd_info_entry *entry,
3165     q = queueptr(idx);
3166     if (q == NULL)
3167     continue;
3168     - if ((tmr = q->timer) == NULL ||
3169     - (ti = tmr->timeri) == NULL) {
3170     - queuefree(q);
3171     - continue;
3172     - }
3173     + mutex_lock(&q->timer_mutex);
3174     + tmr = q->timer;
3175     + if (!tmr)
3176     + goto unlock;
3177     + ti = tmr->timeri;
3178     + if (!ti)
3179     + goto unlock;
3180     snd_iprintf(buffer, "Timer for queue %i : %s\n", q->queue, ti->timer->name);
3181     resolution = snd_timer_resolution(ti) * tmr->ticks;
3182     snd_iprintf(buffer, " Period time : %lu.%09lu\n", resolution / 1000000000, resolution % 1000000000);
3183     snd_iprintf(buffer, " Skew : %u / %u\n", tmr->skew, tmr->skew_base);
3184     +unlock:
3185     + mutex_unlock(&q->timer_mutex);
3186     queuefree(q);
3187     }
3188     }
3189     diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
3190     index 6e88460cd13d..0abca8783bb3 100644
3191     --- a/tools/perf/builtin-report.c
3192     +++ b/tools/perf/builtin-report.c
3193     @@ -671,6 +671,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
3194     struct stat st;
3195     bool has_br_stack = false;
3196     int branch_mode = -1;
3197     + int last_key = 0;
3198     bool branch_call_mode = false;
3199     char callchain_default_opt[] = CALLCHAIN_DEFAULT_OPT;
3200     const char * const report_usage[] = {
3201     @@ -956,7 +957,8 @@ repeat:
3202     else
3203     use_browser = 0;
3204    
3205     - if (setup_sorting(session->evlist) < 0) {
3206     + if ((last_key != K_SWITCH_INPUT_DATA) &&
3207     + (setup_sorting(session->evlist) < 0)) {
3208     if (sort_order)
3209     parse_options_usage(report_usage, options, "s", 1);
3210     if (field_order)
3211     @@ -1011,6 +1013,7 @@ repeat:
3212     ret = __cmd_report(&report);
3213     if (ret == K_SWITCH_INPUT_DATA) {
3214     perf_session__delete(session);
3215     + last_key = K_SWITCH_INPUT_DATA;
3216     goto repeat;
3217     } else
3218     ret = 0;
3219     diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
3220     index 159d616e170b..fdd7a1cb6be9 100644
3221     --- a/tools/perf/util/hist.h
3222     +++ b/tools/perf/util/hist.h
3223     @@ -312,10 +312,10 @@ static inline void perf_hpp__prepend_sort_field(struct perf_hpp_fmt *format)
3224     list_for_each_entry_safe(format, tmp, &(_list)->sorts, sort_list)
3225    
3226     #define hists__for_each_format(hists, format) \
3227     - perf_hpp_list__for_each_format((hists)->hpp_list, fmt)
3228     + perf_hpp_list__for_each_format((hists)->hpp_list, format)
3229    
3230     #define hists__for_each_sort_list(hists, format) \
3231     - perf_hpp_list__for_each_sort_list((hists)->hpp_list, fmt)
3232     + perf_hpp_list__for_each_sort_list((hists)->hpp_list, format)
3233    
3234     extern struct perf_hpp_fmt perf_hpp__format[];
3235    
3236     diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
3237     index 6ca804a01cf9..ffaa798df75e 100644
3238     --- a/tools/perf/util/probe-finder.c
3239     +++ b/tools/perf/util/probe-finder.c
3240     @@ -612,38 +612,26 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod,
3241     const char *function,
3242     struct probe_trace_point *tp)
3243     {
3244     - Dwarf_Addr eaddr, highaddr;
3245     + Dwarf_Addr eaddr;
3246     GElf_Sym sym;
3247     const char *symbol;
3248    
3249     /* Verify the address is correct */
3250     - if (dwarf_entrypc(sp_die, &eaddr) != 0) {
3251     - pr_warning("Failed to get entry address of %s\n",
3252     - dwarf_diename(sp_die));
3253     - return -ENOENT;
3254     - }
3255     - if (dwarf_highpc(sp_die, &highaddr) != 0) {
3256     - pr_warning("Failed to get end address of %s\n",
3257     - dwarf_diename(sp_die));
3258     - return -ENOENT;
3259     - }
3260     - if (paddr > highaddr) {
3261     - pr_warning("Offset specified is greater than size of %s\n",
3262     + if (!dwarf_haspc(sp_die, paddr)) {
3263     + pr_warning("Specified offset is out of %s\n",
3264     dwarf_diename(sp_die));
3265     return -EINVAL;
3266     }
3267    
3268     - symbol = dwarf_diename(sp_die);
3269     + /* Try to get actual symbol name from symtab */
3270     + symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL);
3271     if (!symbol) {
3272     - /* Try to get the symbol name from symtab */
3273     - symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL);
3274     - if (!symbol) {
3275     - pr_warning("Failed to find symbol at 0x%lx\n",
3276     - (unsigned long)paddr);
3277     - return -ENOENT;
3278     - }
3279     - eaddr = sym.st_value;
3280     + pr_warning("Failed to find symbol at 0x%lx\n",
3281     + (unsigned long)paddr);
3282     + return -ENOENT;
3283     }
3284     + eaddr = sym.st_value;
3285     +
3286     tp->offset = (unsigned long)(paddr - eaddr);
3287     tp->address = (unsigned long)paddr;
3288     tp->symbol = strdup(symbol);
3289     diff --git a/tools/testing/selftests/rseq/settings b/tools/testing/selftests/rseq/settings
3290     new file mode 100644
3291     index 000000000000..e7b9417537fb
3292     --- /dev/null
3293     +++ b/tools/testing/selftests/rseq/settings
3294     @@ -0,0 +1 @@
3295     +timeout=0