Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Wed, 26 Sep 2018 10:41:31
Message-Id: 1537958472.5fb3c10e0f72fe832521467bb171b9a0f68887eb.mpagano@gentoo
1 commit: 5fb3c10e0f72fe832521467bb171b9a0f68887eb
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 26 10:41:12 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 26 10:41:12 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=5fb3c10e
7
8 Linux patch 4.14.72
9
10 0000_README | 4 +
11 1071_linux-4.14.72.patch | 4762 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 4766 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index cc63ee7..ce833af 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -327,6 +327,10 @@ Patch: 1070_linux-4.14.71.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.14.71
21
22 +Patch: 1071_linux-4.14.72.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.14.72
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1071_linux-4.14.72.patch b/1071_linux-4.14.72.patch
31 new file mode 100644
32 index 0000000..be2606a
33 --- /dev/null
34 +++ b/1071_linux-4.14.72.patch
35 @@ -0,0 +1,4762 @@
36 +diff --git a/Makefile b/Makefile
37 +index dd4eaeeb2050..734722bda173 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,7 +1,7 @@
41 + # SPDX-License-Identifier: GPL-2.0
42 + VERSION = 4
43 + PATCHLEVEL = 14
44 +-SUBLEVEL = 71
45 ++SUBLEVEL = 72
46 + EXTRAVERSION =
47 + NAME = Petit Gorille
48 +
49 +diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
50 +index 4dc0b347b1ee..c2dc9d09484a 100644
51 +--- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
52 ++++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
53 +@@ -189,6 +189,8 @@
54 + regulator-max-microvolt = <2950000>;
55 +
56 + regulator-boot-on;
57 ++ regulator-system-load = <200000>;
58 ++ regulator-allow-set-load;
59 + };
60 +
61 + l21 {
62 +diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
63 +index b529ba04ed16..eafa26d9f692 100644
64 +--- a/arch/arm/mach-exynos/suspend.c
65 ++++ b/arch/arm/mach-exynos/suspend.c
66 +@@ -209,6 +209,7 @@ static int __init exynos_pmu_irq_init(struct device_node *node,
67 + NULL);
68 + if (!domain) {
69 + iounmap(pmu_base_addr);
70 ++ pmu_base_addr = NULL;
71 + return -ENOMEM;
72 + }
73 +
74 +diff --git a/arch/arm/mach-hisi/hotplug.c b/arch/arm/mach-hisi/hotplug.c
75 +index a129aae72602..909bb2493781 100644
76 +--- a/arch/arm/mach-hisi/hotplug.c
77 ++++ b/arch/arm/mach-hisi/hotplug.c
78 +@@ -148,13 +148,20 @@ static int hi3xxx_hotplug_init(void)
79 + struct device_node *node;
80 +
81 + node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
82 +- if (node) {
83 +- ctrl_base = of_iomap(node, 0);
84 +- id = HI3620_CTRL;
85 +- return 0;
86 ++ if (!node) {
87 ++ id = ERROR_CTRL;
88 ++ return -ENOENT;
89 + }
90 +- id = ERROR_CTRL;
91 +- return -ENOENT;
92 ++
93 ++ ctrl_base = of_iomap(node, 0);
94 ++ of_node_put(node);
95 ++ if (!ctrl_base) {
96 ++ id = ERROR_CTRL;
97 ++ return -ENOMEM;
98 ++ }
99 ++
100 ++ id = HI3620_CTRL;
101 ++ return 0;
102 + }
103 +
104 + void hi3xxx_set_cpu(int cpu, bool enable)
105 +@@ -173,11 +180,15 @@ static bool hix5hd2_hotplug_init(void)
106 + struct device_node *np;
107 +
108 + np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl");
109 +- if (np) {
110 +- ctrl_base = of_iomap(np, 0);
111 +- return true;
112 +- }
113 +- return false;
114 ++ if (!np)
115 ++ return false;
116 ++
117 ++ ctrl_base = of_iomap(np, 0);
118 ++ of_node_put(np);
119 ++ if (!ctrl_base)
120 ++ return false;
121 ++
122 ++ return true;
123 + }
124 +
125 + void hix5hd2_set_cpu(int cpu, bool enable)
126 +@@ -219,10 +230,10 @@ void hip01_set_cpu(int cpu, bool enable)
127 +
128 + if (!ctrl_base) {
129 + np = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl");
130 +- if (np)
131 +- ctrl_base = of_iomap(np, 0);
132 +- else
133 +- BUG();
134 ++ BUG_ON(!np);
135 ++ ctrl_base = of_iomap(np, 0);
136 ++ of_node_put(np);
137 ++ BUG_ON(!ctrl_base);
138 + }
139 +
140 + if (enable) {
141 +diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
142 +index 1d63e6b879de..b6b44fdf7fac 100644
143 +--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
144 ++++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
145 +@@ -187,7 +187,7 @@
146 + led@6 {
147 + label = "apq8016-sbc:blue:bt";
148 + gpios = <&pm8916_mpps 3 GPIO_ACTIVE_HIGH>;
149 +- linux,default-trigger = "bt";
150 ++ linux,default-trigger = "bluetooth-power";
151 + default-state = "off";
152 + };
153 + };
154 +diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
155 +index a29c279b6e8e..dba6f0ff8106 100644
156 +--- a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
157 ++++ b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
158 +@@ -55,6 +55,7 @@
159 + clocks = <&sys_clk 32>;
160 + enable-method = "psci";
161 + operating-points-v2 = <&cluster0_opp>;
162 ++ #cooling-cells = <2>;
163 + };
164 +
165 + cpu2: cpu@100 {
166 +@@ -73,6 +74,7 @@
167 + clocks = <&sys_clk 33>;
168 + enable-method = "psci";
169 + operating-points-v2 = <&cluster1_opp>;
170 ++ #cooling-cells = <2>;
171 + };
172 + };
173 +
174 +diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
175 +index edaf346d13d5..34d915b6974b 100644
176 +--- a/arch/arm64/kernel/ptrace.c
177 ++++ b/arch/arm64/kernel/ptrace.c
178 +@@ -274,19 +274,22 @@ static int ptrace_hbp_set_event(unsigned int note_type,
179 +
180 + switch (note_type) {
181 + case NT_ARM_HW_BREAK:
182 +- if (idx < ARM_MAX_BRP) {
183 +- tsk->thread.debug.hbp_break[idx] = bp;
184 +- err = 0;
185 +- }
186 ++ if (idx >= ARM_MAX_BRP)
187 ++ goto out;
188 ++ idx = array_index_nospec(idx, ARM_MAX_BRP);
189 ++ tsk->thread.debug.hbp_break[idx] = bp;
190 ++ err = 0;
191 + break;
192 + case NT_ARM_HW_WATCH:
193 +- if (idx < ARM_MAX_WRP) {
194 +- tsk->thread.debug.hbp_watch[idx] = bp;
195 +- err = 0;
196 +- }
197 ++ if (idx >= ARM_MAX_WRP)
198 ++ goto out;
199 ++ idx = array_index_nospec(idx, ARM_MAX_WRP);
200 ++ tsk->thread.debug.hbp_watch[idx] = bp;
201 ++ err = 0;
202 + break;
203 + }
204 +
205 ++out:
206 + return err;
207 + }
208 +
209 +diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c
210 +index f206dafbb0a3..26a058d58d37 100644
211 +--- a/arch/mips/ath79/setup.c
212 ++++ b/arch/mips/ath79/setup.c
213 +@@ -40,6 +40,7 @@ static char ath79_sys_type[ATH79_SYS_TYPE_LEN];
214 +
215 + static void ath79_restart(char *command)
216 + {
217 ++ local_irq_disable();
218 + ath79_device_reset_set(AR71XX_RESET_FULL_CHIP);
219 + for (;;)
220 + if (cpu_wait)
221 +diff --git a/arch/mips/include/asm/mach-ath79/ath79.h b/arch/mips/include/asm/mach-ath79/ath79.h
222 +index 441faa92c3cd..6e6c0fead776 100644
223 +--- a/arch/mips/include/asm/mach-ath79/ath79.h
224 ++++ b/arch/mips/include/asm/mach-ath79/ath79.h
225 +@@ -134,6 +134,7 @@ static inline u32 ath79_pll_rr(unsigned reg)
226 + static inline void ath79_reset_wr(unsigned reg, u32 val)
227 + {
228 + __raw_writel(val, ath79_reset_base + reg);
229 ++ (void) __raw_readl(ath79_reset_base + reg); /* flush */
230 + }
231 +
232 + static inline u32 ath79_reset_rr(unsigned reg)
233 +diff --git a/arch/mips/jz4740/Platform b/arch/mips/jz4740/Platform
234 +index 28448d358c10..a2a5a85ea1f9 100644
235 +--- a/arch/mips/jz4740/Platform
236 ++++ b/arch/mips/jz4740/Platform
237 +@@ -1,4 +1,4 @@
238 + platform-$(CONFIG_MACH_INGENIC) += jz4740/
239 + cflags-$(CONFIG_MACH_INGENIC) += -I$(srctree)/arch/mips/include/asm/mach-jz4740
240 + load-$(CONFIG_MACH_INGENIC) += 0xffffffff80010000
241 +-zload-$(CONFIG_MACH_INGENIC) += 0xffffffff80600000
242 ++zload-$(CONFIG_MACH_INGENIC) += 0xffffffff81000000
243 +diff --git a/arch/mips/loongson64/common/cs5536/cs5536_ohci.c b/arch/mips/loongson64/common/cs5536/cs5536_ohci.c
244 +index f7c905e50dc4..92dc6bafc127 100644
245 +--- a/arch/mips/loongson64/common/cs5536/cs5536_ohci.c
246 ++++ b/arch/mips/loongson64/common/cs5536/cs5536_ohci.c
247 +@@ -138,7 +138,7 @@ u32 pci_ohci_read_reg(int reg)
248 + break;
249 + case PCI_OHCI_INT_REG:
250 + _rdmsr(DIVIL_MSR_REG(PIC_YSEL_LOW), &hi, &lo);
251 +- if ((lo & 0x00000f00) == CS5536_USB_INTR)
252 ++ if (((lo >> PIC_YSEL_LOW_USB_SHIFT) & 0xf) == CS5536_USB_INTR)
253 + conf_data = 1;
254 + break;
255 + default:
256 +diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
257 +index 377d1420bd02..58746328b9bd 100644
258 +--- a/arch/powerpc/kvm/book3s_hv.c
259 ++++ b/arch/powerpc/kvm/book3s_hv.c
260 +@@ -4356,6 +4356,8 @@ static int kvmppc_book3s_init_hv(void)
261 + pr_err("KVM-HV: Cannot determine method for accessing XICS\n");
262 + return -ENODEV;
263 + }
264 ++ /* presence of intc confirmed - node can be dropped again */
265 ++ of_node_put(np);
266 + }
267 + #endif
268 +
269 +diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
270 +index 65c79ecf5a4d..c8a743af6bf5 100644
271 +--- a/arch/powerpc/platforms/powernv/opal.c
272 ++++ b/arch/powerpc/platforms/powernv/opal.c
273 +@@ -388,7 +388,7 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
274 + /* Closed or other error drop */
275 + if (rc != OPAL_SUCCESS && rc != OPAL_BUSY &&
276 + rc != OPAL_BUSY_EVENT) {
277 +- written = total_len;
278 ++ written += total_len;
279 + break;
280 + }
281 + if (rc == OPAL_SUCCESS) {
282 +diff --git a/arch/s390/crypto/paes_s390.c b/arch/s390/crypto/paes_s390.c
283 +index a4e903ed7e21..b429aceff050 100644
284 +--- a/arch/s390/crypto/paes_s390.c
285 ++++ b/arch/s390/crypto/paes_s390.c
286 +@@ -212,7 +212,7 @@ static int cbc_paes_crypt(struct blkcipher_desc *desc, unsigned long modifier,
287 + walk->dst.virt.addr, walk->src.virt.addr, n);
288 + if (k)
289 + ret = blkcipher_walk_done(desc, walk, nbytes - k);
290 +- if (n < k) {
291 ++ if (k < n) {
292 + if (__cbc_paes_set_key(ctx) != 0)
293 + return blkcipher_walk_done(desc, walk, -EIO);
294 + memcpy(param.key, ctx->pk.protkey, MAXPROTKEYSIZE);
295 +diff --git a/arch/x86/kernel/eisa.c b/arch/x86/kernel/eisa.c
296 +index f260e452e4f8..e8c8c5d78dbd 100644
297 +--- a/arch/x86/kernel/eisa.c
298 ++++ b/arch/x86/kernel/eisa.c
299 +@@ -7,11 +7,17 @@
300 + #include <linux/eisa.h>
301 + #include <linux/io.h>
302 +
303 ++#include <xen/xen.h>
304 ++
305 + static __init int eisa_bus_probe(void)
306 + {
307 +- void __iomem *p = ioremap(0x0FFFD9, 4);
308 ++ void __iomem *p;
309 ++
310 ++ if (xen_pv_domain() && !xen_initial_domain())
311 ++ return 0;
312 +
313 +- if (readl(p) == 'E' + ('I'<<8) + ('S'<<16) + ('A'<<24))
314 ++ p = ioremap(0x0FFFD9, 4);
315 ++ if (p && readl(p) == 'E' + ('I' << 8) + ('S' << 16) + ('A' << 24))
316 + EISA_bus = 1;
317 + iounmap(p);
318 + return 0;
319 +diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
320 +index d6f11accd37a..b07e3ffc5ac5 100644
321 +--- a/arch/x86/mm/pti.c
322 ++++ b/arch/x86/mm/pti.c
323 +@@ -162,7 +162,7 @@ static __init p4d_t *pti_user_pagetable_walk_p4d(unsigned long address)
324 +
325 + if (pgd_none(*pgd)) {
326 + unsigned long new_p4d_page = __get_free_page(gfp);
327 +- if (!new_p4d_page)
328 ++ if (WARN_ON_ONCE(!new_p4d_page))
329 + return NULL;
330 +
331 + set_pgd(pgd, __pgd(_KERNPG_TABLE | __pa(new_p4d_page)));
332 +@@ -181,13 +181,17 @@ static __init p4d_t *pti_user_pagetable_walk_p4d(unsigned long address)
333 + static __init pmd_t *pti_user_pagetable_walk_pmd(unsigned long address)
334 + {
335 + gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO);
336 +- p4d_t *p4d = pti_user_pagetable_walk_p4d(address);
337 ++ p4d_t *p4d;
338 + pud_t *pud;
339 +
340 ++ p4d = pti_user_pagetable_walk_p4d(address);
341 ++ if (!p4d)
342 ++ return NULL;
343 ++
344 + BUILD_BUG_ON(p4d_large(*p4d) != 0);
345 + if (p4d_none(*p4d)) {
346 + unsigned long new_pud_page = __get_free_page(gfp);
347 +- if (!new_pud_page)
348 ++ if (WARN_ON_ONCE(!new_pud_page))
349 + return NULL;
350 +
351 + set_p4d(p4d, __p4d(_KERNPG_TABLE | __pa(new_pud_page)));
352 +@@ -201,7 +205,7 @@ static __init pmd_t *pti_user_pagetable_walk_pmd(unsigned long address)
353 + }
354 + if (pud_none(*pud)) {
355 + unsigned long new_pmd_page = __get_free_page(gfp);
356 +- if (!new_pmd_page)
357 ++ if (WARN_ON_ONCE(!new_pmd_page))
358 + return NULL;
359 +
360 + set_pud(pud, __pud(_KERNPG_TABLE | __pa(new_pmd_page)));
361 +@@ -223,9 +227,13 @@ static __init pmd_t *pti_user_pagetable_walk_pmd(unsigned long address)
362 + static __init pte_t *pti_user_pagetable_walk_pte(unsigned long address)
363 + {
364 + gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO);
365 +- pmd_t *pmd = pti_user_pagetable_walk_pmd(address);
366 ++ pmd_t *pmd;
367 + pte_t *pte;
368 +
369 ++ pmd = pti_user_pagetable_walk_pmd(address);
370 ++ if (!pmd)
371 ++ return NULL;
372 ++
373 + /* We can't do anything sensible if we hit a large mapping. */
374 + if (pmd_large(*pmd)) {
375 + WARN_ON(1);
376 +@@ -283,6 +291,10 @@ pti_clone_pmds(unsigned long start, unsigned long end, pmdval_t clear)
377 + p4d_t *p4d;
378 + pud_t *pud;
379 +
380 ++ /* Overflow check */
381 ++ if (addr < start)
382 ++ break;
383 ++
384 + pgd = pgd_offset_k(addr);
385 + if (WARN_ON(pgd_none(*pgd)))
386 + return;
387 +@@ -319,6 +331,9 @@ static void __init pti_clone_p4d(unsigned long addr)
388 + pgd_t *kernel_pgd;
389 +
390 + user_p4d = pti_user_pagetable_walk_p4d(addr);
391 ++ if (!user_p4d)
392 ++ return;
393 ++
394 + kernel_pgd = pgd_offset_k(addr);
395 + kernel_p4d = p4d_offset(kernel_pgd, addr);
396 + *user_p4d = *kernel_p4d;
397 +diff --git a/arch/xtensa/platforms/iss/setup.c b/arch/xtensa/platforms/iss/setup.c
398 +index f4bbb28026f8..58709e89a8ed 100644
399 +--- a/arch/xtensa/platforms/iss/setup.c
400 ++++ b/arch/xtensa/platforms/iss/setup.c
401 +@@ -78,23 +78,28 @@ static struct notifier_block iss_panic_block = {
402 +
403 + void __init platform_setup(char **p_cmdline)
404 + {
405 ++ static void *argv[COMMAND_LINE_SIZE / sizeof(void *)] __initdata;
406 ++ static char cmdline[COMMAND_LINE_SIZE] __initdata;
407 + int argc = simc_argc();
408 + int argv_size = simc_argv_size();
409 +
410 + if (argc > 1) {
411 +- void **argv = alloc_bootmem(argv_size);
412 +- char *cmdline = alloc_bootmem(argv_size);
413 +- int i;
414 ++ if (argv_size > sizeof(argv)) {
415 ++ pr_err("%s: command line too long: argv_size = %d\n",
416 ++ __func__, argv_size);
417 ++ } else {
418 ++ int i;
419 +
420 +- cmdline[0] = 0;
421 +- simc_argv((void *)argv);
422 ++ cmdline[0] = 0;
423 ++ simc_argv((void *)argv);
424 +
425 +- for (i = 1; i < argc; ++i) {
426 +- if (i > 1)
427 +- strcat(cmdline, " ");
428 +- strcat(cmdline, argv[i]);
429 ++ for (i = 1; i < argc; ++i) {
430 ++ if (i > 1)
431 ++ strcat(cmdline, " ");
432 ++ strcat(cmdline, argv[i]);
433 ++ }
434 ++ *p_cmdline = cmdline;
435 + }
436 +- *p_cmdline = cmdline;
437 + }
438 +
439 + atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
440 +diff --git a/block/blk-core.c b/block/blk-core.c
441 +index 1d27e2a152e0..6aa2bc4e9652 100644
442 +--- a/block/blk-core.c
443 ++++ b/block/blk-core.c
444 +@@ -669,9 +669,13 @@ void blk_cleanup_queue(struct request_queue *q)
445 + * make sure all in-progress dispatch are completed because
446 + * blk_freeze_queue() can only complete all requests, and
447 + * dispatch may still be in-progress since we dispatch requests
448 +- * from more than one contexts
449 ++ * from more than one contexts.
450 ++ *
451 ++ * No need to quiesce queue if it isn't initialized yet since
452 ++ * blk_freeze_queue() should be enough for cases of passthrough
453 ++ * request.
454 + */
455 +- if (q->mq_ops)
456 ++ if (q->mq_ops && blk_queue_init_done(q))
457 + blk_mq_quiesce_queue(q);
458 +
459 + /* for synchronous bio-based driver finish in-flight integrity i/o */
460 +diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
461 +index eca011fdfa0e..ae5d8f10a27c 100644
462 +--- a/block/blk-mq-sched.c
463 ++++ b/block/blk-mq-sched.c
464 +@@ -236,7 +236,8 @@ bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio)
465 + return e->type->ops.mq.bio_merge(hctx, bio);
466 + }
467 +
468 +- if (hctx->flags & BLK_MQ_F_SHOULD_MERGE) {
469 ++ if ((hctx->flags & BLK_MQ_F_SHOULD_MERGE) &&
470 ++ !list_empty_careful(&ctx->rq_list)) {
471 + /* default per sw-queue merge */
472 + spin_lock(&ctx->lock);
473 + ret = blk_mq_attempt_merge(q, ctx, bio);
474 +diff --git a/block/blk-settings.c b/block/blk-settings.c
475 +index 8559e9563c52..474b0b95fcd1 100644
476 +--- a/block/blk-settings.c
477 ++++ b/block/blk-settings.c
478 +@@ -128,7 +128,7 @@ void blk_set_stacking_limits(struct queue_limits *lim)
479 +
480 + /* Inherit limits from component devices */
481 + lim->max_segments = USHRT_MAX;
482 +- lim->max_discard_segments = 1;
483 ++ lim->max_discard_segments = USHRT_MAX;
484 + lim->max_hw_sectors = UINT_MAX;
485 + lim->max_segment_size = UINT_MAX;
486 + lim->max_sectors = UINT_MAX;
487 +diff --git a/crypto/api.c b/crypto/api.c
488 +index 941cd4c6c7ec..e485aed11ad0 100644
489 +--- a/crypto/api.c
490 ++++ b/crypto/api.c
491 +@@ -215,7 +215,7 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask)
492 + mask &= ~(CRYPTO_ALG_LARVAL | CRYPTO_ALG_DEAD);
493 +
494 + alg = crypto_alg_lookup(name, type, mask);
495 +- if (!alg) {
496 ++ if (!alg && !(mask & CRYPTO_NOLOAD)) {
497 + request_module("crypto-%s", name);
498 +
499 + if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask &
500 +diff --git a/drivers/base/core.c b/drivers/base/core.c
501 +index b054cb2fd2b9..eb066cc827ef 100644
502 +--- a/drivers/base/core.c
503 ++++ b/drivers/base/core.c
504 +@@ -2783,6 +2783,9 @@ void device_shutdown(void)
505 + {
506 + struct device *dev, *parent;
507 +
508 ++ wait_for_device_probe();
509 ++ device_block_probing();
510 ++
511 + spin_lock(&devices_kset->list_lock);
512 + /*
513 + * Walk the devices list backward, shutting down each in turn.
514 +diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
515 +index 6f2eaba1cd6a..932678617dfa 100644
516 +--- a/drivers/char/ipmi/ipmi_ssif.c
517 ++++ b/drivers/char/ipmi/ipmi_ssif.c
518 +@@ -184,6 +184,8 @@ struct ssif_addr_info {
519 + struct device *dev;
520 + struct i2c_client *client;
521 +
522 ++ struct i2c_client *added_client;
523 ++
524 + struct mutex clients_mutex;
525 + struct list_head clients;
526 +
527 +@@ -1710,15 +1712,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
528 +
529 + out:
530 + if (rv) {
531 +- /*
532 +- * Note that if addr_info->client is assigned, we
533 +- * leave it. The i2c client hangs around even if we
534 +- * return a failure here, and the failure here is not
535 +- * propagated back to the i2c code. This seems to be
536 +- * design intent, strange as it may be. But if we
537 +- * don't leave it, ssif_platform_remove will not remove
538 +- * the client like it should.
539 +- */
540 ++ addr_info->client = NULL;
541 + dev_err(&client->dev, "Unable to start IPMI SSIF: %d\n", rv);
542 + kfree(ssif_info);
543 + }
544 +@@ -1737,7 +1731,8 @@ static int ssif_adapter_handler(struct device *adev, void *opaque)
545 + if (adev->type != &i2c_adapter_type)
546 + return 0;
547 +
548 +- i2c_new_device(to_i2c_adapter(adev), &addr_info->binfo);
549 ++ addr_info->added_client = i2c_new_device(to_i2c_adapter(adev),
550 ++ &addr_info->binfo);
551 +
552 + if (!addr_info->adapter_name)
553 + return 1; /* Only try the first I2C adapter by default. */
554 +@@ -2018,8 +2013,8 @@ static int ssif_platform_remove(struct platform_device *dev)
555 + return 0;
556 +
557 + mutex_lock(&ssif_infos_mutex);
558 +- if (addr_info->client)
559 +- i2c_unregister_device(addr_info->client);
560 ++ if (addr_info->added_client)
561 ++ i2c_unregister_device(addr_info->added_client);
562 +
563 + list_del(&addr_info->link);
564 + kfree(addr_info);
565 +diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
566 +index a5d402de5584..20724abd38bd 100644
567 +--- a/drivers/clk/clk-fixed-factor.c
568 ++++ b/drivers/clk/clk-fixed-factor.c
569 +@@ -177,8 +177,15 @@ static struct clk *_of_fixed_factor_clk_setup(struct device_node *node)
570 +
571 + clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags,
572 + mult, div);
573 +- if (IS_ERR(clk))
574 ++ if (IS_ERR(clk)) {
575 ++ /*
576 ++ * If parent clock is not registered, registration would fail.
577 ++ * Clear OF_POPULATED flag so that clock registration can be
578 ++ * attempted again from probe function.
579 ++ */
580 ++ of_node_clear_flag(node, OF_POPULATED);
581 + return clk;
582 ++ }
583 +
584 + ret = of_clk_add_provider(node, of_clk_src_simple_get, clk);
585 + if (ret) {
586 +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
587 +index 6f4c98ca6e50..a3f52f678211 100644
588 +--- a/drivers/clk/clk.c
589 ++++ b/drivers/clk/clk.c
590 +@@ -2557,6 +2557,7 @@ struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id,
591 + return clk;
592 + }
593 +
594 ++/* keep in sync with __clk_put */
595 + void __clk_free_clk(struct clk *clk)
596 + {
597 + clk_prepare_lock();
598 +@@ -2922,6 +2923,7 @@ int __clk_get(struct clk *clk)
599 + return 1;
600 + }
601 +
602 ++/* keep in sync with __clk_free_clk */
603 + void __clk_put(struct clk *clk)
604 + {
605 + struct module *owner;
606 +@@ -2943,6 +2945,7 @@ void __clk_put(struct clk *clk)
607 +
608 + module_put(owner);
609 +
610 ++ kfree_const(clk->con_id);
611 + kfree(clk);
612 + }
613 +
614 +diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
615 +index 41c08fc892b9..5cc5ff1b4e1f 100644
616 +--- a/drivers/clk/imx/clk-imx6ul.c
617 ++++ b/drivers/clk/imx/clk-imx6ul.c
618 +@@ -135,6 +135,7 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
619 +
620 + np = of_find_compatible_node(NULL, NULL, "fsl,imx6ul-anatop");
621 + base = of_iomap(np, 0);
622 ++ of_node_put(np);
623 + WARN_ON(!base);
624 +
625 + clks[IMX6UL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
626 +diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c
627 +index 638ace64033b..6c933b0e29a3 100644
628 +--- a/drivers/clk/tegra/clk-bpmp.c
629 ++++ b/drivers/clk/tegra/clk-bpmp.c
630 +@@ -581,9 +581,15 @@ static struct clk_hw *tegra_bpmp_clk_of_xlate(struct of_phandle_args *clkspec,
631 + unsigned int id = clkspec->args[0], i;
632 + struct tegra_bpmp *bpmp = data;
633 +
634 +- for (i = 0; i < bpmp->num_clocks; i++)
635 +- if (bpmp->clocks[i]->id == id)
636 +- return &bpmp->clocks[i]->hw;
637 ++ for (i = 0; i < bpmp->num_clocks; i++) {
638 ++ struct tegra_bpmp_clk *clk = bpmp->clocks[i];
639 ++
640 ++ if (!clk)
641 ++ continue;
642 ++
643 ++ if (clk->id == id)
644 ++ return &clk->hw;
645 ++ }
646 +
647 + return NULL;
648 + }
649 +diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
650 +index 08e7bdcaa6e3..085c229eab1d 100644
651 +--- a/drivers/crypto/sahara.c
652 ++++ b/drivers/crypto/sahara.c
653 +@@ -1351,7 +1351,7 @@ err_sha_v4_algs:
654 +
655 + err_sha_v3_algs:
656 + for (j = 0; j < k; j++)
657 +- crypto_unregister_ahash(&sha_v4_algs[j]);
658 ++ crypto_unregister_ahash(&sha_v3_algs[j]);
659 +
660 + err_aes_algs:
661 + for (j = 0; j < i; j++)
662 +@@ -1367,7 +1367,7 @@ static void sahara_unregister_algs(struct sahara_dev *dev)
663 + for (i = 0; i < ARRAY_SIZE(aes_algs); i++)
664 + crypto_unregister_alg(&aes_algs[i]);
665 +
666 +- for (i = 0; i < ARRAY_SIZE(sha_v4_algs); i++)
667 ++ for (i = 0; i < ARRAY_SIZE(sha_v3_algs); i++)
668 + crypto_unregister_ahash(&sha_v3_algs[i]);
669 +
670 + if (dev->version > SAHARA_VERSION_3)
671 +diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c
672 +index 3548caa9e933..75eef589d0ec 100644
673 +--- a/drivers/dma/mv_xor_v2.c
674 ++++ b/drivers/dma/mv_xor_v2.c
675 +@@ -898,6 +898,8 @@ static int mv_xor_v2_remove(struct platform_device *pdev)
676 +
677 + platform_msi_domain_free_irqs(&pdev->dev);
678 +
679 ++ tasklet_kill(&xor_dev->irq_tasklet);
680 ++
681 + clk_disable_unprepare(xor_dev->clk);
682 +
683 + return 0;
684 +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
685 +index d19862f4dc9a..6afd42cfbf5d 100644
686 +--- a/drivers/dma/pl330.c
687 ++++ b/drivers/dma/pl330.c
688 +@@ -2142,13 +2142,14 @@ static int pl330_terminate_all(struct dma_chan *chan)
689 +
690 + pm_runtime_get_sync(pl330->ddma.dev);
691 + spin_lock_irqsave(&pch->lock, flags);
692 ++
693 + spin_lock(&pl330->lock);
694 + _stop(pch->thread);
695 +- spin_unlock(&pl330->lock);
696 +-
697 + pch->thread->req[0].desc = NULL;
698 + pch->thread->req[1].desc = NULL;
699 + pch->thread->req_running = -1;
700 ++ spin_unlock(&pl330->lock);
701 ++
702 + power_down = pch->active;
703 + pch->active = false;
704 +
705 +diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
706 +index 80d1a885def5..a7c522eac640 100644
707 +--- a/drivers/firmware/efi/arm-init.c
708 ++++ b/drivers/firmware/efi/arm-init.c
709 +@@ -259,7 +259,6 @@ void __init efi_init(void)
710 +
711 + reserve_regions();
712 + efi_esrt_init();
713 +- efi_memmap_unmap();
714 +
715 + memblock_reserve(params.mmap & PAGE_MASK,
716 + PAGE_ALIGN(params.mmap_size +
717 +diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c
718 +index 86a1ad17a32e..8995a48bd067 100644
719 +--- a/drivers/firmware/efi/arm-runtime.c
720 ++++ b/drivers/firmware/efi/arm-runtime.c
721 +@@ -122,11 +122,13 @@ static int __init arm_enable_runtime_services(void)
722 + {
723 + u64 mapsize;
724 +
725 +- if (!efi_enabled(EFI_BOOT)) {
726 ++ if (!efi_enabled(EFI_BOOT) || !efi_enabled(EFI_MEMMAP)) {
727 + pr_info("EFI services will not be available.\n");
728 + return 0;
729 + }
730 +
731 ++ efi_memmap_unmap();
732 ++
733 + if (efi_runtime_disabled()) {
734 + pr_info("EFI runtime services will be disabled.\n");
735 + return 0;
736 +diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c
737 +index c47e0c6ec00f..f3c28777b8c6 100644
738 +--- a/drivers/firmware/efi/esrt.c
739 ++++ b/drivers/firmware/efi/esrt.c
740 +@@ -333,7 +333,8 @@ void __init efi_esrt_init(void)
741 +
742 + end = esrt_data + size;
743 + pr_info("Reserving ESRT space from %pa to %pa.\n", &esrt_data, &end);
744 +- efi_mem_reserve(esrt_data, esrt_data_size);
745 ++ if (md.type == EFI_BOOT_SERVICES_DATA)
746 ++ efi_mem_reserve(esrt_data, esrt_data_size);
747 +
748 + pr_debug("esrt-init: loaded.\n");
749 + err_memunmap:
750 +diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
751 +index 6029899789f3..2943dfc4c470 100644
752 +--- a/drivers/gpio/gpio-pxa.c
753 ++++ b/drivers/gpio/gpio-pxa.c
754 +@@ -662,6 +662,8 @@ static int pxa_gpio_probe(struct platform_device *pdev)
755 + pchip->irq0 = irq0;
756 + pchip->irq1 = irq1;
757 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
758 ++ if (!res)
759 ++ return -EINVAL;
760 + gpio_reg_base = devm_ioremap(&pdev->dev, res->start,
761 + resource_size(res));
762 + if (!gpio_reg_base)
763 +diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
764 +index 3d4d0634c9dd..7a3d9658d74c 100644
765 +--- a/drivers/gpio/gpiolib.h
766 ++++ b/drivers/gpio/gpiolib.h
767 +@@ -88,7 +88,7 @@ struct acpi_gpio_info {
768 + };
769 +
770 + /* gpio suffixes used for ACPI and device tree lookup */
771 +-static const char * const gpio_suffixes[] = { "gpios", "gpio" };
772 ++static __maybe_unused const char * const gpio_suffixes[] = { "gpios", "gpio" };
773 +
774 + #ifdef CONFIG_OF_GPIO
775 + struct gpio_desc *of_find_gpio(struct device *dev,
776 +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
777 +index c74cf22a1ed9..3ae88dcff08d 100644
778 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
779 ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
780 +@@ -123,6 +123,8 @@ struct kfd_process *kfd_get_process(const struct task_struct *thread)
781 + return ERR_PTR(-EINVAL);
782 +
783 + process = find_process(thread);
784 ++ if (!process)
785 ++ return ERR_PTR(-EINVAL);
786 +
787 + return process;
788 + }
789 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
790 +index 90359c7954c8..3c0ce3ee0710 100644
791 +--- a/drivers/gpu/drm/i915/i915_gem.c
792 ++++ b/drivers/gpu/drm/i915/i915_gem.c
793 +@@ -687,10 +687,10 @@ flush_write_domain(struct drm_i915_gem_object *obj, unsigned int flush_domains)
794 +
795 + switch (obj->base.write_domain) {
796 + case I915_GEM_DOMAIN_GTT:
797 +- if (INTEL_GEN(dev_priv) >= 6 && !HAS_LLC(dev_priv)) {
798 ++ if (!HAS_LLC(dev_priv)) {
799 + intel_runtime_pm_get(dev_priv);
800 + spin_lock_irq(&dev_priv->uncore.lock);
801 +- POSTING_READ_FW(RING_ACTHD(dev_priv->engine[RCS]->mmio_base));
802 ++ POSTING_READ_FW(RING_HEAD(dev_priv->engine[RCS]->mmio_base));
803 + spin_unlock_irq(&dev_priv->uncore.lock);
804 + intel_runtime_pm_put(dev_priv);
805 + }
806 +diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
807 +index 963a4dba8213..9109b69cd052 100644
808 +--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c
809 ++++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
810 +@@ -160,7 +160,11 @@ nouveau_debugfs_pstate_set(struct file *file, const char __user *ubuf,
811 + args.ustate = value;
812 + }
813 +
814 ++ ret = pm_runtime_get_sync(drm->dev);
815 ++ if (IS_ERR_VALUE(ret) && ret != -EACCES)
816 ++ return ret;
817 + ret = nvif_mthd(ctrl, NVIF_CONTROL_PSTATE_USER, &args, sizeof(args));
818 ++ pm_runtime_put_autosuspend(drm->dev);
819 + if (ret < 0)
820 + return ret;
821 +
822 +diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
823 +index 362a34cb435d..d6f13d7254de 100644
824 +--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
825 ++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
826 +@@ -848,8 +848,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv)
827 + get_task_comm(tmpname, current);
828 + snprintf(name, sizeof(name), "%s[%d]", tmpname, pid_nr(fpriv->pid));
829 +
830 +- if (!(cli = kzalloc(sizeof(*cli), GFP_KERNEL)))
831 +- return ret;
832 ++ if (!(cli = kzalloc(sizeof(*cli), GFP_KERNEL))) {
833 ++ ret = -ENOMEM;
834 ++ goto done;
835 ++ }
836 +
837 + ret = nouveau_cli_init(drm, name, cli);
838 + if (ret)
839 +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
840 +index 189ed80e21ff..fa1ead337c23 100644
841 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
842 ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
843 +@@ -23,6 +23,10 @@
844 + #ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER
845 + #include "priv.h"
846 +
847 ++#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
848 ++#include <asm/dma-iommu.h>
849 ++#endif
850 ++
851 + static int
852 + nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev)
853 + {
854 +@@ -105,6 +109,15 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev)
855 + unsigned long pgsize_bitmap;
856 + int ret;
857 +
858 ++#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
859 ++ if (dev->archdata.mapping) {
860 ++ struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);
861 ++
862 ++ arm_iommu_detach_device(dev);
863 ++ arm_iommu_release_mapping(mapping);
864 ++ }
865 ++#endif
866 ++
867 + if (!tdev->func->iommu_bit)
868 + return;
869 +
870 +diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
871 +index a188a3959f1a..6ad827b93ae1 100644
872 +--- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
873 ++++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
874 +@@ -823,7 +823,7 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx)
875 + int ret, i;
876 +
877 + ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id));
878 +- if (ret < ARRAY_SIZE(id) || id[0] == 0x00) {
879 ++ if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] == 0x00) {
880 + dev_err(ctx->dev, "read id failed\n");
881 + ctx->error = -EIO;
882 + return;
883 +diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c
884 +index 24e12b87a0cb..2bc51d4d3f1e 100644
885 +--- a/drivers/gpu/ipu-v3/ipu-csi.c
886 ++++ b/drivers/gpu/ipu-v3/ipu-csi.c
887 +@@ -316,13 +316,17 @@ static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code)
888 + /*
889 + * Fill a CSI bus config struct from mbus_config and mbus_framefmt.
890 + */
891 +-static void fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
892 ++static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
893 + struct v4l2_mbus_config *mbus_cfg,
894 + struct v4l2_mbus_framefmt *mbus_fmt)
895 + {
896 ++ int ret;
897 ++
898 + memset(csicfg, 0, sizeof(*csicfg));
899 +
900 +- mbus_code_to_bus_cfg(csicfg, mbus_fmt->code);
901 ++ ret = mbus_code_to_bus_cfg(csicfg, mbus_fmt->code);
902 ++ if (ret < 0)
903 ++ return ret;
904 +
905 + switch (mbus_cfg->type) {
906 + case V4L2_MBUS_PARALLEL:
907 +@@ -353,6 +357,8 @@ static void fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
908 + /* will never get here, keep compiler quiet */
909 + break;
910 + }
911 ++
912 ++ return 0;
913 + }
914 +
915 + int ipu_csi_init_interface(struct ipu_csi *csi,
916 +@@ -362,8 +368,11 @@ int ipu_csi_init_interface(struct ipu_csi *csi,
917 + struct ipu_csi_bus_config cfg;
918 + unsigned long flags;
919 + u32 width, height, data = 0;
920 ++ int ret;
921 +
922 +- fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt);
923 ++ ret = fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt);
924 ++ if (ret < 0)
925 ++ return ret;
926 +
927 + /* set default sensor frame width and height */
928 + width = mbus_fmt->width;
929 +@@ -584,11 +593,14 @@ int ipu_csi_set_mipi_datatype(struct ipu_csi *csi, u32 vc,
930 + struct ipu_csi_bus_config cfg;
931 + unsigned long flags;
932 + u32 temp;
933 ++ int ret;
934 +
935 + if (vc > 3)
936 + return -EINVAL;
937 +
938 +- mbus_code_to_bus_cfg(&cfg, mbus_fmt->code);
939 ++ ret = mbus_code_to_bus_cfg(&cfg, mbus_fmt->code);
940 ++ if (ret < 0)
941 ++ return ret;
942 +
943 + spin_lock_irqsave(&csi->lock, flags);
944 +
945 +diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
946 +index cf364a514c12..5a1a14bcae72 100644
947 +--- a/drivers/hwtracing/coresight/coresight-etm4x.c
948 ++++ b/drivers/hwtracing/coresight/coresight-etm4x.c
949 +@@ -1034,7 +1034,8 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
950 + }
951 +
952 + pm_runtime_put(&adev->dev);
953 +- dev_info(dev, "%s initialized\n", (char *)id->data);
954 ++ dev_info(dev, "CPU%d: ETM v%d.%d initialized\n",
955 ++ drvdata->cpu, drvdata->arch >> 4, drvdata->arch & 0xf);
956 +
957 + if (boot_enable) {
958 + coresight_enable(drvdata->csdev);
959 +@@ -1052,23 +1053,19 @@ err_arch_supported:
960 + return ret;
961 + }
962 +
963 ++#define ETM4x_AMBA_ID(pid) \
964 ++ { \
965 ++ .id = pid, \
966 ++ .mask = 0x000fffff, \
967 ++ }
968 ++
969 + static const struct amba_id etm4_ids[] = {
970 +- { /* ETM 4.0 - Cortex-A53 */
971 +- .id = 0x000bb95d,
972 +- .mask = 0x000fffff,
973 +- .data = "ETM 4.0",
974 +- },
975 +- { /* ETM 4.0 - Cortex-A57 */
976 +- .id = 0x000bb95e,
977 +- .mask = 0x000fffff,
978 +- .data = "ETM 4.0",
979 +- },
980 +- { /* ETM 4.0 - A72, Maia, HiSilicon */
981 +- .id = 0x000bb95a,
982 +- .mask = 0x000fffff,
983 +- .data = "ETM 4.0",
984 +- },
985 +- { 0, 0},
986 ++ ETM4x_AMBA_ID(0x000bb95d), /* Cortex-A53 */
987 ++ ETM4x_AMBA_ID(0x000bb95e), /* Cortex-A57 */
988 ++ ETM4x_AMBA_ID(0x000bb95a), /* Cortex-A72 */
989 ++ ETM4x_AMBA_ID(0x000bb959), /* Cortex-A73 */
990 ++ ETM4x_AMBA_ID(0x000bb9da), /* Cortex-A35 */
991 ++ {},
992 + };
993 +
994 + static struct amba_driver etm4x_driver = {
995 +diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
996 +index 735dca089389..15dd01f8c197 100644
997 +--- a/drivers/hwtracing/coresight/coresight-tpiu.c
998 ++++ b/drivers/hwtracing/coresight/coresight-tpiu.c
999 +@@ -47,8 +47,9 @@
1000 +
1001 + /** register definition **/
1002 + /* FFSR - 0x300 */
1003 +-#define FFSR_FT_STOPPED BIT(1)
1004 ++#define FFSR_FT_STOPPED_BIT 1
1005 + /* FFCR - 0x304 */
1006 ++#define FFCR_FON_MAN_BIT 6
1007 + #define FFCR_FON_MAN BIT(6)
1008 + #define FFCR_STOP_FI BIT(12)
1009 +
1010 +@@ -93,9 +94,9 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata)
1011 + /* Generate manual flush */
1012 + writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
1013 + /* Wait for flush to complete */
1014 +- coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0);
1015 ++ coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN_BIT, 0);
1016 + /* Wait for formatter to stop */
1017 +- coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1);
1018 ++ coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED_BIT, 1);
1019 +
1020 + CS_LOCK(drvdata->base);
1021 + }
1022 +diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
1023 +index b8091bef21dc..e571e4010dff 100644
1024 +--- a/drivers/hwtracing/coresight/coresight.c
1025 ++++ b/drivers/hwtracing/coresight/coresight.c
1026 +@@ -115,7 +115,7 @@ static int coresight_find_link_inport(struct coresight_device *csdev,
1027 + dev_err(&csdev->dev, "couldn't find inport, parent: %s, child: %s\n",
1028 + dev_name(&parent->dev), dev_name(&csdev->dev));
1029 +
1030 +- return 0;
1031 ++ return -ENODEV;
1032 + }
1033 +
1034 + static int coresight_find_link_outport(struct coresight_device *csdev,
1035 +@@ -133,7 +133,7 @@ static int coresight_find_link_outport(struct coresight_device *csdev,
1036 + dev_err(&csdev->dev, "couldn't find outport, parent: %s, child: %s\n",
1037 + dev_name(&csdev->dev), dev_name(&child->dev));
1038 +
1039 +- return 0;
1040 ++ return -ENODEV;
1041 + }
1042 +
1043 + static int coresight_enable_sink(struct coresight_device *csdev, u32 mode)
1044 +@@ -186,6 +186,9 @@ static int coresight_enable_link(struct coresight_device *csdev,
1045 + else
1046 + refport = 0;
1047 +
1048 ++ if (refport < 0)
1049 ++ return refport;
1050 ++
1051 + if (atomic_inc_return(&csdev->refcnt[refport]) == 1) {
1052 + if (link_ops(csdev)->enable) {
1053 + ret = link_ops(csdev)->enable(csdev, inport, outport);
1054 +diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
1055 +index 2feae9a421e6..a074735456bc 100644
1056 +--- a/drivers/i2c/busses/i2c-aspeed.c
1057 ++++ b/drivers/i2c/busses/i2c-aspeed.c
1058 +@@ -110,22 +110,22 @@
1059 + #define ASPEED_I2CD_DEV_ADDR_MASK GENMASK(6, 0)
1060 +
1061 + enum aspeed_i2c_master_state {
1062 ++ ASPEED_I2C_MASTER_INACTIVE,
1063 + ASPEED_I2C_MASTER_START,
1064 + ASPEED_I2C_MASTER_TX_FIRST,
1065 + ASPEED_I2C_MASTER_TX,
1066 + ASPEED_I2C_MASTER_RX_FIRST,
1067 + ASPEED_I2C_MASTER_RX,
1068 + ASPEED_I2C_MASTER_STOP,
1069 +- ASPEED_I2C_MASTER_INACTIVE,
1070 + };
1071 +
1072 + enum aspeed_i2c_slave_state {
1073 ++ ASPEED_I2C_SLAVE_STOP,
1074 + ASPEED_I2C_SLAVE_START,
1075 + ASPEED_I2C_SLAVE_READ_REQUESTED,
1076 + ASPEED_I2C_SLAVE_READ_PROCESSED,
1077 + ASPEED_I2C_SLAVE_WRITE_REQUESTED,
1078 + ASPEED_I2C_SLAVE_WRITE_RECEIVED,
1079 +- ASPEED_I2C_SLAVE_STOP,
1080 + };
1081 +
1082 + struct aspeed_i2c_bus {
1083 +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
1084 +index 752dbc388c27..7c5eca312aa8 100644
1085 +--- a/drivers/infiniband/core/cma.c
1086 ++++ b/drivers/infiniband/core/cma.c
1087 +@@ -730,6 +730,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
1088 + dgid = (union ib_gid *) &addr->sib_addr;
1089 + pkey = ntohs(addr->sib_pkey);
1090 +
1091 ++ mutex_lock(&lock);
1092 + list_for_each_entry(cur_dev, &dev_list, list) {
1093 + for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
1094 + if (!rdma_cap_af_ib(cur_dev->device, p))
1095 +@@ -756,18 +757,19 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
1096 + cma_dev = cur_dev;
1097 + sgid = gid;
1098 + id_priv->id.port_num = p;
1099 ++ goto found;
1100 + }
1101 + }
1102 + }
1103 + }
1104 +-
1105 +- if (!cma_dev)
1106 +- return -ENODEV;
1107 ++ mutex_unlock(&lock);
1108 ++ return -ENODEV;
1109 +
1110 + found:
1111 + cma_attach_to_dev(id_priv, cma_dev);
1112 +- addr = (struct sockaddr_ib *) cma_src_addr(id_priv);
1113 +- memcpy(&addr->sib_addr, &sgid, sizeof sgid);
1114 ++ mutex_unlock(&lock);
1115 ++ addr = (struct sockaddr_ib *)cma_src_addr(id_priv);
1116 ++ memcpy(&addr->sib_addr, &sgid, sizeof(sgid));
1117 + cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr);
1118 + return 0;
1119 + }
1120 +diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
1121 +index fb8c83e055e1..83412df726a5 100644
1122 +--- a/drivers/infiniband/sw/rxe/rxe_recv.c
1123 ++++ b/drivers/infiniband/sw/rxe/rxe_recv.c
1124 +@@ -225,9 +225,14 @@ static int hdr_check(struct rxe_pkt_info *pkt)
1125 + goto err1;
1126 + }
1127 +
1128 ++ if (unlikely(qpn == 0)) {
1129 ++ pr_warn_once("QP 0 not supported");
1130 ++ goto err1;
1131 ++ }
1132 ++
1133 + if (qpn != IB_MULTICAST_QPN) {
1134 +- index = (qpn == 0) ? port->qp_smi_index :
1135 +- ((qpn == 1) ? port->qp_gsi_index : qpn);
1136 ++ index = (qpn == 1) ? port->qp_gsi_index : qpn;
1137 ++
1138 + qp = rxe_pool_get_index(&rxe->qp_pool, index);
1139 + if (unlikely(!qp)) {
1140 + pr_warn_ratelimited("no qp matches qpn 0x%x\n", qpn);
1141 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1142 +index 7a5ed5a5391e..9939f32d0154 100644
1143 +--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1144 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1145 +@@ -1018,12 +1018,14 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
1146 +
1147 + skb_queue_head_init(&skqueue);
1148 +
1149 ++ netif_tx_lock_bh(p->dev);
1150 + spin_lock_irq(&priv->lock);
1151 + set_bit(IPOIB_FLAG_OPER_UP, &p->flags);
1152 + if (p->neigh)
1153 + while ((skb = __skb_dequeue(&p->neigh->queue)))
1154 + __skb_queue_tail(&skqueue, skb);
1155 + spin_unlock_irq(&priv->lock);
1156 ++ netif_tx_unlock_bh(p->dev);
1157 +
1158 + while ((skb = __skb_dequeue(&skqueue))) {
1159 + skb->dev = p->dev;
1160 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1161 +index 6bc9a768f721..e6ff16b27acd 100644
1162 +--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
1163 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1164 +@@ -1752,7 +1752,8 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
1165 + goto out_free_pd;
1166 + }
1167 +
1168 +- if (ipoib_neigh_hash_init(priv) < 0) {
1169 ++ ret = ipoib_neigh_hash_init(priv);
1170 ++ if (ret) {
1171 + pr_warn("%s failed to init neigh hash\n", dev->name);
1172 + goto out_dev_uninit;
1173 + }
1174 +diff --git a/drivers/input/touchscreen/rohm_bu21023.c b/drivers/input/touchscreen/rohm_bu21023.c
1175 +index eeaf6ff03597..fc54e044fece 100644
1176 +--- a/drivers/input/touchscreen/rohm_bu21023.c
1177 ++++ b/drivers/input/touchscreen/rohm_bu21023.c
1178 +@@ -304,7 +304,7 @@ static int rohm_i2c_burst_read(struct i2c_client *client, u8 start, void *buf,
1179 + msg[1].len = len;
1180 + msg[1].buf = buf;
1181 +
1182 +- i2c_lock_adapter(adap);
1183 ++ i2c_lock_bus(adap, I2C_LOCK_SEGMENT);
1184 +
1185 + for (i = 0; i < 2; i++) {
1186 + if (__i2c_transfer(adap, &msg[i], 1) < 0) {
1187 +@@ -313,7 +313,7 @@ static int rohm_i2c_burst_read(struct i2c_client *client, u8 start, void *buf,
1188 + }
1189 + }
1190 +
1191 +- i2c_unlock_adapter(adap);
1192 ++ i2c_unlock_bus(adap, I2C_LOCK_SEGMENT);
1193 +
1194 + return ret;
1195 + }
1196 +diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
1197 +index 8f7a3c00b6cf..26e99c03390f 100644
1198 +--- a/drivers/iommu/arm-smmu-v3.c
1199 ++++ b/drivers/iommu/arm-smmu-v3.c
1200 +@@ -1272,6 +1272,7 @@ static irqreturn_t arm_smmu_priq_thread(int irq, void *dev)
1201 +
1202 + /* Sync our overflow flag, as we believe we're up to speed */
1203 + q->cons = Q_OVF(q, q->prod) | Q_WRP(q, q->cons) | Q_IDX(q, q->cons);
1204 ++ writel(q->cons, q->cons_reg);
1205 + return IRQ_HANDLED;
1206 + }
1207 +
1208 +diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
1209 +index 6961fc393f0b..29b7a6755fcd 100644
1210 +--- a/drivers/iommu/io-pgtable-arm-v7s.c
1211 ++++ b/drivers/iommu/io-pgtable-arm-v7s.c
1212 +@@ -192,6 +192,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,
1213 + {
1214 + struct io_pgtable_cfg *cfg = &data->iop.cfg;
1215 + struct device *dev = cfg->iommu_dev;
1216 ++ phys_addr_t phys;
1217 + dma_addr_t dma;
1218 + size_t size = ARM_V7S_TABLE_SIZE(lvl);
1219 + void *table = NULL;
1220 +@@ -200,6 +201,10 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,
1221 + table = (void *)__get_dma_pages(__GFP_ZERO, get_order(size));
1222 + else if (lvl == 2)
1223 + table = kmem_cache_zalloc(data->l2_tables, gfp | GFP_DMA);
1224 ++ phys = virt_to_phys(table);
1225 ++ if (phys != (arm_v7s_iopte)phys)
1226 ++ /* Doesn't fit in PTE */
1227 ++ goto out_free;
1228 + if (table && !(cfg->quirks & IO_PGTABLE_QUIRK_NO_DMA)) {
1229 + dma = dma_map_single(dev, table, size, DMA_TO_DEVICE);
1230 + if (dma_mapping_error(dev, dma))
1231 +@@ -209,7 +214,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,
1232 + * address directly, so if the DMA layer suggests otherwise by
1233 + * translating or truncating them, that bodes very badly...
1234 + */
1235 +- if (dma != virt_to_phys(table))
1236 ++ if (dma != phys)
1237 + goto out_unmap;
1238 + }
1239 + kmemleak_ignore(table);
1240 +diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
1241 +index a31fe18c71d6..2d96c1849759 100644
1242 +--- a/drivers/media/i2c/ov5645.c
1243 ++++ b/drivers/media/i2c/ov5645.c
1244 +@@ -510,8 +510,8 @@ static const struct reg_value ov5645_setting_full[] = {
1245 + };
1246 +
1247 + static const s64 link_freq[] = {
1248 +- 222880000,
1249 +- 334320000
1250 ++ 224000000,
1251 ++ 336000000
1252 + };
1253 +
1254 + static const struct ov5645_mode_info ov5645_mode_info_data[] = {
1255 +@@ -520,7 +520,7 @@ static const struct ov5645_mode_info ov5645_mode_info_data[] = {
1256 + .height = 960,
1257 + .data = ov5645_setting_sxga,
1258 + .data_size = ARRAY_SIZE(ov5645_setting_sxga),
1259 +- .pixel_clock = 111440000,
1260 ++ .pixel_clock = 112000000,
1261 + .link_freq = 0 /* an index in link_freq[] */
1262 + },
1263 + {
1264 +@@ -528,7 +528,7 @@ static const struct ov5645_mode_info ov5645_mode_info_data[] = {
1265 + .height = 1080,
1266 + .data = ov5645_setting_1080p,
1267 + .data_size = ARRAY_SIZE(ov5645_setting_1080p),
1268 +- .pixel_clock = 167160000,
1269 ++ .pixel_clock = 168000000,
1270 + .link_freq = 1 /* an index in link_freq[] */
1271 + },
1272 + {
1273 +@@ -536,7 +536,7 @@ static const struct ov5645_mode_info ov5645_mode_info_data[] = {
1274 + .height = 1944,
1275 + .data = ov5645_setting_full,
1276 + .data_size = ARRAY_SIZE(ov5645_setting_full),
1277 +- .pixel_clock = 167160000,
1278 ++ .pixel_clock = 168000000,
1279 + .link_freq = 1 /* an index in link_freq[] */
1280 + },
1281 + };
1282 +@@ -1157,7 +1157,8 @@ static int ov5645_probe(struct i2c_client *client,
1283 + return ret;
1284 + }
1285 +
1286 +- if (xclk_freq != 23880000) {
1287 ++ /* external clock must be 24MHz, allow 1% tolerance */
1288 ++ if (xclk_freq < 23760000 || xclk_freq > 24240000) {
1289 + dev_err(dev, "external clock frequency %u is not supported\n",
1290 + xclk_freq);
1291 + return -EINVAL;
1292 +diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c
1293 +index 0ea8dd44026c..3a06c000f97b 100644
1294 +--- a/drivers/media/pci/tw686x/tw686x-video.c
1295 ++++ b/drivers/media/pci/tw686x/tw686x-video.c
1296 +@@ -1190,6 +1190,14 @@ int tw686x_video_init(struct tw686x_dev *dev)
1297 + return err;
1298 + }
1299 +
1300 ++ /* Initialize vc->dev and vc->ch for the error path */
1301 ++ for (ch = 0; ch < max_channels(dev); ch++) {
1302 ++ struct tw686x_video_channel *vc = &dev->video_channels[ch];
1303 ++
1304 ++ vc->dev = dev;
1305 ++ vc->ch = ch;
1306 ++ }
1307 ++
1308 + for (ch = 0; ch < max_channels(dev); ch++) {
1309 + struct tw686x_video_channel *vc = &dev->video_channels[ch];
1310 + struct video_device *vdev;
1311 +@@ -1198,9 +1206,6 @@ int tw686x_video_init(struct tw686x_dev *dev)
1312 + spin_lock_init(&vc->qlock);
1313 + INIT_LIST_HEAD(&vc->vidq_queued);
1314 +
1315 +- vc->dev = dev;
1316 +- vc->ch = ch;
1317 +-
1318 + /* default settings */
1319 + err = tw686x_set_standard(vc, V4L2_STD_NTSC);
1320 + if (err)
1321 +diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
1322 +index 2dbf632c10de..43522a09b11d 100644
1323 +--- a/drivers/media/v4l2-core/videobuf2-core.c
1324 ++++ b/drivers/media/v4l2-core/videobuf2-core.c
1325 +@@ -1373,6 +1373,11 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb)
1326 + struct vb2_buffer *vb;
1327 + int ret;
1328 +
1329 ++ if (q->error) {
1330 ++ dprintk(1, "fatal error occurred on queue\n");
1331 ++ return -EIO;
1332 ++ }
1333 ++
1334 + vb = q->bufs[index];
1335 +
1336 + switch (vb->state) {
1337 +diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c
1338 +index 84e313107233..7b9052ea7413 100644
1339 +--- a/drivers/mfd/88pm860x-i2c.c
1340 ++++ b/drivers/mfd/88pm860x-i2c.c
1341 +@@ -146,14 +146,14 @@ int pm860x_page_reg_write(struct i2c_client *i2c, int reg,
1342 + unsigned char zero;
1343 + int ret;
1344 +
1345 +- i2c_lock_adapter(i2c->adapter);
1346 ++ i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
1347 + read_device(i2c, 0xFA, 0, &zero);
1348 + read_device(i2c, 0xFB, 0, &zero);
1349 + read_device(i2c, 0xFF, 0, &zero);
1350 + ret = write_device(i2c, reg, 1, &data);
1351 + read_device(i2c, 0xFE, 0, &zero);
1352 + read_device(i2c, 0xFC, 0, &zero);
1353 +- i2c_unlock_adapter(i2c->adapter);
1354 ++ i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
1355 + return ret;
1356 + }
1357 + EXPORT_SYMBOL(pm860x_page_reg_write);
1358 +@@ -164,14 +164,14 @@ int pm860x_page_bulk_read(struct i2c_client *i2c, int reg,
1359 + unsigned char zero = 0;
1360 + int ret;
1361 +
1362 +- i2c_lock_adapter(i2c->adapter);
1363 ++ i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
1364 + read_device(i2c, 0xfa, 0, &zero);
1365 + read_device(i2c, 0xfb, 0, &zero);
1366 + read_device(i2c, 0xff, 0, &zero);
1367 + ret = read_device(i2c, reg, count, buf);
1368 + read_device(i2c, 0xFE, 0, &zero);
1369 + read_device(i2c, 0xFC, 0, &zero);
1370 +- i2c_unlock_adapter(i2c->adapter);
1371 ++ i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
1372 + return ret;
1373 + }
1374 + EXPORT_SYMBOL(pm860x_page_bulk_read);
1375 +diff --git a/drivers/misc/hmc6352.c b/drivers/misc/hmc6352.c
1376 +index eeb7eef62174..38f90e179927 100644
1377 +--- a/drivers/misc/hmc6352.c
1378 ++++ b/drivers/misc/hmc6352.c
1379 +@@ -27,6 +27,7 @@
1380 + #include <linux/err.h>
1381 + #include <linux/delay.h>
1382 + #include <linux/sysfs.h>
1383 ++#include <linux/nospec.h>
1384 +
1385 + static DEFINE_MUTEX(compass_mutex);
1386 +
1387 +@@ -50,6 +51,7 @@ static int compass_store(struct device *dev, const char *buf, size_t count,
1388 + return ret;
1389 + if (val >= strlen(map))
1390 + return -EINVAL;
1391 ++ val = array_index_nospec(val, strlen(map));
1392 + mutex_lock(&compass_mutex);
1393 + ret = compass_command(c, map[val]);
1394 + mutex_unlock(&compass_mutex);
1395 +diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
1396 +index 0208c4b027c5..fa0236a5e59a 100644
1397 +--- a/drivers/misc/mei/bus-fixup.c
1398 ++++ b/drivers/misc/mei/bus-fixup.c
1399 +@@ -267,7 +267,7 @@ static int mei_nfc_if_version(struct mei_cl *cl,
1400 +
1401 + ret = 0;
1402 + bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length, 0);
1403 +- if (bytes_recv < if_version_length) {
1404 ++ if (bytes_recv < 0 || bytes_recv < if_version_length) {
1405 + dev_err(bus->dev, "Could not read IF version\n");
1406 + ret = -EIO;
1407 + goto err;
1408 +diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
1409 +index 1ac10cb64d6e..37b13bc5c16f 100644
1410 +--- a/drivers/misc/mei/bus.c
1411 ++++ b/drivers/misc/mei/bus.c
1412 +@@ -465,17 +465,15 @@ int mei_cldev_enable(struct mei_cl_device *cldev)
1413 +
1414 + cl = cldev->cl;
1415 +
1416 ++ mutex_lock(&bus->device_lock);
1417 + if (cl->state == MEI_FILE_UNINITIALIZED) {
1418 +- mutex_lock(&bus->device_lock);
1419 + ret = mei_cl_link(cl);
1420 +- mutex_unlock(&bus->device_lock);
1421 + if (ret)
1422 +- return ret;
1423 ++ goto out;
1424 + /* update pointers */
1425 + cl->cldev = cldev;
1426 + }
1427 +
1428 +- mutex_lock(&bus->device_lock);
1429 + if (mei_cl_is_connected(cl)) {
1430 + ret = 0;
1431 + goto out;
1432 +@@ -841,12 +839,13 @@ static void mei_cl_bus_dev_release(struct device *dev)
1433 +
1434 + mei_me_cl_put(cldev->me_cl);
1435 + mei_dev_bus_put(cldev->bus);
1436 ++ mei_cl_unlink(cldev->cl);
1437 + kfree(cldev->cl);
1438 + kfree(cldev);
1439 + }
1440 +
1441 + static const struct device_type mei_cl_device_type = {
1442 +- .release = mei_cl_bus_dev_release,
1443 ++ .release = mei_cl_bus_dev_release,
1444 + };
1445 +
1446 + /**
1447 +diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
1448 +index fe6595fe94f1..995ff1b7e7b5 100644
1449 +--- a/drivers/misc/mei/hbm.c
1450 ++++ b/drivers/misc/mei/hbm.c
1451 +@@ -1140,15 +1140,18 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
1452 +
1453 + props_res = (struct hbm_props_response *)mei_msg;
1454 +
1455 +- if (props_res->status) {
1456 ++ if (props_res->status == MEI_HBMS_CLIENT_NOT_FOUND) {
1457 ++ dev_dbg(dev->dev, "hbm: properties response: %d CLIENT_NOT_FOUND\n",
1458 ++ props_res->me_addr);
1459 ++ } else if (props_res->status) {
1460 + dev_err(dev->dev, "hbm: properties response: wrong status = %d %s\n",
1461 + props_res->status,
1462 + mei_hbm_status_str(props_res->status));
1463 + return -EPROTO;
1464 ++ } else {
1465 ++ mei_hbm_me_cl_add(dev, props_res);
1466 + }
1467 +
1468 +- mei_hbm_me_cl_add(dev, props_res);
1469 +-
1470 + /* request property for the next client */
1471 + if (mei_hbm_prop_req(dev, props_res->me_addr + 1))
1472 + return -EIO;
1473 +diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
1474 +index 3b5e6d11069b..9e03fada16dc 100644
1475 +--- a/drivers/mmc/host/omap_hsmmc.c
1476 ++++ b/drivers/mmc/host/omap_hsmmc.c
1477 +@@ -2194,6 +2194,7 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
1478 + dma_release_channel(host->tx_chan);
1479 + dma_release_channel(host->rx_chan);
1480 +
1481 ++ dev_pm_clear_wake_irq(host->dev);
1482 + pm_runtime_dont_use_autosuspend(host->dev);
1483 + pm_runtime_put_sync(host->dev);
1484 + pm_runtime_disable(host->dev);
1485 +diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
1486 +index 4ffa6b173a21..8332f56e6c0d 100644
1487 +--- a/drivers/mmc/host/sdhci-of-esdhc.c
1488 ++++ b/drivers/mmc/host/sdhci-of-esdhc.c
1489 +@@ -22,6 +22,7 @@
1490 + #include <linux/sys_soc.h>
1491 + #include <linux/clk.h>
1492 + #include <linux/ktime.h>
1493 ++#include <linux/dma-mapping.h>
1494 + #include <linux/mmc/host.h>
1495 + #include "sdhci-pltfm.h"
1496 + #include "sdhci-esdhc.h"
1497 +@@ -427,6 +428,11 @@ static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask)
1498 + static int esdhc_of_enable_dma(struct sdhci_host *host)
1499 + {
1500 + u32 value;
1501 ++ struct device *dev = mmc_dev(host->mmc);
1502 ++
1503 ++ if (of_device_is_compatible(dev->of_node, "fsl,ls1043a-esdhc") ||
1504 ++ of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc"))
1505 ++ dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
1506 +
1507 + value = sdhci_readl(host, ESDHC_DMA_SYSCTL);
1508 + value |= ESDHC_DMA_SNOOP;
1509 +diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
1510 +index 0cd6fa80db66..ce3f344d2b66 100644
1511 +--- a/drivers/mmc/host/sdhci-tegra.c
1512 ++++ b/drivers/mmc/host/sdhci-tegra.c
1513 +@@ -334,7 +334,8 @@ static const struct sdhci_pltfm_data sdhci_tegra30_pdata = {
1514 + SDHCI_QUIRK_NO_HISPD_BIT |
1515 + SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
1516 + SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
1517 +- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
1518 ++ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
1519 ++ SDHCI_QUIRK2_BROKEN_HS200,
1520 + .ops = &tegra_sdhci_ops,
1521 + };
1522 +
1523 +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
1524 +index d35deb79965d..f063fe569339 100644
1525 +--- a/drivers/mmc/host/sdhci.c
1526 ++++ b/drivers/mmc/host/sdhci.c
1527 +@@ -3631,14 +3631,21 @@ int sdhci_setup_host(struct sdhci_host *host)
1528 + mmc_gpio_get_cd(host->mmc) < 0)
1529 + mmc->caps |= MMC_CAP_NEEDS_POLL;
1530 +
1531 +- /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */
1532 + if (!IS_ERR(mmc->supply.vqmmc)) {
1533 + ret = regulator_enable(mmc->supply.vqmmc);
1534 ++
1535 ++ /* If vqmmc provides no 1.8V signalling, then there's no UHS */
1536 + if (!regulator_is_supported_voltage(mmc->supply.vqmmc, 1700000,
1537 + 1950000))
1538 + host->caps1 &= ~(SDHCI_SUPPORT_SDR104 |
1539 + SDHCI_SUPPORT_SDR50 |
1540 + SDHCI_SUPPORT_DDR50);
1541 ++
1542 ++ /* In eMMC case vqmmc might be a fixed 1.8V regulator */
1543 ++ if (!regulator_is_supported_voltage(mmc->supply.vqmmc, 2700000,
1544 ++ 3600000))
1545 ++ host->flags &= ~SDHCI_SIGNALING_330;
1546 ++
1547 + if (ret) {
1548 + pr_warn("%s: Failed to enable vqmmc regulator: %d\n",
1549 + mmc_hostname(mmc), ret);
1550 +diff --git a/drivers/mtd/maps/solutionengine.c b/drivers/mtd/maps/solutionengine.c
1551 +index bb580bc16445..c07f21b20463 100644
1552 +--- a/drivers/mtd/maps/solutionengine.c
1553 ++++ b/drivers/mtd/maps/solutionengine.c
1554 +@@ -59,9 +59,9 @@ static int __init init_soleng_maps(void)
1555 + return -ENXIO;
1556 + }
1557 + }
1558 +- printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
1559 +- soleng_flash_map.phys & 0x1fffffff,
1560 +- soleng_eprom_map.phys & 0x1fffffff);
1561 ++ printk(KERN_NOTICE "Solution Engine: Flash at 0x%pap, EPROM at 0x%pap\n",
1562 ++ &soleng_flash_map.phys,
1563 ++ &soleng_eprom_map.phys);
1564 + flash_mtd->owner = THIS_MODULE;
1565 +
1566 + eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map);
1567 +diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
1568 +index b25f444c5914..fa4d12217652 100644
1569 +--- a/drivers/mtd/mtdchar.c
1570 ++++ b/drivers/mtd/mtdchar.c
1571 +@@ -160,8 +160,12 @@ static ssize_t mtdchar_read(struct file *file, char __user *buf, size_t count,
1572 +
1573 + pr_debug("MTD_read\n");
1574 +
1575 +- if (*ppos + count > mtd->size)
1576 +- count = mtd->size - *ppos;
1577 ++ if (*ppos + count > mtd->size) {
1578 ++ if (*ppos < mtd->size)
1579 ++ count = mtd->size - *ppos;
1580 ++ else
1581 ++ count = 0;
1582 ++ }
1583 +
1584 + if (!count)
1585 + return 0;
1586 +@@ -246,7 +250,7 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c
1587 +
1588 + pr_debug("MTD_write\n");
1589 +
1590 +- if (*ppos == mtd->size)
1591 ++ if (*ppos >= mtd->size)
1592 + return -ENOSPC;
1593 +
1594 + if (*ppos + count > mtd->size)
1595 +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
1596 +index 45d92304068e..a5eaf174d914 100644
1597 +--- a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
1598 ++++ b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
1599 +@@ -289,7 +289,7 @@ static int xgbe_alloc_pages(struct xgbe_prv_data *pdata,
1600 + struct page *pages = NULL;
1601 + dma_addr_t pages_dma;
1602 + gfp_t gfp;
1603 +- int order, ret;
1604 ++ int order;
1605 +
1606 + again:
1607 + order = alloc_order;
1608 +@@ -316,10 +316,9 @@ again:
1609 + /* Map the pages */
1610 + pages_dma = dma_map_page(pdata->dev, pages, 0,
1611 + PAGE_SIZE << order, DMA_FROM_DEVICE);
1612 +- ret = dma_mapping_error(pdata->dev, pages_dma);
1613 +- if (ret) {
1614 ++ if (dma_mapping_error(pdata->dev, pages_dma)) {
1615 + put_page(pages);
1616 +- return ret;
1617 ++ return -ENOMEM;
1618 + }
1619 +
1620 + pa->pages = pages;
1621 +diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
1622 +index e8b290473ee2..2e089b5ff8f3 100644
1623 +--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
1624 ++++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
1625 +@@ -493,6 +493,9 @@ static void cn23xx_pf_setup_global_output_regs(struct octeon_device *oct)
1626 + for (q_no = srn; q_no < ern; q_no++) {
1627 + reg_val = octeon_read_csr(oct, CN23XX_SLI_OQ_PKT_CONTROL(q_no));
1628 +
1629 ++ /* clear IPTR */
1630 ++ reg_val &= ~CN23XX_PKT_OUTPUT_CTL_IPTR;
1631 ++
1632 + /* set DPTR */
1633 + reg_val |= CN23XX_PKT_OUTPUT_CTL_DPTR;
1634 +
1635 +diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c
1636 +index 9338a0008378..1f8b7f651254 100644
1637 +--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c
1638 ++++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c
1639 +@@ -165,6 +165,9 @@ static void cn23xx_vf_setup_global_output_regs(struct octeon_device *oct)
1640 + reg_val =
1641 + octeon_read_csr(oct, CN23XX_VF_SLI_OQ_PKT_CONTROL(q_no));
1642 +
1643 ++ /* clear IPTR */
1644 ++ reg_val &= ~CN23XX_PKT_OUTPUT_CTL_IPTR;
1645 ++
1646 + /* set DPTR */
1647 + reg_val |= CN23XX_PKT_OUTPUT_CTL_DPTR;
1648 +
1649 +diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
1650 +index 02dd5246dfae..1589a568bfe0 100644
1651 +--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
1652 ++++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
1653 +@@ -4500,7 +4500,7 @@ int be_cmd_get_profile_config(struct be_adapter *adapter,
1654 + port_res->max_vfs += le16_to_cpu(pcie->num_vfs);
1655 + }
1656 + }
1657 +- return status;
1658 ++ goto err;
1659 + }
1660 +
1661 + pcie = be_get_pcie_desc(resp->func_param, desc_count,
1662 +diff --git a/drivers/net/ethernet/intel/e1000e/defines.h b/drivers/net/ethernet/intel/e1000e/defines.h
1663 +index afb7ebe20b24..824fd44e25f0 100644
1664 +--- a/drivers/net/ethernet/intel/e1000e/defines.h
1665 ++++ b/drivers/net/ethernet/intel/e1000e/defines.h
1666 +@@ -400,6 +400,10 @@
1667 + #define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */
1668 + #define E1000_ICR_RXO 0x00000040 /* Receiver Overrun */
1669 + #define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */
1670 ++#define E1000_ICR_MDAC 0x00000200 /* MDIO Access Complete */
1671 ++#define E1000_ICR_SRPD 0x00010000 /* Small Receive Packet Detected */
1672 ++#define E1000_ICR_ACK 0x00020000 /* Receive ACK Frame Detected */
1673 ++#define E1000_ICR_MNG 0x00040000 /* Manageability Event Detected */
1674 + #define E1000_ICR_ECCER 0x00400000 /* Uncorrectable ECC Error */
1675 + /* If this bit asserted, the driver should claim the interrupt */
1676 + #define E1000_ICR_INT_ASSERTED 0x80000000
1677 +@@ -407,7 +411,7 @@
1678 + #define E1000_ICR_RXQ1 0x00200000 /* Rx Queue 1 Interrupt */
1679 + #define E1000_ICR_TXQ0 0x00400000 /* Tx Queue 0 Interrupt */
1680 + #define E1000_ICR_TXQ1 0x00800000 /* Tx Queue 1 Interrupt */
1681 +-#define E1000_ICR_OTHER 0x01000000 /* Other Interrupts */
1682 ++#define E1000_ICR_OTHER 0x01000000 /* Other Interrupt */
1683 +
1684 + /* PBA ECC Register */
1685 + #define E1000_PBA_ECC_COUNTER_MASK 0xFFF00000 /* ECC counter mask */
1686 +@@ -431,12 +435,27 @@
1687 + E1000_IMS_RXSEQ | \
1688 + E1000_IMS_LSC)
1689 +
1690 ++/* These are all of the events related to the OTHER interrupt.
1691 ++ */
1692 ++#define IMS_OTHER_MASK ( \
1693 ++ E1000_IMS_LSC | \
1694 ++ E1000_IMS_RXO | \
1695 ++ E1000_IMS_MDAC | \
1696 ++ E1000_IMS_SRPD | \
1697 ++ E1000_IMS_ACK | \
1698 ++ E1000_IMS_MNG)
1699 ++
1700 + /* Interrupt Mask Set */
1701 + #define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */
1702 + #define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */
1703 + #define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */
1704 + #define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */
1705 ++#define E1000_IMS_RXO E1000_ICR_RXO /* Receiver Overrun */
1706 + #define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */
1707 ++#define E1000_IMS_MDAC E1000_ICR_MDAC /* MDIO Access Complete */
1708 ++#define E1000_IMS_SRPD E1000_ICR_SRPD /* Small Receive Packet */
1709 ++#define E1000_IMS_ACK E1000_ICR_ACK /* Receive ACK Frame Detected */
1710 ++#define E1000_IMS_MNG E1000_ICR_MNG /* Manageability Event */
1711 + #define E1000_IMS_ECCER E1000_ICR_ECCER /* Uncorrectable ECC Error */
1712 + #define E1000_IMS_RXQ0 E1000_ICR_RXQ0 /* Rx Queue 0 Interrupt */
1713 + #define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */
1714 +diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
1715 +index ff308b05d68c..00eedf202e62 100644
1716 +--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
1717 ++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
1718 +@@ -1367,9 +1367,6 @@ out:
1719 + * Checks to see of the link status of the hardware has changed. If a
1720 + * change in link status has been detected, then we read the PHY registers
1721 + * to get the current speed/duplex if link exists.
1722 +- *
1723 +- * Returns a negative error code (-E1000_ERR_*) or 0 (link down) or 1 (link
1724 +- * up).
1725 + **/
1726 + static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1727 + {
1728 +@@ -1385,7 +1382,8 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1729 + * Change or Rx Sequence Error interrupt.
1730 + */
1731 + if (!mac->get_link_status)
1732 +- return 1;
1733 ++ return 0;
1734 ++ mac->get_link_status = false;
1735 +
1736 + /* First we want to see if the MII Status Register reports
1737 + * link. If so, then we want to get the current speed/duplex
1738 +@@ -1393,12 +1391,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1739 + */
1740 + ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
1741 + if (ret_val)
1742 +- return ret_val;
1743 ++ goto out;
1744 +
1745 + if (hw->mac.type == e1000_pchlan) {
1746 + ret_val = e1000_k1_gig_workaround_hv(hw, link);
1747 + if (ret_val)
1748 +- return ret_val;
1749 ++ goto out;
1750 + }
1751 +
1752 + /* When connected at 10Mbps half-duplex, some parts are excessively
1753 +@@ -1431,7 +1429,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1754 +
1755 + ret_val = hw->phy.ops.acquire(hw);
1756 + if (ret_val)
1757 +- return ret_val;
1758 ++ goto out;
1759 +
1760 + if (hw->mac.type == e1000_pch2lan)
1761 + emi_addr = I82579_RX_CONFIG;
1762 +@@ -1453,7 +1451,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1763 + hw->phy.ops.release(hw);
1764 +
1765 + if (ret_val)
1766 +- return ret_val;
1767 ++ goto out;
1768 +
1769 + if (hw->mac.type >= e1000_pch_spt) {
1770 + u16 data;
1771 +@@ -1462,14 +1460,14 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1772 + if (speed == SPEED_1000) {
1773 + ret_val = hw->phy.ops.acquire(hw);
1774 + if (ret_val)
1775 +- return ret_val;
1776 ++ goto out;
1777 +
1778 + ret_val = e1e_rphy_locked(hw,
1779 + PHY_REG(776, 20),
1780 + &data);
1781 + if (ret_val) {
1782 + hw->phy.ops.release(hw);
1783 +- return ret_val;
1784 ++ goto out;
1785 + }
1786 +
1787 + ptr_gap = (data & (0x3FF << 2)) >> 2;
1788 +@@ -1483,18 +1481,18 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1789 + }
1790 + hw->phy.ops.release(hw);
1791 + if (ret_val)
1792 +- return ret_val;
1793 ++ goto out;
1794 + } else {
1795 + ret_val = hw->phy.ops.acquire(hw);
1796 + if (ret_val)
1797 +- return ret_val;
1798 ++ goto out;
1799 +
1800 + ret_val = e1e_wphy_locked(hw,
1801 + PHY_REG(776, 20),
1802 + 0xC023);
1803 + hw->phy.ops.release(hw);
1804 + if (ret_val)
1805 +- return ret_val;
1806 ++ goto out;
1807 +
1808 + }
1809 + }
1810 +@@ -1521,7 +1519,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1811 + (hw->adapter->pdev->device == E1000_DEV_ID_PCH_I218_V3)) {
1812 + ret_val = e1000_k1_workaround_lpt_lp(hw, link);
1813 + if (ret_val)
1814 +- return ret_val;
1815 ++ goto out;
1816 + }
1817 + if (hw->mac.type >= e1000_pch_lpt) {
1818 + /* Set platform power management values for
1819 +@@ -1529,7 +1527,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1820 + */
1821 + ret_val = e1000_platform_pm_pch_lpt(hw, link);
1822 + if (ret_val)
1823 +- return ret_val;
1824 ++ goto out;
1825 + }
1826 +
1827 + /* Clear link partner's EEE ability */
1828 +@@ -1552,9 +1550,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1829 + }
1830 +
1831 + if (!link)
1832 +- return 0; /* No link detected */
1833 +-
1834 +- mac->get_link_status = false;
1835 ++ goto out;
1836 +
1837 + switch (hw->mac.type) {
1838 + case e1000_pch2lan:
1839 +@@ -1616,12 +1612,14 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1840 + * different link partner.
1841 + */
1842 + ret_val = e1000e_config_fc_after_link_up(hw);
1843 +- if (ret_val) {
1844 ++ if (ret_val)
1845 + e_dbg("Error configuring flow control\n");
1846 +- return ret_val;
1847 +- }
1848 +
1849 +- return 1;
1850 ++ return ret_val;
1851 ++
1852 ++out:
1853 ++ mac->get_link_status = true;
1854 ++ return ret_val;
1855 + }
1856 +
1857 + static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
1858 +diff --git a/drivers/net/ethernet/intel/e1000e/mac.c b/drivers/net/ethernet/intel/e1000e/mac.c
1859 +index db735644b312..48cc945fc8b0 100644
1860 +--- a/drivers/net/ethernet/intel/e1000e/mac.c
1861 ++++ b/drivers/net/ethernet/intel/e1000e/mac.c
1862 +@@ -410,9 +410,6 @@ void e1000e_clear_hw_cntrs_base(struct e1000_hw *hw)
1863 + * Checks to see of the link status of the hardware has changed. If a
1864 + * change in link status has been detected, then we read the PHY registers
1865 + * to get the current speed/duplex if link exists.
1866 +- *
1867 +- * Returns a negative error code (-E1000_ERR_*) or 0 (link down) or 1 (link
1868 +- * up).
1869 + **/
1870 + s32 e1000e_check_for_copper_link(struct e1000_hw *hw)
1871 + {
1872 +@@ -426,20 +423,16 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw)
1873 + * Change or Rx Sequence Error interrupt.
1874 + */
1875 + if (!mac->get_link_status)
1876 +- return 1;
1877 ++ return 0;
1878 ++ mac->get_link_status = false;
1879 +
1880 + /* First we want to see if the MII Status Register reports
1881 + * link. If so, then we want to get the current speed/duplex
1882 + * of the PHY.
1883 + */
1884 + ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
1885 +- if (ret_val)
1886 +- return ret_val;
1887 +-
1888 +- if (!link)
1889 +- return 0; /* No link detected */
1890 +-
1891 +- mac->get_link_status = false;
1892 ++ if (ret_val || !link)
1893 ++ goto out;
1894 +
1895 + /* Check if there was DownShift, must be checked
1896 + * immediately after link-up
1897 +@@ -464,12 +457,14 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw)
1898 + * different link partner.
1899 + */
1900 + ret_val = e1000e_config_fc_after_link_up(hw);
1901 +- if (ret_val) {
1902 ++ if (ret_val)
1903 + e_dbg("Error configuring flow control\n");
1904 +- return ret_val;
1905 +- }
1906 +
1907 +- return 1;
1908 ++ return ret_val;
1909 ++
1910 ++out:
1911 ++ mac->get_link_status = true;
1912 ++ return ret_val;
1913 + }
1914 +
1915 + /**
1916 +diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
1917 +index 6265ce8915b6..a25dc581a903 100644
1918 +--- a/drivers/net/ethernet/intel/e1000e/netdev.c
1919 ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c
1920 +@@ -1910,30 +1910,20 @@ static irqreturn_t e1000_msix_other(int __always_unused irq, void *data)
1921 + struct net_device *netdev = data;
1922 + struct e1000_adapter *adapter = netdev_priv(netdev);
1923 + struct e1000_hw *hw = &adapter->hw;
1924 +- u32 icr;
1925 +- bool enable = true;
1926 +-
1927 +- icr = er32(ICR);
1928 +- if (icr & E1000_ICR_RXO) {
1929 +- ew32(ICR, E1000_ICR_RXO);
1930 +- enable = false;
1931 +- /* napi poll will re-enable Other, make sure it runs */
1932 +- if (napi_schedule_prep(&adapter->napi)) {
1933 +- adapter->total_rx_bytes = 0;
1934 +- adapter->total_rx_packets = 0;
1935 +- __napi_schedule(&adapter->napi);
1936 +- }
1937 +- }
1938 ++ u32 icr = er32(ICR);
1939 ++
1940 ++ if (icr & adapter->eiac_mask)
1941 ++ ew32(ICS, (icr & adapter->eiac_mask));
1942 ++
1943 + if (icr & E1000_ICR_LSC) {
1944 +- ew32(ICR, E1000_ICR_LSC);
1945 + hw->mac.get_link_status = true;
1946 + /* guard against interrupt when we're going down */
1947 + if (!test_bit(__E1000_DOWN, &adapter->state))
1948 + mod_timer(&adapter->watchdog_timer, jiffies + 1);
1949 + }
1950 +
1951 +- if (enable && !test_bit(__E1000_DOWN, &adapter->state))
1952 +- ew32(IMS, E1000_IMS_OTHER);
1953 ++ if (!test_bit(__E1000_DOWN, &adapter->state))
1954 ++ ew32(IMS, E1000_IMS_OTHER | IMS_OTHER_MASK);
1955 +
1956 + return IRQ_HANDLED;
1957 + }
1958 +@@ -2036,7 +2026,6 @@ static void e1000_configure_msix(struct e1000_adapter *adapter)
1959 + hw->hw_addr + E1000_EITR_82574(vector));
1960 + else
1961 + writel(1, hw->hw_addr + E1000_EITR_82574(vector));
1962 +- adapter->eiac_mask |= E1000_IMS_OTHER;
1963 +
1964 + /* Cause Tx interrupts on every write back */
1965 + ivar |= BIT(31);
1966 +@@ -2261,7 +2250,8 @@ static void e1000_irq_enable(struct e1000_adapter *adapter)
1967 +
1968 + if (adapter->msix_entries) {
1969 + ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574);
1970 +- ew32(IMS, adapter->eiac_mask | E1000_IMS_LSC);
1971 ++ ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER |
1972 ++ IMS_OTHER_MASK);
1973 + } else if (hw->mac.type >= e1000_pch_lpt) {
1974 + ew32(IMS, IMS_ENABLE_MASK | E1000_IMS_ECCER);
1975 + } else {
1976 +@@ -2703,8 +2693,7 @@ static int e1000e_poll(struct napi_struct *napi, int weight)
1977 + napi_complete_done(napi, work_done);
1978 + if (!test_bit(__E1000_DOWN, &adapter->state)) {
1979 + if (adapter->msix_entries)
1980 +- ew32(IMS, adapter->rx_ring->ims_val |
1981 +- E1000_IMS_OTHER);
1982 ++ ew32(IMS, adapter->rx_ring->ims_val);
1983 + else
1984 + e1000_irq_enable(adapter);
1985 + }
1986 +@@ -5100,7 +5089,7 @@ static bool e1000e_has_link(struct e1000_adapter *adapter)
1987 + case e1000_media_type_copper:
1988 + if (hw->mac.get_link_status) {
1989 + ret_val = hw->mac.ops.check_for_link(hw);
1990 +- link_active = ret_val > 0;
1991 ++ link_active = !hw->mac.get_link_status;
1992 + } else {
1993 + link_active = true;
1994 + }
1995 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
1996 +index cf94fdf25155..c7654209668b 100644
1997 +--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
1998 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
1999 +@@ -449,6 +449,7 @@ const char *mlx5_command_str(int command)
2000 + MLX5_COMMAND_STR_CASE(SET_HCA_CAP);
2001 + MLX5_COMMAND_STR_CASE(QUERY_ISSI);
2002 + MLX5_COMMAND_STR_CASE(SET_ISSI);
2003 ++ MLX5_COMMAND_STR_CASE(SET_DRIVER_VERSION);
2004 + MLX5_COMMAND_STR_CASE(CREATE_MKEY);
2005 + MLX5_COMMAND_STR_CASE(QUERY_MKEY);
2006 + MLX5_COMMAND_STR_CASE(DESTROY_MKEY);
2007 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
2008 +index 17b723218b0c..9f9c9ff10735 100644
2009 +--- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
2010 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
2011 +@@ -132,11 +132,11 @@ void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv)
2012 + delayed_event_start(priv);
2013 +
2014 + dev_ctx->context = intf->add(dev);
2015 +- set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state);
2016 +- if (intf->attach)
2017 +- set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state);
2018 +-
2019 + if (dev_ctx->context) {
2020 ++ set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state);
2021 ++ if (intf->attach)
2022 ++ set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state);
2023 ++
2024 + spin_lock_irq(&priv->ctx_lock);
2025 + list_add_tail(&dev_ctx->list, &priv->ctx_list);
2026 +
2027 +@@ -211,12 +211,17 @@ static void mlx5_attach_interface(struct mlx5_interface *intf, struct mlx5_priv
2028 + if (intf->attach) {
2029 + if (test_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state))
2030 + goto out;
2031 +- intf->attach(dev, dev_ctx->context);
2032 ++ if (intf->attach(dev, dev_ctx->context))
2033 ++ goto out;
2034 ++
2035 + set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state);
2036 + } else {
2037 + if (test_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state))
2038 + goto out;
2039 + dev_ctx->context = intf->add(dev);
2040 ++ if (!dev_ctx->context)
2041 ++ goto out;
2042 ++
2043 + set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state);
2044 + }
2045 +
2046 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
2047 +index c699055c0ffd..4b52b722135d 100644
2048 +--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
2049 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
2050 +@@ -557,6 +557,7 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw, int nvports)
2051 + if (err)
2052 + goto miss_rule_err;
2053 +
2054 ++ kvfree(flow_group_in);
2055 + return 0;
2056 +
2057 + miss_rule_err:
2058 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
2059 +index db86e1506c8b..61f284966a8c 100644
2060 +--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
2061 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
2062 +@@ -333,9 +333,17 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev)
2063 + add_timer(&health->timer);
2064 + }
2065 +
2066 +-void mlx5_stop_health_poll(struct mlx5_core_dev *dev)
2067 ++void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health)
2068 + {
2069 + struct mlx5_core_health *health = &dev->priv.health;
2070 ++ unsigned long flags;
2071 ++
2072 ++ if (disable_health) {
2073 ++ spin_lock_irqsave(&health->wq_lock, flags);
2074 ++ set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags);
2075 ++ set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags);
2076 ++ spin_unlock_irqrestore(&health->wq_lock, flags);
2077 ++ }
2078 +
2079 + del_timer_sync(&health->timer);
2080 + }
2081 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
2082 +index 4ddd632d10f9..e99f1382a4f0 100644
2083 +--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
2084 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
2085 +@@ -857,8 +857,10 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
2086 + priv->numa_node = dev_to_node(&dev->pdev->dev);
2087 +
2088 + priv->dbg_root = debugfs_create_dir(dev_name(&pdev->dev), mlx5_debugfs_root);
2089 +- if (!priv->dbg_root)
2090 ++ if (!priv->dbg_root) {
2091 ++ dev_err(&pdev->dev, "Cannot create debugfs dir, aborting\n");
2092 + return -ENOMEM;
2093 ++ }
2094 +
2095 + err = mlx5_pci_enable_device(dev);
2096 + if (err) {
2097 +@@ -907,7 +909,7 @@ static void mlx5_pci_close(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
2098 + pci_clear_master(dev->pdev);
2099 + release_bar(dev->pdev);
2100 + mlx5_pci_disable_device(dev);
2101 +- debugfs_remove(priv->dbg_root);
2102 ++ debugfs_remove_recursive(priv->dbg_root);
2103 + }
2104 +
2105 + static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
2106 +@@ -1227,7 +1229,7 @@ err_cleanup_once:
2107 + mlx5_cleanup_once(dev);
2108 +
2109 + err_stop_poll:
2110 +- mlx5_stop_health_poll(dev);
2111 ++ mlx5_stop_health_poll(dev, boot);
2112 + if (mlx5_cmd_teardown_hca(dev)) {
2113 + dev_err(&dev->pdev->dev, "tear_down_hca failed, skip cleanup\n");
2114 + goto out_err;
2115 +@@ -1286,7 +1288,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
2116 + mlx5_free_irq_vectors(dev);
2117 + if (cleanup)
2118 + mlx5_cleanup_once(dev);
2119 +- mlx5_stop_health_poll(dev);
2120 ++ mlx5_stop_health_poll(dev, cleanup);
2121 + err = mlx5_cmd_teardown_hca(dev);
2122 + if (err) {
2123 + dev_err(&dev->pdev->dev, "tear_down_hca failed, skip cleanup\n");
2124 +@@ -1548,7 +1550,7 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev)
2125 + * with the HCA, so the health polll is no longer needed.
2126 + */
2127 + mlx5_drain_health_wq(dev);
2128 +- mlx5_stop_health_poll(dev);
2129 ++ mlx5_stop_health_poll(dev, false);
2130 +
2131 + ret = mlx5_cmd_force_teardown_hca(dev);
2132 + if (ret) {
2133 +diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
2134 +index b482a8fb0e92..56751990bcee 100644
2135 +--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
2136 ++++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
2137 +@@ -1087,7 +1087,7 @@ static bool nfp_net_xdp_complete(struct nfp_net_tx_ring *tx_ring)
2138 + * @dp: NFP Net data path struct
2139 + * @tx_ring: TX ring structure
2140 + *
2141 +- * Assumes that the device is stopped
2142 ++ * Assumes that the device is stopped, must be idempotent.
2143 + */
2144 + static void
2145 + nfp_net_tx_ring_reset(struct nfp_net_dp *dp, struct nfp_net_tx_ring *tx_ring)
2146 +@@ -1289,13 +1289,18 @@ static void nfp_net_rx_give_one(const struct nfp_net_dp *dp,
2147 + * nfp_net_rx_ring_reset() - Reflect in SW state of freelist after disable
2148 + * @rx_ring: RX ring structure
2149 + *
2150 +- * Warning: Do *not* call if ring buffers were never put on the FW freelist
2151 +- * (i.e. device was not enabled)!
2152 ++ * Assumes that the device is stopped, must be idempotent.
2153 + */
2154 + static void nfp_net_rx_ring_reset(struct nfp_net_rx_ring *rx_ring)
2155 + {
2156 + unsigned int wr_idx, last_idx;
2157 +
2158 ++ /* wr_p == rd_p means ring was never fed FL bufs. RX rings are always
2159 ++ * kept at cnt - 1 FL bufs.
2160 ++ */
2161 ++ if (rx_ring->wr_p == 0 && rx_ring->rd_p == 0)
2162 ++ return;
2163 ++
2164 + /* Move the empty entry to the end of the list */
2165 + wr_idx = D_IDX(rx_ring, rx_ring->wr_p);
2166 + last_idx = rx_ring->cnt - 1;
2167 +@@ -2505,6 +2510,8 @@ static void nfp_net_vec_clear_ring_data(struct nfp_net *nn, unsigned int idx)
2168 + /**
2169 + * nfp_net_clear_config_and_disable() - Clear control BAR and disable NFP
2170 + * @nn: NFP Net device to reconfigure
2171 ++ *
2172 ++ * Warning: must be fully idempotent.
2173 + */
2174 + static void nfp_net_clear_config_and_disable(struct nfp_net *nn)
2175 + {
2176 +diff --git a/drivers/net/ethernet/qualcomm/qca_7k.c b/drivers/net/ethernet/qualcomm/qca_7k.c
2177 +index ffe7a16bdfc8..6c8543fb90c0 100644
2178 +--- a/drivers/net/ethernet/qualcomm/qca_7k.c
2179 ++++ b/drivers/net/ethernet/qualcomm/qca_7k.c
2180 +@@ -45,34 +45,33 @@ qcaspi_read_register(struct qcaspi *qca, u16 reg, u16 *result)
2181 + {
2182 + __be16 rx_data;
2183 + __be16 tx_data;
2184 +- struct spi_transfer *transfer;
2185 +- struct spi_message *msg;
2186 ++ struct spi_transfer transfer[2];
2187 ++ struct spi_message msg;
2188 + int ret;
2189 +
2190 ++ memset(transfer, 0, sizeof(transfer));
2191 ++
2192 ++ spi_message_init(&msg);
2193 ++
2194 + tx_data = cpu_to_be16(QCA7K_SPI_READ | QCA7K_SPI_INTERNAL | reg);
2195 ++ *result = 0;
2196 ++
2197 ++ transfer[0].tx_buf = &tx_data;
2198 ++ transfer[0].len = QCASPI_CMD_LEN;
2199 ++ transfer[1].rx_buf = &rx_data;
2200 ++ transfer[1].len = QCASPI_CMD_LEN;
2201 ++
2202 ++ spi_message_add_tail(&transfer[0], &msg);
2203 +
2204 + if (qca->legacy_mode) {
2205 +- msg = &qca->spi_msg1;
2206 +- transfer = &qca->spi_xfer1;
2207 +- transfer->tx_buf = &tx_data;
2208 +- transfer->rx_buf = NULL;
2209 +- transfer->len = QCASPI_CMD_LEN;
2210 +- spi_sync(qca->spi_dev, msg);
2211 +- } else {
2212 +- msg = &qca->spi_msg2;
2213 +- transfer = &qca->spi_xfer2[0];
2214 +- transfer->tx_buf = &tx_data;
2215 +- transfer->rx_buf = NULL;
2216 +- transfer->len = QCASPI_CMD_LEN;
2217 +- transfer = &qca->spi_xfer2[1];
2218 ++ spi_sync(qca->spi_dev, &msg);
2219 ++ spi_message_init(&msg);
2220 + }
2221 +- transfer->tx_buf = NULL;
2222 +- transfer->rx_buf = &rx_data;
2223 +- transfer->len = QCASPI_CMD_LEN;
2224 +- ret = spi_sync(qca->spi_dev, msg);
2225 ++ spi_message_add_tail(&transfer[1], &msg);
2226 ++ ret = spi_sync(qca->spi_dev, &msg);
2227 +
2228 + if (!ret)
2229 +- ret = msg->status;
2230 ++ ret = msg.status;
2231 +
2232 + if (ret)
2233 + qcaspi_spi_error(qca);
2234 +@@ -86,35 +85,32 @@ int
2235 + qcaspi_write_register(struct qcaspi *qca, u16 reg, u16 value)
2236 + {
2237 + __be16 tx_data[2];
2238 +- struct spi_transfer *transfer;
2239 +- struct spi_message *msg;
2240 ++ struct spi_transfer transfer[2];
2241 ++ struct spi_message msg;
2242 + int ret;
2243 +
2244 ++ memset(&transfer, 0, sizeof(transfer));
2245 ++
2246 ++ spi_message_init(&msg);
2247 ++
2248 + tx_data[0] = cpu_to_be16(QCA7K_SPI_WRITE | QCA7K_SPI_INTERNAL | reg);
2249 + tx_data[1] = cpu_to_be16(value);
2250 +
2251 ++ transfer[0].tx_buf = &tx_data[0];
2252 ++ transfer[0].len = QCASPI_CMD_LEN;
2253 ++ transfer[1].tx_buf = &tx_data[1];
2254 ++ transfer[1].len = QCASPI_CMD_LEN;
2255 ++
2256 ++ spi_message_add_tail(&transfer[0], &msg);
2257 + if (qca->legacy_mode) {
2258 +- msg = &qca->spi_msg1;
2259 +- transfer = &qca->spi_xfer1;
2260 +- transfer->tx_buf = &tx_data[0];
2261 +- transfer->rx_buf = NULL;
2262 +- transfer->len = QCASPI_CMD_LEN;
2263 +- spi_sync(qca->spi_dev, msg);
2264 +- } else {
2265 +- msg = &qca->spi_msg2;
2266 +- transfer = &qca->spi_xfer2[0];
2267 +- transfer->tx_buf = &tx_data[0];
2268 +- transfer->rx_buf = NULL;
2269 +- transfer->len = QCASPI_CMD_LEN;
2270 +- transfer = &qca->spi_xfer2[1];
2271 ++ spi_sync(qca->spi_dev, &msg);
2272 ++ spi_message_init(&msg);
2273 + }
2274 +- transfer->tx_buf = &tx_data[1];
2275 +- transfer->rx_buf = NULL;
2276 +- transfer->len = QCASPI_CMD_LEN;
2277 +- ret = spi_sync(qca->spi_dev, msg);
2278 ++ spi_message_add_tail(&transfer[1], &msg);
2279 ++ ret = spi_sync(qca->spi_dev, &msg);
2280 +
2281 + if (!ret)
2282 +- ret = msg->status;
2283 ++ ret = msg.status;
2284 +
2285 + if (ret)
2286 + qcaspi_spi_error(qca);
2287 +diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
2288 +index b1f5f0b8e546..275fc6f154a7 100644
2289 +--- a/drivers/net/ethernet/qualcomm/qca_spi.c
2290 ++++ b/drivers/net/ethernet/qualcomm/qca_spi.c
2291 +@@ -99,22 +99,24 @@ static u32
2292 + qcaspi_write_burst(struct qcaspi *qca, u8 *src, u32 len)
2293 + {
2294 + __be16 cmd;
2295 +- struct spi_message *msg = &qca->spi_msg2;
2296 +- struct spi_transfer *transfer = &qca->spi_xfer2[0];
2297 ++ struct spi_message msg;
2298 ++ struct spi_transfer transfer[2];
2299 + int ret;
2300 +
2301 ++ memset(&transfer, 0, sizeof(transfer));
2302 ++ spi_message_init(&msg);
2303 ++
2304 + cmd = cpu_to_be16(QCA7K_SPI_WRITE | QCA7K_SPI_EXTERNAL);
2305 +- transfer->tx_buf = &cmd;
2306 +- transfer->rx_buf = NULL;
2307 +- transfer->len = QCASPI_CMD_LEN;
2308 +- transfer = &qca->spi_xfer2[1];
2309 +- transfer->tx_buf = src;
2310 +- transfer->rx_buf = NULL;
2311 +- transfer->len = len;
2312 ++ transfer[0].tx_buf = &cmd;
2313 ++ transfer[0].len = QCASPI_CMD_LEN;
2314 ++ transfer[1].tx_buf = src;
2315 ++ transfer[1].len = len;
2316 +
2317 +- ret = spi_sync(qca->spi_dev, msg);
2318 ++ spi_message_add_tail(&transfer[0], &msg);
2319 ++ spi_message_add_tail(&transfer[1], &msg);
2320 ++ ret = spi_sync(qca->spi_dev, &msg);
2321 +
2322 +- if (ret || (msg->actual_length != QCASPI_CMD_LEN + len)) {
2323 ++ if (ret || (msg.actual_length != QCASPI_CMD_LEN + len)) {
2324 + qcaspi_spi_error(qca);
2325 + return 0;
2326 + }
2327 +@@ -125,17 +127,20 @@ qcaspi_write_burst(struct qcaspi *qca, u8 *src, u32 len)
2328 + static u32
2329 + qcaspi_write_legacy(struct qcaspi *qca, u8 *src, u32 len)
2330 + {
2331 +- struct spi_message *msg = &qca->spi_msg1;
2332 +- struct spi_transfer *transfer = &qca->spi_xfer1;
2333 ++ struct spi_message msg;
2334 ++ struct spi_transfer transfer;
2335 + int ret;
2336 +
2337 +- transfer->tx_buf = src;
2338 +- transfer->rx_buf = NULL;
2339 +- transfer->len = len;
2340 ++ memset(&transfer, 0, sizeof(transfer));
2341 ++ spi_message_init(&msg);
2342 ++
2343 ++ transfer.tx_buf = src;
2344 ++ transfer.len = len;
2345 +
2346 +- ret = spi_sync(qca->spi_dev, msg);
2347 ++ spi_message_add_tail(&transfer, &msg);
2348 ++ ret = spi_sync(qca->spi_dev, &msg);
2349 +
2350 +- if (ret || (msg->actual_length != len)) {
2351 ++ if (ret || (msg.actual_length != len)) {
2352 + qcaspi_spi_error(qca);
2353 + return 0;
2354 + }
2355 +@@ -146,23 +151,25 @@ qcaspi_write_legacy(struct qcaspi *qca, u8 *src, u32 len)
2356 + static u32
2357 + qcaspi_read_burst(struct qcaspi *qca, u8 *dst, u32 len)
2358 + {
2359 +- struct spi_message *msg = &qca->spi_msg2;
2360 ++ struct spi_message msg;
2361 + __be16 cmd;
2362 +- struct spi_transfer *transfer = &qca->spi_xfer2[0];
2363 ++ struct spi_transfer transfer[2];
2364 + int ret;
2365 +
2366 ++ memset(&transfer, 0, sizeof(transfer));
2367 ++ spi_message_init(&msg);
2368 ++
2369 + cmd = cpu_to_be16(QCA7K_SPI_READ | QCA7K_SPI_EXTERNAL);
2370 +- transfer->tx_buf = &cmd;
2371 +- transfer->rx_buf = NULL;
2372 +- transfer->len = QCASPI_CMD_LEN;
2373 +- transfer = &qca->spi_xfer2[1];
2374 +- transfer->tx_buf = NULL;
2375 +- transfer->rx_buf = dst;
2376 +- transfer->len = len;
2377 ++ transfer[0].tx_buf = &cmd;
2378 ++ transfer[0].len = QCASPI_CMD_LEN;
2379 ++ transfer[1].rx_buf = dst;
2380 ++ transfer[1].len = len;
2381 +
2382 +- ret = spi_sync(qca->spi_dev, msg);
2383 ++ spi_message_add_tail(&transfer[0], &msg);
2384 ++ spi_message_add_tail(&transfer[1], &msg);
2385 ++ ret = spi_sync(qca->spi_dev, &msg);
2386 +
2387 +- if (ret || (msg->actual_length != QCASPI_CMD_LEN + len)) {
2388 ++ if (ret || (msg.actual_length != QCASPI_CMD_LEN + len)) {
2389 + qcaspi_spi_error(qca);
2390 + return 0;
2391 + }
2392 +@@ -173,17 +180,20 @@ qcaspi_read_burst(struct qcaspi *qca, u8 *dst, u32 len)
2393 + static u32
2394 + qcaspi_read_legacy(struct qcaspi *qca, u8 *dst, u32 len)
2395 + {
2396 +- struct spi_message *msg = &qca->spi_msg1;
2397 +- struct spi_transfer *transfer = &qca->spi_xfer1;
2398 ++ struct spi_message msg;
2399 ++ struct spi_transfer transfer;
2400 + int ret;
2401 +
2402 +- transfer->tx_buf = NULL;
2403 +- transfer->rx_buf = dst;
2404 +- transfer->len = len;
2405 ++ memset(&transfer, 0, sizeof(transfer));
2406 ++ spi_message_init(&msg);
2407 +
2408 +- ret = spi_sync(qca->spi_dev, msg);
2409 ++ transfer.rx_buf = dst;
2410 ++ transfer.len = len;
2411 +
2412 +- if (ret || (msg->actual_length != len)) {
2413 ++ spi_message_add_tail(&transfer, &msg);
2414 ++ ret = spi_sync(qca->spi_dev, &msg);
2415 ++
2416 ++ if (ret || (msg.actual_length != len)) {
2417 + qcaspi_spi_error(qca);
2418 + return 0;
2419 + }
2420 +@@ -195,19 +205,23 @@ static int
2421 + qcaspi_tx_cmd(struct qcaspi *qca, u16 cmd)
2422 + {
2423 + __be16 tx_data;
2424 +- struct spi_message *msg = &qca->spi_msg1;
2425 +- struct spi_transfer *transfer = &qca->spi_xfer1;
2426 ++ struct spi_message msg;
2427 ++ struct spi_transfer transfer;
2428 + int ret;
2429 +
2430 ++ memset(&transfer, 0, sizeof(transfer));
2431 ++
2432 ++ spi_message_init(&msg);
2433 ++
2434 + tx_data = cpu_to_be16(cmd);
2435 +- transfer->len = sizeof(tx_data);
2436 +- transfer->tx_buf = &tx_data;
2437 +- transfer->rx_buf = NULL;
2438 ++ transfer.len = sizeof(cmd);
2439 ++ transfer.tx_buf = &tx_data;
2440 ++ spi_message_add_tail(&transfer, &msg);
2441 +
2442 +- ret = spi_sync(qca->spi_dev, msg);
2443 ++ ret = spi_sync(qca->spi_dev, &msg);
2444 +
2445 + if (!ret)
2446 +- ret = msg->status;
2447 ++ ret = msg.status;
2448 +
2449 + if (ret)
2450 + qcaspi_spi_error(qca);
2451 +@@ -836,16 +850,6 @@ qcaspi_netdev_setup(struct net_device *dev)
2452 + qca = netdev_priv(dev);
2453 + memset(qca, 0, sizeof(struct qcaspi));
2454 +
2455 +- memset(&qca->spi_xfer1, 0, sizeof(struct spi_transfer));
2456 +- memset(&qca->spi_xfer2, 0, sizeof(struct spi_transfer) * 2);
2457 +-
2458 +- spi_message_init(&qca->spi_msg1);
2459 +- spi_message_add_tail(&qca->spi_xfer1, &qca->spi_msg1);
2460 +-
2461 +- spi_message_init(&qca->spi_msg2);
2462 +- spi_message_add_tail(&qca->spi_xfer2[0], &qca->spi_msg2);
2463 +- spi_message_add_tail(&qca->spi_xfer2[1], &qca->spi_msg2);
2464 +-
2465 + memset(&qca->txr, 0, sizeof(qca->txr));
2466 + qca->txr.count = TX_RING_MAX_LEN;
2467 + }
2468 +diff --git a/drivers/net/ethernet/qualcomm/qca_spi.h b/drivers/net/ethernet/qualcomm/qca_spi.h
2469 +index fc4beb1b32d1..fc0e98726b36 100644
2470 +--- a/drivers/net/ethernet/qualcomm/qca_spi.h
2471 ++++ b/drivers/net/ethernet/qualcomm/qca_spi.h
2472 +@@ -83,11 +83,6 @@ struct qcaspi {
2473 + struct tx_ring txr;
2474 + struct qcaspi_stats stats;
2475 +
2476 +- struct spi_message spi_msg1;
2477 +- struct spi_message spi_msg2;
2478 +- struct spi_transfer spi_xfer1;
2479 +- struct spi_transfer spi_xfer2[2];
2480 +-
2481 + u8 *rx_buffer;
2482 + u32 buffer_size;
2483 + u8 sync;
2484 +diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
2485 +index 328c37e9096d..17025d46bdac 100644
2486 +--- a/drivers/net/hyperv/rndis_filter.c
2487 ++++ b/drivers/net/hyperv/rndis_filter.c
2488 +@@ -1299,7 +1299,7 @@ out:
2489 + /* setting up multiple channels failed */
2490 + net_device->max_chn = 1;
2491 + net_device->num_chn = 1;
2492 +- return 0;
2493 ++ return net_device;
2494 +
2495 + err_dev_remv:
2496 + rndis_filter_device_remove(dev, net_device);
2497 +diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
2498 +index 33df76405b86..18b648648adb 100644
2499 +--- a/drivers/net/wan/fsl_ucc_hdlc.c
2500 ++++ b/drivers/net/wan/fsl_ucc_hdlc.c
2501 +@@ -192,7 +192,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
2502 + priv->ucc_pram_offset = qe_muram_alloc(sizeof(struct ucc_hdlc_param),
2503 + ALIGNMENT_OF_UCC_HDLC_PRAM);
2504 +
2505 +- if (priv->ucc_pram_offset < 0) {
2506 ++ if (IS_ERR_VALUE(priv->ucc_pram_offset)) {
2507 + dev_err(priv->dev, "Can not allocate MURAM for hdlc parameter.\n");
2508 + ret = -ENOMEM;
2509 + goto free_tx_bd;
2510 +@@ -228,14 +228,14 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
2511 +
2512 + /* Alloc riptr, tiptr */
2513 + riptr = qe_muram_alloc(32, 32);
2514 +- if (riptr < 0) {
2515 ++ if (IS_ERR_VALUE(riptr)) {
2516 + dev_err(priv->dev, "Cannot allocate MURAM mem for Receive internal temp data pointer\n");
2517 + ret = -ENOMEM;
2518 + goto free_tx_skbuff;
2519 + }
2520 +
2521 + tiptr = qe_muram_alloc(32, 32);
2522 +- if (tiptr < 0) {
2523 ++ if (IS_ERR_VALUE(tiptr)) {
2524 + dev_err(priv->dev, "Cannot allocate MURAM mem for Transmit internal temp data pointer\n");
2525 + ret = -ENOMEM;
2526 + goto free_riptr;
2527 +diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
2528 +index d5e790dd589a..d80343429de5 100644
2529 +--- a/drivers/net/xen-netfront.c
2530 ++++ b/drivers/net/xen-netfront.c
2531 +@@ -87,8 +87,7 @@ struct netfront_cb {
2532 + /* IRQ name is queue name with "-tx" or "-rx" appended */
2533 + #define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3)
2534 +
2535 +-static DECLARE_WAIT_QUEUE_HEAD(module_load_q);
2536 +-static DECLARE_WAIT_QUEUE_HEAD(module_unload_q);
2537 ++static DECLARE_WAIT_QUEUE_HEAD(module_wq);
2538 +
2539 + struct netfront_stats {
2540 + u64 packets;
2541 +@@ -1331,11 +1330,11 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
2542 + netif_carrier_off(netdev);
2543 +
2544 + xenbus_switch_state(dev, XenbusStateInitialising);
2545 +- wait_event(module_load_q,
2546 +- xenbus_read_driver_state(dev->otherend) !=
2547 +- XenbusStateClosed &&
2548 +- xenbus_read_driver_state(dev->otherend) !=
2549 +- XenbusStateUnknown);
2550 ++ wait_event(module_wq,
2551 ++ xenbus_read_driver_state(dev->otherend) !=
2552 ++ XenbusStateClosed &&
2553 ++ xenbus_read_driver_state(dev->otherend) !=
2554 ++ XenbusStateUnknown);
2555 + return netdev;
2556 +
2557 + exit:
2558 +@@ -1603,6 +1602,7 @@ static int xennet_init_queue(struct netfront_queue *queue)
2559 + {
2560 + unsigned short i;
2561 + int err = 0;
2562 ++ char *devid;
2563 +
2564 + spin_lock_init(&queue->tx_lock);
2565 + spin_lock_init(&queue->rx_lock);
2566 +@@ -1610,8 +1610,9 @@ static int xennet_init_queue(struct netfront_queue *queue)
2567 + setup_timer(&queue->rx_refill_timer, rx_refill_timeout,
2568 + (unsigned long)queue);
2569 +
2570 +- snprintf(queue->name, sizeof(queue->name), "%s-q%u",
2571 +- queue->info->netdev->name, queue->id);
2572 ++ devid = strrchr(queue->info->xbdev->nodename, '/') + 1;
2573 ++ snprintf(queue->name, sizeof(queue->name), "vif%s-q%u",
2574 ++ devid, queue->id);
2575 +
2576 + /* Initialise tx_skbs as a free chain containing every entry. */
2577 + queue->tx_skb_freelist = 0;
2578 +@@ -2007,15 +2008,14 @@ static void netback_changed(struct xenbus_device *dev,
2579 +
2580 + dev_dbg(&dev->dev, "%s\n", xenbus_strstate(backend_state));
2581 +
2582 ++ wake_up_all(&module_wq);
2583 ++
2584 + switch (backend_state) {
2585 + case XenbusStateInitialising:
2586 + case XenbusStateInitialised:
2587 + case XenbusStateReconfiguring:
2588 + case XenbusStateReconfigured:
2589 +- break;
2590 +-
2591 + case XenbusStateUnknown:
2592 +- wake_up_all(&module_unload_q);
2593 + break;
2594 +
2595 + case XenbusStateInitWait:
2596 +@@ -2031,12 +2031,10 @@ static void netback_changed(struct xenbus_device *dev,
2597 + break;
2598 +
2599 + case XenbusStateClosed:
2600 +- wake_up_all(&module_unload_q);
2601 + if (dev->state == XenbusStateClosed)
2602 + break;
2603 + /* Missed the backend's CLOSING state -- fallthrough */
2604 + case XenbusStateClosing:
2605 +- wake_up_all(&module_unload_q);
2606 + xenbus_frontend_closed(dev);
2607 + break;
2608 + }
2609 +@@ -2144,14 +2142,14 @@ static int xennet_remove(struct xenbus_device *dev)
2610 +
2611 + if (xenbus_read_driver_state(dev->otherend) != XenbusStateClosed) {
2612 + xenbus_switch_state(dev, XenbusStateClosing);
2613 +- wait_event(module_unload_q,
2614 ++ wait_event(module_wq,
2615 + xenbus_read_driver_state(dev->otherend) ==
2616 + XenbusStateClosing ||
2617 + xenbus_read_driver_state(dev->otherend) ==
2618 + XenbusStateUnknown);
2619 +
2620 + xenbus_switch_state(dev, XenbusStateClosed);
2621 +- wait_event(module_unload_q,
2622 ++ wait_event(module_wq,
2623 + xenbus_read_driver_state(dev->otherend) ==
2624 + XenbusStateClosed ||
2625 + xenbus_read_driver_state(dev->otherend) ==
2626 +diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
2627 +index 48a831d58e7a..9fffe41ead50 100644
2628 +--- a/drivers/nvme/host/rdma.c
2629 ++++ b/drivers/nvme/host/rdma.c
2630 +@@ -1728,6 +1728,8 @@ static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
2631 + nvme_stop_queues(&ctrl->ctrl);
2632 + blk_mq_tagset_busy_iter(&ctrl->tag_set,
2633 + nvme_cancel_request, &ctrl->ctrl);
2634 ++ if (shutdown)
2635 ++ nvme_start_queues(&ctrl->ctrl);
2636 + nvme_rdma_destroy_io_queues(ctrl, shutdown);
2637 + }
2638 +
2639 +diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
2640 +index 01cf1c1a841a..8de329546b82 100644
2641 +--- a/drivers/parport/parport_sunbpp.c
2642 ++++ b/drivers/parport/parport_sunbpp.c
2643 +@@ -286,12 +286,16 @@ static int bpp_probe(struct platform_device *op)
2644 +
2645 + ops = kmemdup(&parport_sunbpp_ops, sizeof(struct parport_operations),
2646 + GFP_KERNEL);
2647 +- if (!ops)
2648 ++ if (!ops) {
2649 ++ err = -ENOMEM;
2650 + goto out_unmap;
2651 ++ }
2652 +
2653 + dprintk(("register_port\n"));
2654 +- if (!(p = parport_register_port((unsigned long)base, irq, dma, ops)))
2655 ++ if (!(p = parport_register_port((unsigned long)base, irq, dma, ops))) {
2656 ++ err = -ENOMEM;
2657 + goto out_free_ops;
2658 ++ }
2659 +
2660 + p->size = size;
2661 + p->dev = &op->dev;
2662 +diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c
2663 +index 04d058706b80..a865dc56a491 100644
2664 +--- a/drivers/pinctrl/pinctrl-rza1.c
2665 ++++ b/drivers/pinctrl/pinctrl-rza1.c
2666 +@@ -878,6 +878,7 @@ static int rza1_dt_node_to_map(struct pinctrl_dev *pctldev,
2667 + const char *grpname;
2668 + const char **fngrps;
2669 + int ret, npins;
2670 ++ int gsel, fsel;
2671 +
2672 + npins = rza1_dt_node_pin_count(np);
2673 + if (npins < 0) {
2674 +@@ -927,18 +928,19 @@ static int rza1_dt_node_to_map(struct pinctrl_dev *pctldev,
2675 + fngrps[0] = grpname;
2676 +
2677 + mutex_lock(&rza1_pctl->mutex);
2678 +- ret = pinctrl_generic_add_group(pctldev, grpname, grpins, npins,
2679 +- NULL);
2680 +- if (ret) {
2681 ++ gsel = pinctrl_generic_add_group(pctldev, grpname, grpins, npins,
2682 ++ NULL);
2683 ++ if (gsel < 0) {
2684 + mutex_unlock(&rza1_pctl->mutex);
2685 +- return ret;
2686 ++ return gsel;
2687 + }
2688 +
2689 +- ret = pinmux_generic_add_function(pctldev, grpname, fngrps, 1,
2690 +- mux_confs);
2691 +- if (ret)
2692 ++ fsel = pinmux_generic_add_function(pctldev, grpname, fngrps, 1,
2693 ++ mux_confs);
2694 ++ if (fsel < 0) {
2695 ++ ret = fsel;
2696 + goto remove_group;
2697 +- mutex_unlock(&rza1_pctl->mutex);
2698 ++ }
2699 +
2700 + dev_info(rza1_pctl->dev, "Parsed function and group %s with %d pins\n",
2701 + grpname, npins);
2702 +@@ -955,15 +957,15 @@ static int rza1_dt_node_to_map(struct pinctrl_dev *pctldev,
2703 + (*map)->data.mux.group = np->name;
2704 + (*map)->data.mux.function = np->name;
2705 + *num_maps = 1;
2706 ++ mutex_unlock(&rza1_pctl->mutex);
2707 +
2708 + return 0;
2709 +
2710 + remove_function:
2711 +- mutex_lock(&rza1_pctl->mutex);
2712 +- pinmux_generic_remove_last_function(pctldev);
2713 ++ pinmux_generic_remove_function(pctldev, fsel);
2714 +
2715 + remove_group:
2716 +- pinctrl_generic_remove_last_group(pctldev);
2717 ++ pinctrl_generic_remove_group(pctldev, gsel);
2718 + mutex_unlock(&rza1_pctl->mutex);
2719 +
2720 + dev_info(rza1_pctl->dev, "Unable to parse function and group %s\n",
2721 +diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
2722 +index ff491da64dab..31632c087504 100644
2723 +--- a/drivers/pinctrl/qcom/pinctrl-msm.c
2724 ++++ b/drivers/pinctrl/qcom/pinctrl-msm.c
2725 +@@ -238,22 +238,30 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev,
2726 + /* Convert register value to pinconf value */
2727 + switch (param) {
2728 + case PIN_CONFIG_BIAS_DISABLE:
2729 +- arg = arg == MSM_NO_PULL;
2730 ++ if (arg != MSM_NO_PULL)
2731 ++ return -EINVAL;
2732 ++ arg = 1;
2733 + break;
2734 + case PIN_CONFIG_BIAS_PULL_DOWN:
2735 +- arg = arg == MSM_PULL_DOWN;
2736 ++ if (arg != MSM_PULL_DOWN)
2737 ++ return -EINVAL;
2738 ++ arg = 1;
2739 + break;
2740 + case PIN_CONFIG_BIAS_BUS_HOLD:
2741 + if (pctrl->soc->pull_no_keeper)
2742 + return -ENOTSUPP;
2743 +
2744 +- arg = arg == MSM_KEEPER;
2745 ++ if (arg != MSM_KEEPER)
2746 ++ return -EINVAL;
2747 ++ arg = 1;
2748 + break;
2749 + case PIN_CONFIG_BIAS_PULL_UP:
2750 + if (pctrl->soc->pull_no_keeper)
2751 + arg = arg == MSM_PULL_UP_NO_KEEPER;
2752 + else
2753 + arg = arg == MSM_PULL_UP;
2754 ++ if (!arg)
2755 ++ return -EINVAL;
2756 + break;
2757 + case PIN_CONFIG_DRIVE_STRENGTH:
2758 + arg = msm_regval_to_drive(arg);
2759 +diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
2760 +index c2c0bab04257..22aaf4375fac 100644
2761 +--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
2762 ++++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
2763 +@@ -390,31 +390,47 @@ static int pmic_gpio_config_get(struct pinctrl_dev *pctldev,
2764 +
2765 + switch (param) {
2766 + case PIN_CONFIG_DRIVE_PUSH_PULL:
2767 +- arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_CMOS;
2768 ++ if (pad->buffer_type != PMIC_GPIO_OUT_BUF_CMOS)
2769 ++ return -EINVAL;
2770 ++ arg = 1;
2771 + break;
2772 + case PIN_CONFIG_DRIVE_OPEN_DRAIN:
2773 +- arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS;
2774 ++ if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS)
2775 ++ return -EINVAL;
2776 ++ arg = 1;
2777 + break;
2778 + case PIN_CONFIG_DRIVE_OPEN_SOURCE:
2779 +- arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS;
2780 ++ if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS)
2781 ++ return -EINVAL;
2782 ++ arg = 1;
2783 + break;
2784 + case PIN_CONFIG_BIAS_PULL_DOWN:
2785 +- arg = pad->pullup == PMIC_GPIO_PULL_DOWN;
2786 ++ if (pad->pullup != PMIC_GPIO_PULL_DOWN)
2787 ++ return -EINVAL;
2788 ++ arg = 1;
2789 + break;
2790 + case PIN_CONFIG_BIAS_DISABLE:
2791 +- arg = pad->pullup = PMIC_GPIO_PULL_DISABLE;
2792 ++ if (pad->pullup != PMIC_GPIO_PULL_DISABLE)
2793 ++ return -EINVAL;
2794 ++ arg = 1;
2795 + break;
2796 + case PIN_CONFIG_BIAS_PULL_UP:
2797 +- arg = pad->pullup == PMIC_GPIO_PULL_UP_30;
2798 ++ if (pad->pullup != PMIC_GPIO_PULL_UP_30)
2799 ++ return -EINVAL;
2800 ++ arg = 1;
2801 + break;
2802 + case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
2803 +- arg = !pad->is_enabled;
2804 ++ if (pad->is_enabled)
2805 ++ return -EINVAL;
2806 ++ arg = 1;
2807 + break;
2808 + case PIN_CONFIG_POWER_SOURCE:
2809 + arg = pad->power_source;
2810 + break;
2811 + case PIN_CONFIG_INPUT_ENABLE:
2812 +- arg = pad->input_enabled;
2813 ++ if (!pad->input_enabled)
2814 ++ return -EINVAL;
2815 ++ arg = 1;
2816 + break;
2817 + case PIN_CONFIG_OUTPUT:
2818 + arg = pad->out_value;
2819 +diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
2820 +index bb1dcd7fbdeb..8221e000c8c2 100644
2821 +--- a/drivers/platform/x86/toshiba_acpi.c
2822 ++++ b/drivers/platform/x86/toshiba_acpi.c
2823 +@@ -34,6 +34,7 @@
2824 + #define TOSHIBA_ACPI_VERSION "0.24"
2825 + #define PROC_INTERFACE_VERSION 1
2826 +
2827 ++#include <linux/compiler.h>
2828 + #include <linux/kernel.h>
2829 + #include <linux/module.h>
2830 + #include <linux/moduleparam.h>
2831 +@@ -1682,7 +1683,7 @@ static const struct file_operations keys_proc_fops = {
2832 + .write = keys_proc_write,
2833 + };
2834 +
2835 +-static int version_proc_show(struct seq_file *m, void *v)
2836 ++static int __maybe_unused version_proc_show(struct seq_file *m, void *v)
2837 + {
2838 + seq_printf(m, "driver: %s\n", TOSHIBA_ACPI_VERSION);
2839 + seq_printf(m, "proc_interface: %d\n", PROC_INTERFACE_VERSION);
2840 +diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c
2841 +index 4db177bc89bc..fdeac1946429 100644
2842 +--- a/drivers/reset/reset-imx7.c
2843 ++++ b/drivers/reset/reset-imx7.c
2844 +@@ -80,7 +80,7 @@ static int imx7_reset_set(struct reset_controller_dev *rcdev,
2845 + {
2846 + struct imx7_src *imx7src = to_imx7_src(rcdev);
2847 + const struct imx7_src_signal *signal = &imx7_src_signals[id];
2848 +- unsigned int value = 0;
2849 ++ unsigned int value = assert ? signal->bit : 0;
2850 +
2851 + switch (id) {
2852 + case IMX7_RESET_PCIEPHY:
2853 +diff --git a/drivers/rtc/rtc-bq4802.c b/drivers/rtc/rtc-bq4802.c
2854 +index bd170cb3361c..5747a54cbd42 100644
2855 +--- a/drivers/rtc/rtc-bq4802.c
2856 ++++ b/drivers/rtc/rtc-bq4802.c
2857 +@@ -164,6 +164,10 @@ static int bq4802_probe(struct platform_device *pdev)
2858 + } else if (p->r->flags & IORESOURCE_MEM) {
2859 + p->regs = devm_ioremap(&pdev->dev, p->r->start,
2860 + resource_size(p->r));
2861 ++ if (!p->regs){
2862 ++ err = -ENOMEM;
2863 ++ goto out;
2864 ++ }
2865 + p->read = bq4802_read_mem;
2866 + p->write = bq4802_write_mem;
2867 + } else {
2868 +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
2869 +index 939b5b5e97ef..0a6afd4b283d 100644
2870 +--- a/drivers/s390/net/qeth_core_main.c
2871 ++++ b/drivers/s390/net/qeth_core_main.c
2872 +@@ -3507,13 +3507,14 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index,
2873 + qdio_flags = QDIO_FLAG_SYNC_OUTPUT;
2874 + if (atomic_read(&queue->set_pci_flags_count))
2875 + qdio_flags |= QDIO_FLAG_PCI_OUT;
2876 ++ atomic_add(count, &queue->used_buffers);
2877 ++
2878 + rc = do_QDIO(CARD_DDEV(queue->card), qdio_flags,
2879 + queue->queue_no, index, count);
2880 + if (queue->card->options.performance_stats)
2881 + queue->card->perf_stats.outbound_do_qdio_time +=
2882 + qeth_get_micros() -
2883 + queue->card->perf_stats.outbound_do_qdio_start_time;
2884 +- atomic_add(count, &queue->used_buffers);
2885 + if (rc) {
2886 + queue->card->stats.tx_errors += count;
2887 + /* ignore temporary SIGA errors without busy condition */
2888 +diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
2889 +index d1ee9e30c68b..21e91fbb2860 100644
2890 +--- a/drivers/s390/net/qeth_core_sys.c
2891 ++++ b/drivers/s390/net/qeth_core_sys.c
2892 +@@ -423,6 +423,7 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
2893 + if (card->discipline) {
2894 + card->discipline->remove(card->gdev);
2895 + qeth_core_free_discipline(card);
2896 ++ card->options.layer2 = -1;
2897 + }
2898 +
2899 + rc = qeth_core_load_discipline(card, newdis);
2900 +diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
2901 +index 8660f923ace0..bb9c1c016643 100644
2902 +--- a/drivers/scsi/libfc/fc_disc.c
2903 ++++ b/drivers/scsi/libfc/fc_disc.c
2904 +@@ -294,9 +294,11 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)
2905 + * discovery, reverify or log them in. Otherwise, log them out.
2906 + * Skip ports which were never discovered. These are the dNS port
2907 + * and ports which were created by PLOGI.
2908 ++ *
2909 ++ * We don't need to use the _rcu variant here as the rport list
2910 ++ * is protected by the disc mutex which is already held on entry.
2911 + */
2912 +- rcu_read_lock();
2913 +- list_for_each_entry_rcu(rdata, &disc->rports, peers) {
2914 ++ list_for_each_entry(rdata, &disc->rports, peers) {
2915 + if (!kref_get_unless_zero(&rdata->kref))
2916 + continue;
2917 + if (rdata->disc_id) {
2918 +@@ -307,7 +309,6 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)
2919 + }
2920 + kref_put(&rdata->kref, fc_rport_destroy);
2921 + }
2922 +- rcu_read_unlock();
2923 + mutex_unlock(&disc->disc_mutex);
2924 + disc->disc_callback(lport, event);
2925 + mutex_lock(&disc->disc_mutex);
2926 +diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
2927 +index 4be864dbd41c..9eb3b625a1b1 100644
2928 +--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
2929 ++++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
2930 +@@ -442,16 +442,16 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream)
2931 + my_workqueue_init(alsa_stream);
2932 +
2933 + ret = bcm2835_audio_open_connection(alsa_stream);
2934 +- if (ret) {
2935 +- ret = -1;
2936 +- goto exit;
2937 +- }
2938 ++ if (ret)
2939 ++ goto free_wq;
2940 ++
2941 + instance = alsa_stream->instance;
2942 + LOG_DBG(" instance (%p)\n", instance);
2943 +
2944 + if (mutex_lock_interruptible(&instance->vchi_mutex)) {
2945 + LOG_DBG("Interrupted whilst waiting for lock on (%d)\n", instance->num_connections);
2946 +- return -EINTR;
2947 ++ ret = -EINTR;
2948 ++ goto free_wq;
2949 + }
2950 + vchi_service_use(instance->vchi_handle[0]);
2951 +
2952 +@@ -474,7 +474,11 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream)
2953 + unlock:
2954 + vchi_service_release(instance->vchi_handle[0]);
2955 + mutex_unlock(&instance->vchi_mutex);
2956 +-exit:
2957 ++
2958 ++free_wq:
2959 ++ if (ret)
2960 ++ destroy_workqueue(alsa_stream->my_wq);
2961 ++
2962 + return ret;
2963 + }
2964 +
2965 +diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
2966 +index be936b8fe317..377da037f31c 100644
2967 +--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
2968 ++++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
2969 +@@ -580,6 +580,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
2970 + static void stop_streaming(struct vb2_queue *vq)
2971 + {
2972 + int ret;
2973 ++ unsigned long timeout;
2974 + struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq);
2975 +
2976 + v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n",
2977 +@@ -605,10 +606,10 @@ static void stop_streaming(struct vb2_queue *vq)
2978 + sizeof(dev->capture.frame_count));
2979 +
2980 + /* wait for last frame to complete */
2981 +- ret = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ);
2982 +- if (ret <= 0)
2983 ++ timeout = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ);
2984 ++ if (timeout == 0)
2985 + v4l2_err(&dev->v4l2_dev,
2986 +- "error %d waiting for frame completion\n", ret);
2987 ++ "timed out waiting for frame completion\n");
2988 +
2989 + v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
2990 + "disabling connection\n");
2991 +diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
2992 +index 4360db6d4392..b3176f42c820 100644
2993 +--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
2994 ++++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
2995 +@@ -834,6 +834,7 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
2996 + {
2997 + struct mmal_msg_context *msg_context;
2998 + int ret;
2999 ++ unsigned long timeout;
3000 +
3001 + /* payload size must not cause message to exceed max size */
3002 + if (payload_len >
3003 +@@ -872,11 +873,11 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
3004 + return ret;
3005 + }
3006 +
3007 +- ret = wait_for_completion_timeout(&msg_context->u.sync.cmplt, 3 * HZ);
3008 +- if (ret <= 0) {
3009 +- pr_err("error %d waiting for sync completion\n", ret);
3010 +- if (ret == 0)
3011 +- ret = -ETIME;
3012 ++ timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt,
3013 ++ 3 * HZ);
3014 ++ if (timeout == 0) {
3015 ++ pr_err("timed out waiting for sync completion\n");
3016 ++ ret = -ETIME;
3017 + /* todo: what happens if the message arrives after aborting */
3018 + release_msg_context(msg_context);
3019 + return ret;
3020 +diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
3021 +index ac667b47f199..7b0a3a1688e8 100644
3022 +--- a/drivers/tty/serial/earlycon.c
3023 ++++ b/drivers/tty/serial/earlycon.c
3024 +@@ -254,7 +254,6 @@ int __init of_setup_earlycon(const struct earlycon_id *match,
3025 + return -ENXIO;
3026 + }
3027 + port->mapbase = addr;
3028 +- port->uartclk = BASE_BAUD * 16;
3029 +
3030 + val = of_get_flat_dt_prop(node, "reg-offset", NULL);
3031 + if (val)
3032 +@@ -289,6 +288,10 @@ int __init of_setup_earlycon(const struct earlycon_id *match,
3033 + if (val)
3034 + early_console_dev.baud = be32_to_cpu(*val);
3035 +
3036 ++ val = of_get_flat_dt_prop(node, "clock-frequency", NULL);
3037 ++ if (val)
3038 ++ port->uartclk = be32_to_cpu(*val);
3039 ++
3040 + if (options) {
3041 + early_console_dev.baud = simple_strtoul(options, NULL, 0);
3042 + strlcpy(early_console_dev.options, options,
3043 +diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c
3044 +index 5c33fd25676d..ebc797fc1afd 100644
3045 +--- a/drivers/tty/tty_baudrate.c
3046 ++++ b/drivers/tty/tty_baudrate.c
3047 +@@ -156,18 +156,25 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
3048 + termios->c_ospeed = obaud;
3049 +
3050 + #ifdef BOTHER
3051 ++ if ((termios->c_cflag >> IBSHIFT) & CBAUD)
3052 ++ ibinput = 1; /* An input speed was specified */
3053 ++
3054 + /* If the user asked for a precise weird speed give a precise weird
3055 + answer. If they asked for a Bfoo speed they may have problems
3056 + digesting non-exact replies so fuzz a bit */
3057 +
3058 +- if ((termios->c_cflag & CBAUD) == BOTHER)
3059 ++ if ((termios->c_cflag & CBAUD) == BOTHER) {
3060 + oclose = 0;
3061 ++ if (!ibinput)
3062 ++ iclose = 0;
3063 ++ }
3064 + if (((termios->c_cflag >> IBSHIFT) & CBAUD) == BOTHER)
3065 + iclose = 0;
3066 +- if ((termios->c_cflag >> IBSHIFT) & CBAUD)
3067 +- ibinput = 1; /* An input speed was specified */
3068 + #endif
3069 + termios->c_cflag &= ~CBAUD;
3070 ++#ifdef IBSHIFT
3071 ++ termios->c_cflag &= ~(CBAUD << IBSHIFT);
3072 ++#endif
3073 +
3074 + /*
3075 + * Our goal is to find a close match to the standard baud rate
3076 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
3077 +index f2f31fc16f29..feaa0d8f830a 100644
3078 +--- a/drivers/usb/class/cdc-acm.c
3079 ++++ b/drivers/usb/class/cdc-acm.c
3080 +@@ -792,20 +792,9 @@ static int acm_tty_write(struct tty_struct *tty,
3081 + }
3082 +
3083 + if (acm->susp_count) {
3084 +- if (acm->putbuffer) {
3085 +- /* now to preserve order */
3086 +- usb_anchor_urb(acm->putbuffer->urb, &acm->delayed);
3087 +- acm->putbuffer = NULL;
3088 +- }
3089 + usb_anchor_urb(wb->urb, &acm->delayed);
3090 + spin_unlock_irqrestore(&acm->write_lock, flags);
3091 + return count;
3092 +- } else {
3093 +- if (acm->putbuffer) {
3094 +- /* at this point there is no good way to handle errors */
3095 +- acm_start_wb(acm, acm->putbuffer);
3096 +- acm->putbuffer = NULL;
3097 +- }
3098 + }
3099 +
3100 + stat = acm_start_wb(acm, wb);
3101 +@@ -816,66 +805,6 @@ static int acm_tty_write(struct tty_struct *tty,
3102 + return count;
3103 + }
3104 +
3105 +-static void acm_tty_flush_chars(struct tty_struct *tty)
3106 +-{
3107 +- struct acm *acm = tty->driver_data;
3108 +- struct acm_wb *cur;
3109 +- int err;
3110 +- unsigned long flags;
3111 +-
3112 +- spin_lock_irqsave(&acm->write_lock, flags);
3113 +-
3114 +- cur = acm->putbuffer;
3115 +- if (!cur) /* nothing to do */
3116 +- goto out;
3117 +-
3118 +- acm->putbuffer = NULL;
3119 +- err = usb_autopm_get_interface_async(acm->control);
3120 +- if (err < 0) {
3121 +- cur->use = 0;
3122 +- acm->putbuffer = cur;
3123 +- goto out;
3124 +- }
3125 +-
3126 +- if (acm->susp_count)
3127 +- usb_anchor_urb(cur->urb, &acm->delayed);
3128 +- else
3129 +- acm_start_wb(acm, cur);
3130 +-out:
3131 +- spin_unlock_irqrestore(&acm->write_lock, flags);
3132 +- return;
3133 +-}
3134 +-
3135 +-static int acm_tty_put_char(struct tty_struct *tty, unsigned char ch)
3136 +-{
3137 +- struct acm *acm = tty->driver_data;
3138 +- struct acm_wb *cur;
3139 +- int wbn;
3140 +- unsigned long flags;
3141 +-
3142 +-overflow:
3143 +- cur = acm->putbuffer;
3144 +- if (!cur) {
3145 +- spin_lock_irqsave(&acm->write_lock, flags);
3146 +- wbn = acm_wb_alloc(acm);
3147 +- if (wbn >= 0) {
3148 +- cur = &acm->wb[wbn];
3149 +- acm->putbuffer = cur;
3150 +- }
3151 +- spin_unlock_irqrestore(&acm->write_lock, flags);
3152 +- if (!cur)
3153 +- return 0;
3154 +- }
3155 +-
3156 +- if (cur->len == acm->writesize) {
3157 +- acm_tty_flush_chars(tty);
3158 +- goto overflow;
3159 +- }
3160 +-
3161 +- cur->buf[cur->len++] = ch;
3162 +- return 1;
3163 +-}
3164 +-
3165 + static int acm_tty_write_room(struct tty_struct *tty)
3166 + {
3167 + struct acm *acm = tty->driver_data;
3168 +@@ -2000,8 +1929,6 @@ static const struct tty_operations acm_ops = {
3169 + .cleanup = acm_tty_cleanup,
3170 + .hangup = acm_tty_hangup,
3171 + .write = acm_tty_write,
3172 +- .put_char = acm_tty_put_char,
3173 +- .flush_chars = acm_tty_flush_chars,
3174 + .write_room = acm_tty_write_room,
3175 + .ioctl = acm_tty_ioctl,
3176 + .throttle = acm_tty_throttle,
3177 +diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
3178 +index eacc116e83da..ca06b20d7af9 100644
3179 +--- a/drivers/usb/class/cdc-acm.h
3180 ++++ b/drivers/usb/class/cdc-acm.h
3181 +@@ -96,7 +96,6 @@ struct acm {
3182 + unsigned long read_urbs_free;
3183 + struct urb *read_urbs[ACM_NR];
3184 + struct acm_rb read_buffers[ACM_NR];
3185 +- struct acm_wb *putbuffer; /* for acm_tty_put_char() */
3186 + int rx_buflimit;
3187 + spinlock_t read_lock;
3188 + u8 *notification_buffer; /* to reassemble fragmented notifications */
3189 +diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
3190 +index 3e865dbf878c..a9509ecccedb 100644
3191 +--- a/drivers/usb/class/cdc-wdm.c
3192 ++++ b/drivers/usb/class/cdc-wdm.c
3193 +@@ -457,7 +457,7 @@ static int service_outstanding_interrupt(struct wdm_device *desc)
3194 +
3195 + set_bit(WDM_RESPONDING, &desc->flags);
3196 + spin_unlock_irq(&desc->iuspin);
3197 +- rv = usb_submit_urb(desc->response, GFP_KERNEL);
3198 ++ rv = usb_submit_urb(desc->response, GFP_ATOMIC);
3199 + spin_lock_irq(&desc->iuspin);
3200 + if (rv) {
3201 + dev_err(&desc->intf->dev,
3202 +diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
3203 +index ea829ad798c0..5340d433cdf0 100644
3204 +--- a/drivers/usb/core/hcd-pci.c
3205 ++++ b/drivers/usb/core/hcd-pci.c
3206 +@@ -528,8 +528,6 @@ static int resume_common(struct device *dev, int event)
3207 + event == PM_EVENT_RESTORE);
3208 + if (retval) {
3209 + dev_err(dev, "PCI post-resume error %d!\n", retval);
3210 +- if (hcd->shared_hcd)
3211 +- usb_hc_died(hcd->shared_hcd);
3212 + usb_hc_died(hcd);
3213 + }
3214 + }
3215 +diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
3216 +index dd29e6ec1c43..833ddd228e3a 100644
3217 +--- a/drivers/usb/core/message.c
3218 ++++ b/drivers/usb/core/message.c
3219 +@@ -1280,6 +1280,11 @@ void usb_enable_interface(struct usb_device *dev,
3220 + * is submitted that needs that bandwidth. Some other operating systems
3221 + * allocate bandwidth early, when a configuration is chosen.
3222 + *
3223 ++ * xHCI reserves bandwidth and configures the alternate setting in
3224 ++ * usb_hcd_alloc_bandwidth(). If it fails the original interface altsetting
3225 ++ * may be disabled. Drivers cannot rely on any particular alternate
3226 ++ * setting being in effect after a failure.
3227 ++ *
3228 + * This call is synchronous, and may not be used in an interrupt context.
3229 + * Also, drivers must not change altsettings while urbs are scheduled for
3230 + * endpoints in that interface; all such urbs must first be completed
3231 +@@ -1315,6 +1320,12 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
3232 + alternate);
3233 + return -EINVAL;
3234 + }
3235 ++ /*
3236 ++ * usb3 hosts configure the interface in usb_hcd_alloc_bandwidth,
3237 ++ * including freeing dropped endpoint ring buffers.
3238 ++ * Make sure the interface endpoints are flushed before that
3239 ++ */
3240 ++ usb_disable_interface(dev, iface, false);
3241 +
3242 + /* Make sure we have enough bandwidth for this alternate interface.
3243 + * Remove the current alt setting and add the new alt setting.
3244 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
3245 +index 99f67764765f..37a5e07b3488 100644
3246 +--- a/drivers/usb/core/quirks.c
3247 ++++ b/drivers/usb/core/quirks.c
3248 +@@ -37,6 +37,10 @@ static const struct usb_device_id usb_quirk_list[] = {
3249 + /* CBM - Flash disk */
3250 + { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
3251 +
3252 ++ /* WORLDE Controller KS49 or Prodipe MIDI 49C USB controller */
3253 ++ { USB_DEVICE(0x0218, 0x0201), .driver_info =
3254 ++ USB_QUIRK_CONFIG_INTF_STRINGS },
3255 ++
3256 + /* WORLDE easy key (easykey.25) MIDI controller */
3257 + { USB_DEVICE(0x0218, 0x0401), .driver_info =
3258 + USB_QUIRK_CONFIG_INTF_STRINGS },
3259 +@@ -259,6 +263,9 @@ static const struct usb_device_id usb_quirk_list[] = {
3260 + { USB_DEVICE(0x2040, 0x7200), .driver_info =
3261 + USB_QUIRK_CONFIG_INTF_STRINGS },
3262 +
3263 ++ /* DJI CineSSD */
3264 ++ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
3265 ++
3266 + /* INTEL VALUE SSD */
3267 + { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
3268 +
3269 +diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h
3270 +index 4a3227543255..5cc9fd730656 100644
3271 +--- a/drivers/usb/dwc3/gadget.h
3272 ++++ b/drivers/usb/dwc3/gadget.h
3273 +@@ -33,7 +33,7 @@ struct dwc3;
3274 + #define DWC3_DEPCFG_XFER_IN_PROGRESS_EN BIT(9)
3275 + #define DWC3_DEPCFG_XFER_NOT_READY_EN BIT(10)
3276 + #define DWC3_DEPCFG_FIFO_ERROR_EN BIT(11)
3277 +-#define DWC3_DEPCFG_STREAM_EVENT_EN BIT(12)
3278 ++#define DWC3_DEPCFG_STREAM_EVENT_EN BIT(13)
3279 + #define DWC3_DEPCFG_BINTERVAL_M1(n) (((n) & 0xff) << 16)
3280 + #define DWC3_DEPCFG_STREAM_CAPABLE BIT(24)
3281 + #define DWC3_DEPCFG_EP_NUMBER(n) (((n) & 0x1f) << 25)
3282 +diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
3283 +index f608c1f85e61..9cbb061582a7 100644
3284 +--- a/drivers/usb/gadget/udc/net2280.c
3285 ++++ b/drivers/usb/gadget/udc/net2280.c
3286 +@@ -1549,11 +1549,14 @@ static int net2280_pullup(struct usb_gadget *_gadget, int is_on)
3287 + writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
3288 + } else {
3289 + writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
3290 +- stop_activity(dev, dev->driver);
3291 ++ stop_activity(dev, NULL);
3292 + }
3293 +
3294 + spin_unlock_irqrestore(&dev->lock, flags);
3295 +
3296 ++ if (!is_on && dev->driver)
3297 ++ dev->driver->disconnect(&dev->gadget);
3298 ++
3299 + return 0;
3300 + }
3301 +
3302 +@@ -2470,8 +2473,11 @@ static void stop_activity(struct net2280 *dev, struct usb_gadget_driver *driver)
3303 + nuke(&dev->ep[i]);
3304 +
3305 + /* report disconnect; the driver is already quiesced */
3306 +- if (driver)
3307 ++ if (driver) {
3308 ++ spin_unlock(&dev->lock);
3309 + driver->disconnect(&dev->gadget);
3310 ++ spin_lock(&dev->lock);
3311 ++ }
3312 +
3313 + usb_reinit(dev);
3314 + }
3315 +@@ -3345,6 +3351,8 @@ next_endpoints:
3316 + BIT(PCI_RETRY_ABORT_INTERRUPT))
3317 +
3318 + static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
3319 ++__releases(dev->lock)
3320 ++__acquires(dev->lock)
3321 + {
3322 + struct net2280_ep *ep;
3323 + u32 tmp, num, mask, scratch;
3324 +@@ -3385,12 +3393,14 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
3325 + if (disconnect || reset) {
3326 + stop_activity(dev, dev->driver);
3327 + ep0_start(dev);
3328 ++ spin_unlock(&dev->lock);
3329 + if (reset)
3330 + usb_gadget_udc_reset
3331 + (&dev->gadget, dev->driver);
3332 + else
3333 + (dev->driver->disconnect)
3334 + (&dev->gadget);
3335 ++ spin_lock(&dev->lock);
3336 + return;
3337 + }
3338 + }
3339 +@@ -3409,6 +3419,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
3340 + tmp = BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT);
3341 + if (stat & tmp) {
3342 + writel(tmp, &dev->regs->irqstat1);
3343 ++ spin_unlock(&dev->lock);
3344 + if (stat & BIT(SUSPEND_REQUEST_INTERRUPT)) {
3345 + if (dev->driver->suspend)
3346 + dev->driver->suspend(&dev->gadget);
3347 +@@ -3419,6 +3430,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
3348 + dev->driver->resume(&dev->gadget);
3349 + /* at high speed, note erratum 0133 */
3350 + }
3351 ++ spin_lock(&dev->lock);
3352 + stat &= ~tmp;
3353 + }
3354 +
3355 +diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
3356 +index c12a1a6554ba..36a706f475d2 100644
3357 +--- a/drivers/usb/gadget/udc/renesas_usb3.c
3358 ++++ b/drivers/usb/gadget/udc/renesas_usb3.c
3359 +@@ -788,12 +788,15 @@ static void usb3_irq_epc_int_1_speed(struct renesas_usb3 *usb3)
3360 + switch (speed) {
3361 + case USB_STA_SPEED_SS:
3362 + usb3->gadget.speed = USB_SPEED_SUPER;
3363 ++ usb3->gadget.ep0->maxpacket = USB3_EP0_SS_MAX_PACKET_SIZE;
3364 + break;
3365 + case USB_STA_SPEED_HS:
3366 + usb3->gadget.speed = USB_SPEED_HIGH;
3367 ++ usb3->gadget.ep0->maxpacket = USB3_EP0_HSFS_MAX_PACKET_SIZE;
3368 + break;
3369 + case USB_STA_SPEED_FS:
3370 + usb3->gadget.speed = USB_SPEED_FULL;
3371 ++ usb3->gadget.ep0->maxpacket = USB3_EP0_HSFS_MAX_PACKET_SIZE;
3372 + break;
3373 + default:
3374 + usb3->gadget.speed = USB_SPEED_UNKNOWN;
3375 +@@ -2458,7 +2461,7 @@ static int renesas_usb3_init_ep(struct renesas_usb3 *usb3, struct device *dev,
3376 + /* for control pipe */
3377 + usb3->gadget.ep0 = &usb3_ep->ep;
3378 + usb_ep_set_maxpacket_limit(&usb3_ep->ep,
3379 +- USB3_EP0_HSFS_MAX_PACKET_SIZE);
3380 ++ USB3_EP0_SS_MAX_PACKET_SIZE);
3381 + usb3_ep->ep.caps.type_control = true;
3382 + usb3_ep->ep.caps.dir_in = true;
3383 + usb3_ep->ep.caps.dir_out = true;
3384 +diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
3385 +index c38855aed62c..65c0086e25ae 100644
3386 +--- a/drivers/usb/host/u132-hcd.c
3387 ++++ b/drivers/usb/host/u132-hcd.c
3388 +@@ -2559,7 +2559,7 @@ static int u132_get_frame(struct usb_hcd *hcd)
3389 + } else {
3390 + int frame = 0;
3391 + dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n");
3392 +- msleep(100);
3393 ++ mdelay(100);
3394 + return frame;
3395 + }
3396 + }
3397 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
3398 +index 6b11fd9d8efe..64ddba3f79a9 100644
3399 +--- a/drivers/usb/host/xhci.c
3400 ++++ b/drivers/usb/host/xhci.c
3401 +@@ -47,6 +47,21 @@ static unsigned int quirks;
3402 + module_param(quirks, uint, S_IRUGO);
3403 + MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default");
3404 +
3405 ++static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring)
3406 ++{
3407 ++ struct xhci_segment *seg = ring->first_seg;
3408 ++
3409 ++ if (!td || !td->start_seg)
3410 ++ return false;
3411 ++ do {
3412 ++ if (seg == td->start_seg)
3413 ++ return true;
3414 ++ seg = seg->next;
3415 ++ } while (seg && seg != ring->first_seg);
3416 ++
3417 ++ return false;
3418 ++}
3419 ++
3420 + /* TODO: copied from ehci-hcd.c - can this be refactored? */
3421 + /*
3422 + * xhci_handshake - spin reading hc until handshake completes or fails
3423 +@@ -1511,6 +1526,21 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
3424 + goto done;
3425 + }
3426 +
3427 ++ /*
3428 ++ * check ring is not re-allocated since URB was enqueued. If it is, then
3429 ++ * make sure none of the ring related pointers in this URB private data
3430 ++ * are touched, such as td_list, otherwise we overwrite freed data
3431 ++ */
3432 ++ if (!td_on_ring(&urb_priv->td[0], ep_ring)) {
3433 ++ xhci_err(xhci, "Canceled URB td not found on endpoint ring");
3434 ++ for (i = urb_priv->num_tds_done; i < urb_priv->num_tds; i++) {
3435 ++ td = &urb_priv->td[i];
3436 ++ if (!list_empty(&td->cancelled_td_list))
3437 ++ list_del_init(&td->cancelled_td_list);
3438 ++ }
3439 ++ goto err_giveback;
3440 ++ }
3441 ++
3442 + if (xhci->xhc_state & XHCI_STATE_HALTED) {
3443 + xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
3444 + "HC halted, freeing TD manually.");
3445 +diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
3446 +index 8a13b2fcf3e1..03152f98108c 100644
3447 +--- a/drivers/usb/misc/uss720.c
3448 ++++ b/drivers/usb/misc/uss720.c
3449 +@@ -382,7 +382,7 @@ static unsigned char parport_uss720_frob_control(struct parport *pp, unsigned ch
3450 + mask &= 0x0f;
3451 + val &= 0x0f;
3452 + d = (priv->reg[1] & (~mask)) ^ val;
3453 +- if (set_1284_register(pp, 2, d, GFP_KERNEL))
3454 ++ if (set_1284_register(pp, 2, d, GFP_ATOMIC))
3455 + return 0;
3456 + priv->reg[1] = d;
3457 + return d & 0xf;
3458 +@@ -392,7 +392,7 @@ static unsigned char parport_uss720_read_status(struct parport *pp)
3459 + {
3460 + unsigned char ret;
3461 +
3462 +- if (get_1284_register(pp, 1, &ret, GFP_KERNEL))
3463 ++ if (get_1284_register(pp, 1, &ret, GFP_ATOMIC))
3464 + return 0;
3465 + return ret & 0xf8;
3466 + }
3467 +diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
3468 +index 47763311a42e..0673f286afbd 100644
3469 +--- a/drivers/usb/misc/yurex.c
3470 ++++ b/drivers/usb/misc/yurex.c
3471 +@@ -425,13 +425,13 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
3472 + {
3473 + struct usb_yurex *dev;
3474 + int i, set = 0, retval = 0;
3475 +- char buffer[16];
3476 ++ char buffer[16 + 1];
3477 + char *data = buffer;
3478 + unsigned long long c, c2 = 0;
3479 + signed long timeout = 0;
3480 + DEFINE_WAIT(wait);
3481 +
3482 +- count = min(sizeof(buffer), count);
3483 ++ count = min(sizeof(buffer) - 1, count);
3484 + dev = file->private_data;
3485 +
3486 + /* verify that we actually have some data to write */
3487 +@@ -450,6 +450,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
3488 + retval = -EFAULT;
3489 + goto error;
3490 + }
3491 ++ buffer[count] = 0;
3492 + memset(dev->cntl_buffer, CMD_PADDING, YUREX_BUF_SIZE);
3493 +
3494 + switch (buffer[0]) {
3495 +diff --git a/drivers/usb/serial/io_ti.h b/drivers/usb/serial/io_ti.h
3496 +index 1bd67b24f916..bc9ff5ebd67c 100644
3497 +--- a/drivers/usb/serial/io_ti.h
3498 ++++ b/drivers/usb/serial/io_ti.h
3499 +@@ -178,7 +178,7 @@ struct ump_interrupt {
3500 + } __attribute__((packed));
3501 +
3502 +
3503 +-#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3)
3504 ++#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 6) & 0x01)
3505 + #define TIUMP_GET_FUNC_FROM_CODE(c) ((c) & 0x0f)
3506 + #define TIUMP_INTERRUPT_CODE_LSR 0x03
3507 + #define TIUMP_INTERRUPT_CODE_MSR 0x04
3508 +diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
3509 +index 8fc3854e5e69..57e9f6617084 100644
3510 +--- a/drivers/usb/serial/ti_usb_3410_5052.c
3511 ++++ b/drivers/usb/serial/ti_usb_3410_5052.c
3512 +@@ -1123,7 +1123,7 @@ static void ti_break(struct tty_struct *tty, int break_state)
3513 +
3514 + static int ti_get_port_from_code(unsigned char code)
3515 + {
3516 +- return (code >> 4) - 3;
3517 ++ return (code >> 6) & 0x01;
3518 + }
3519 +
3520 + static int ti_get_func_from_code(unsigned char code)
3521 +diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
3522 +index 8cd2926fb1fe..344ec8631481 100644
3523 +--- a/drivers/usb/storage/scsiglue.c
3524 ++++ b/drivers/usb/storage/scsiglue.c
3525 +@@ -392,6 +392,15 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
3526 + return 0;
3527 + }
3528 +
3529 ++ if ((us->fflags & US_FL_NO_ATA_1X) &&
3530 ++ (srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) {
3531 ++ memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB,
3532 ++ sizeof(usb_stor_sense_invalidCDB));
3533 ++ srb->result = SAM_STAT_CHECK_CONDITION;
3534 ++ done(srb);
3535 ++ return 0;
3536 ++ }
3537 ++
3538 + /* enqueue the command and wake up the control thread */
3539 + srb->scsi_done = done;
3540 + us->srb = srb;
3541 +diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
3542 +index 33a6d624c843..24de9c00d8e2 100644
3543 +--- a/drivers/usb/storage/uas.c
3544 ++++ b/drivers/usb/storage/uas.c
3545 +@@ -842,6 +842,27 @@ static int uas_slave_configure(struct scsi_device *sdev)
3546 + sdev->skip_ms_page_8 = 1;
3547 + sdev->wce_default_on = 1;
3548 + }
3549 ++
3550 ++ /*
3551 ++ * Some disks return the total number of blocks in response
3552 ++ * to READ CAPACITY rather than the highest block number.
3553 ++ * If this device makes that mistake, tell the sd driver.
3554 ++ */
3555 ++ if (devinfo->flags & US_FL_FIX_CAPACITY)
3556 ++ sdev->fix_capacity = 1;
3557 ++
3558 ++ /*
3559 ++ * Some devices don't like MODE SENSE with page=0x3f,
3560 ++ * which is the command used for checking if a device
3561 ++ * is write-protected. Now that we tell the sd driver
3562 ++ * to do a 192-byte transfer with this command the
3563 ++ * majority of devices work fine, but a few still can't
3564 ++ * handle it. The sd driver will simply assume those
3565 ++ * devices are write-enabled.
3566 ++ */
3567 ++ if (devinfo->flags & US_FL_NO_WP_DETECT)
3568 ++ sdev->skip_ms_page_3f = 1;
3569 ++
3570 + scsi_change_queue_depth(sdev, devinfo->qdepth - 2);
3571 + return 0;
3572 + }
3573 +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
3574 +index d100290628bd..5e9b35a91431 100644
3575 +--- a/drivers/usb/storage/unusual_devs.h
3576 ++++ b/drivers/usb/storage/unusual_devs.h
3577 +@@ -2307,6 +2307,13 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
3578 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
3579 + US_FL_GO_SLOW ),
3580 +
3581 ++/* Reported-by: Tim Anderson <tsa@×××××××××××××××.com> */
3582 ++UNUSUAL_DEV( 0x2ca3, 0x0031, 0x0000, 0x9999,
3583 ++ "DJI",
3584 ++ "CineSSD",
3585 ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
3586 ++ US_FL_NO_ATA_1X),
3587 ++
3588 + /*
3589 + * Reported by Frederic Marchal <frederic.marchal@××××××××××.com>
3590 + * Mio Moov 330
3591 +diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c
3592 +index 2510fa728d77..de119f11b78f 100644
3593 +--- a/drivers/video/fbdev/core/modedb.c
3594 ++++ b/drivers/video/fbdev/core/modedb.c
3595 +@@ -644,7 +644,7 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
3596 + *
3597 + * Valid mode specifiers for @mode_option:
3598 + *
3599 +- * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] or
3600 ++ * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][p][m] or
3601 + * <name>[-<bpp>][@<refresh>]
3602 + *
3603 + * with <xres>, <yres>, <bpp> and <refresh> decimal numbers and
3604 +@@ -653,10 +653,10 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
3605 + * If 'M' is present after yres (and before refresh/bpp if present),
3606 + * the function will compute the timings using VESA(tm) Coordinated
3607 + * Video Timings (CVT). If 'R' is present after 'M', will compute with
3608 +- * reduced blanking (for flatpanels). If 'i' is present, compute
3609 +- * interlaced mode. If 'm' is present, add margins equal to 1.8%
3610 +- * of xres rounded down to 8 pixels, and 1.8% of yres. The char
3611 +- * 'i' and 'm' must be after 'M' and 'R'. Example:
3612 ++ * reduced blanking (for flatpanels). If 'i' or 'p' are present, compute
3613 ++ * interlaced or progressive mode. If 'm' is present, add margins equal
3614 ++ * to 1.8% of xres rounded down to 8 pixels, and 1.8% of yres. The chars
3615 ++ * 'i', 'p' and 'm' must be after 'M' and 'R'. Example:
3616 + *
3617 + * 1024x768MR-8@60m - Reduced blank with margins at 60Hz.
3618 + *
3619 +@@ -697,7 +697,8 @@ int fb_find_mode(struct fb_var_screeninfo *var,
3620 + unsigned int namelen = strlen(name);
3621 + int res_specified = 0, bpp_specified = 0, refresh_specified = 0;
3622 + unsigned int xres = 0, yres = 0, bpp = default_bpp, refresh = 0;
3623 +- int yres_specified = 0, cvt = 0, rb = 0, interlace = 0;
3624 ++ int yres_specified = 0, cvt = 0, rb = 0;
3625 ++ int interlace_specified = 0, interlace = 0;
3626 + int margins = 0;
3627 + u32 best, diff, tdiff;
3628 +
3629 +@@ -748,9 +749,17 @@ int fb_find_mode(struct fb_var_screeninfo *var,
3630 + if (!cvt)
3631 + margins = 1;
3632 + break;
3633 ++ case 'p':
3634 ++ if (!cvt) {
3635 ++ interlace = 0;
3636 ++ interlace_specified = 1;
3637 ++ }
3638 ++ break;
3639 + case 'i':
3640 +- if (!cvt)
3641 ++ if (!cvt) {
3642 + interlace = 1;
3643 ++ interlace_specified = 1;
3644 ++ }
3645 + break;
3646 + default:
3647 + goto done;
3648 +@@ -819,11 +828,21 @@ done:
3649 + if ((name_matches(db[i], name, namelen) ||
3650 + (res_specified && res_matches(db[i], xres, yres))) &&
3651 + !fb_try_mode(var, info, &db[i], bpp)) {
3652 +- if (refresh_specified && db[i].refresh == refresh)
3653 +- return 1;
3654 ++ const int db_interlace = (db[i].vmode &
3655 ++ FB_VMODE_INTERLACED ? 1 : 0);
3656 ++ int score = abs(db[i].refresh - refresh);
3657 ++
3658 ++ if (interlace_specified)
3659 ++ score += abs(db_interlace - interlace);
3660 ++
3661 ++ if (!interlace_specified ||
3662 ++ db_interlace == interlace)
3663 ++ if (refresh_specified &&
3664 ++ db[i].refresh == refresh)
3665 ++ return 1;
3666 +
3667 +- if (abs(db[i].refresh - refresh) < diff) {
3668 +- diff = abs(db[i].refresh - refresh);
3669 ++ if (score < diff) {
3670 ++ diff = score;
3671 + best = i;
3672 + }
3673 + }
3674 +diff --git a/drivers/video/fbdev/goldfishfb.c b/drivers/video/fbdev/goldfishfb.c
3675 +index 7f6c9e6cfc6c..14a93cb21310 100644
3676 +--- a/drivers/video/fbdev/goldfishfb.c
3677 ++++ b/drivers/video/fbdev/goldfishfb.c
3678 +@@ -301,6 +301,7 @@ static int goldfish_fb_remove(struct platform_device *pdev)
3679 + dma_free_coherent(&pdev->dev, framesize, (void *)fb->fb.screen_base,
3680 + fb->fb.fix.smem_start);
3681 + iounmap(fb->reg_base);
3682 ++ kfree(fb);
3683 + return 0;
3684 + }
3685 +
3686 +diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c
3687 +index 3479a47a3082..0eee8a29d28d 100644
3688 +--- a/drivers/video/fbdev/omap/omapfb_main.c
3689 ++++ b/drivers/video/fbdev/omap/omapfb_main.c
3690 +@@ -958,7 +958,7 @@ int omapfb_register_client(struct omapfb_notifier_block *omapfb_nb,
3691 + {
3692 + int r;
3693 +
3694 +- if ((unsigned)omapfb_nb->plane_idx > OMAPFB_PLANE_NUM)
3695 ++ if ((unsigned)omapfb_nb->plane_idx >= OMAPFB_PLANE_NUM)
3696 + return -EINVAL;
3697 +
3698 + if (!notifier_inited) {
3699 +diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
3700 +index c3d49e13643c..29f00eccdd01 100644
3701 +--- a/drivers/video/fbdev/pxafb.c
3702 ++++ b/drivers/video/fbdev/pxafb.c
3703 +@@ -2130,8 +2130,8 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
3704 + return -EINVAL;
3705 +
3706 + ret = -ENOMEM;
3707 +- info->modes = kmalloc_array(timings->num_timings,
3708 +- sizeof(info->modes[0]), GFP_KERNEL);
3709 ++ info->modes = kcalloc(timings->num_timings, sizeof(info->modes[0]),
3710 ++ GFP_KERNEL);
3711 + if (!info->modes)
3712 + goto out;
3713 + info->num_modes = timings->num_timings;
3714 +diff --git a/drivers/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c
3715 +index badee04ef496..71b5dca95bdb 100644
3716 +--- a/drivers/video/fbdev/via/viafbdev.c
3717 ++++ b/drivers/video/fbdev/via/viafbdev.c
3718 +@@ -19,6 +19,7 @@
3719 + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3720 + */
3721 +
3722 ++#include <linux/compiler.h>
3723 + #include <linux/module.h>
3724 + #include <linux/seq_file.h>
3725 + #include <linux/slab.h>
3726 +@@ -1468,7 +1469,7 @@ static const struct file_operations viafb_vt1636_proc_fops = {
3727 +
3728 + #endif /* CONFIG_FB_VIA_DIRECT_PROCFS */
3729 +
3730 +-static int viafb_sup_odev_proc_show(struct seq_file *m, void *v)
3731 ++static int __maybe_unused viafb_sup_odev_proc_show(struct seq_file *m, void *v)
3732 + {
3733 + via_odev_to_seq(m, supported_odev_map[
3734 + viaparinfo->shared->chip_info.gfx_chip_name]);
3735 +diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
3736 +index c0e3f91e28e9..469666df91da 100644
3737 +--- a/fs/binfmt_elf.c
3738 ++++ b/fs/binfmt_elf.c
3739 +@@ -1725,7 +1725,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
3740 + const struct user_regset *regset = &view->regsets[i];
3741 + do_thread_regset_writeback(t->task, regset);
3742 + if (regset->core_note_type && regset->get &&
3743 +- (!regset->active || regset->active(t->task, regset))) {
3744 ++ (!regset->active || regset->active(t->task, regset) > 0)) {
3745 + int ret;
3746 + size_t size = regset->n * regset->size;
3747 + void *data = kmalloc(size, GFP_KERNEL);
3748 +diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
3749 +index a27fc8791551..ef24b4527459 100644
3750 +--- a/fs/cifs/readdir.c
3751 ++++ b/fs/cifs/readdir.c
3752 +@@ -376,8 +376,15 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
3753 +
3754 + new_entry = old_entry + sizeof(FIND_FILE_STANDARD_INFO) +
3755 + pfData->FileNameLength;
3756 +- } else
3757 +- new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset);
3758 ++ } else {
3759 ++ u32 next_offset = le32_to_cpu(pDirInfo->NextEntryOffset);
3760 ++
3761 ++ if (old_entry + next_offset < old_entry) {
3762 ++ cifs_dbg(VFS, "invalid offset %u\n", next_offset);
3763 ++ return NULL;
3764 ++ }
3765 ++ new_entry = old_entry + next_offset;
3766 ++ }
3767 + cifs_dbg(FYI, "new entry %p old entry %p\n", new_entry, old_entry);
3768 + /* validate that new_entry is not past end of SMB */
3769 + if (new_entry >= end_of_smb) {
3770 +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
3771 +index 078ec705a5cc..69309538ffb8 100644
3772 +--- a/fs/cifs/smb2pdu.c
3773 ++++ b/fs/cifs/smb2pdu.c
3774 +@@ -2939,33 +2939,38 @@ num_entries(char *bufstart, char *end_of_buf, char **lastentry, size_t size)
3775 + int len;
3776 + unsigned int entrycount = 0;
3777 + unsigned int next_offset = 0;
3778 +- FILE_DIRECTORY_INFO *entryptr;
3779 ++ char *entryptr;
3780 ++ FILE_DIRECTORY_INFO *dir_info;
3781 +
3782 + if (bufstart == NULL)
3783 + return 0;
3784 +
3785 +- entryptr = (FILE_DIRECTORY_INFO *)bufstart;
3786 ++ entryptr = bufstart;
3787 +
3788 + while (1) {
3789 +- entryptr = (FILE_DIRECTORY_INFO *)
3790 +- ((char *)entryptr + next_offset);
3791 +-
3792 +- if ((char *)entryptr + size > end_of_buf) {
3793 ++ if (entryptr + next_offset < entryptr ||
3794 ++ entryptr + next_offset > end_of_buf ||
3795 ++ entryptr + next_offset + size > end_of_buf) {
3796 + cifs_dbg(VFS, "malformed search entry would overflow\n");
3797 + break;
3798 + }
3799 +
3800 +- len = le32_to_cpu(entryptr->FileNameLength);
3801 +- if ((char *)entryptr + len + size > end_of_buf) {
3802 ++ entryptr = entryptr + next_offset;
3803 ++ dir_info = (FILE_DIRECTORY_INFO *)entryptr;
3804 ++
3805 ++ len = le32_to_cpu(dir_info->FileNameLength);
3806 ++ if (entryptr + len < entryptr ||
3807 ++ entryptr + len > end_of_buf ||
3808 ++ entryptr + len + size > end_of_buf) {
3809 + cifs_dbg(VFS, "directory entry name would overflow frame end of buf %p\n",
3810 + end_of_buf);
3811 + break;
3812 + }
3813 +
3814 +- *lastentry = (char *)entryptr;
3815 ++ *lastentry = entryptr;
3816 + entrycount++;
3817 +
3818 +- next_offset = le32_to_cpu(entryptr->NextEntryOffset);
3819 ++ next_offset = le32_to_cpu(dir_info->NextEntryOffset);
3820 + if (!next_offset)
3821 + break;
3822 + }
3823 +diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
3824 +index 56fb26127fef..d2a1a79fa324 100644
3825 +--- a/fs/configfs/dir.c
3826 ++++ b/fs/configfs/dir.c
3827 +@@ -1777,6 +1777,16 @@ void configfs_unregister_group(struct config_group *group)
3828 + struct dentry *dentry = group->cg_item.ci_dentry;
3829 + struct dentry *parent = group->cg_item.ci_parent->ci_dentry;
3830 +
3831 ++ mutex_lock(&subsys->su_mutex);
3832 ++ if (!group->cg_item.ci_parent->ci_group) {
3833 ++ /*
3834 ++ * The parent has already been unlinked and detached
3835 ++ * due to a rmdir.
3836 ++ */
3837 ++ goto unlink_group;
3838 ++ }
3839 ++ mutex_unlock(&subsys->su_mutex);
3840 ++
3841 + inode_lock_nested(d_inode(parent), I_MUTEX_PARENT);
3842 + spin_lock(&configfs_dirent_lock);
3843 + configfs_detach_prep(dentry, NULL);
3844 +@@ -1791,6 +1801,7 @@ void configfs_unregister_group(struct config_group *group)
3845 + dput(dentry);
3846 +
3847 + mutex_lock(&subsys->su_mutex);
3848 ++unlink_group:
3849 + unlink_group(group);
3850 + mutex_unlock(&subsys->su_mutex);
3851 + }
3852 +diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
3853 +index 3dd0cceefa43..bc8787718feb 100644
3854 +--- a/fs/gfs2/bmap.c
3855 ++++ b/fs/gfs2/bmap.c
3856 +@@ -1680,7 +1680,7 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
3857 + end_of_file = (i_size_read(&ip->i_inode) + sdp->sd_sb.sb_bsize - 1) >> shift;
3858 + lblock = offset >> shift;
3859 + lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
3860 +- if (lblock_stop > end_of_file)
3861 ++ if (lblock_stop > end_of_file && ip != GFS2_I(sdp->sd_rindex))
3862 + return 1;
3863 +
3864 + size = (lblock_stop - lblock) << shift;
3865 +diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
3866 +index 95b2a57ded33..5fe033131f03 100644
3867 +--- a/fs/gfs2/rgrp.c
3868 ++++ b/fs/gfs2/rgrp.c
3869 +@@ -1665,7 +1665,8 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
3870 +
3871 + while(1) {
3872 + bi = rbm_bi(rbm);
3873 +- if (test_bit(GBF_FULL, &bi->bi_flags) &&
3874 ++ if ((ip == NULL || !gfs2_rs_active(&ip->i_res)) &&
3875 ++ test_bit(GBF_FULL, &bi->bi_flags) &&
3876 + (state == GFS2_BLKST_FREE))
3877 + goto next_bitmap;
3878 +
3879 +diff --git a/fs/namespace.c b/fs/namespace.c
3880 +index 9dc146e7b5e0..3ee3ee5819bc 100644
3881 +--- a/fs/namespace.c
3882 ++++ b/fs/namespace.c
3883 +@@ -446,10 +446,10 @@ int mnt_want_write_file_path(struct file *file)
3884 + {
3885 + int ret;
3886 +
3887 +- sb_start_write(file->f_path.mnt->mnt_sb);
3888 ++ sb_start_write(file_inode(file)->i_sb);
3889 + ret = __mnt_want_write_file(file);
3890 + if (ret)
3891 +- sb_end_write(file->f_path.mnt->mnt_sb);
3892 ++ sb_end_write(file_inode(file)->i_sb);
3893 + return ret;
3894 + }
3895 +
3896 +@@ -540,7 +540,8 @@ void __mnt_drop_write_file(struct file *file)
3897 +
3898 + void mnt_drop_write_file_path(struct file *file)
3899 + {
3900 +- mnt_drop_write(file->f_path.mnt);
3901 ++ __mnt_drop_write_file(file);
3902 ++ sb_end_write(file_inode(file)->i_sb);
3903 + }
3904 +
3905 + void mnt_drop_write_file(struct file *file)
3906 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
3907 +index 77c7d29fcd3b..a3b67d3b1dfb 100644
3908 +--- a/fs/nfs/nfs4proc.c
3909 ++++ b/fs/nfs/nfs4proc.c
3910 +@@ -2533,14 +2533,18 @@ static void nfs41_check_delegation_stateid(struct nfs4_state *state)
3911 + }
3912 +
3913 + nfs4_stateid_copy(&stateid, &delegation->stateid);
3914 +- if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags) ||
3915 +- !test_and_clear_bit(NFS_DELEGATION_TEST_EXPIRED,
3916 +- &delegation->flags)) {
3917 ++ if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) {
3918 + rcu_read_unlock();
3919 + nfs_finish_clear_delegation_stateid(state, &stateid);
3920 + return;
3921 + }
3922 +
3923 ++ if (!test_and_clear_bit(NFS_DELEGATION_TEST_EXPIRED,
3924 ++ &delegation->flags)) {
3925 ++ rcu_read_unlock();
3926 ++ return;
3927 ++ }
3928 ++
3929 + cred = get_rpccred(delegation->cred);
3930 + rcu_read_unlock();
3931 + status = nfs41_test_and_free_expired_stateid(server, &stateid, cred);
3932 +diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
3933 +index 45873ed92057..e1d88bca815e 100644
3934 +--- a/fs/nfs/nfs4state.c
3935 ++++ b/fs/nfs/nfs4state.c
3936 +@@ -1354,6 +1354,8 @@ int nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4_
3937 +
3938 + if (!nfs4_state_mark_reclaim_nograce(clp, state))
3939 + return -EBADF;
3940 ++ nfs_inode_find_delegation_state_and_recover(state->inode,
3941 ++ &state->stateid);
3942 + dprintk("%s: scheduling stateid recovery for server %s\n", __func__,
3943 + clp->cl_hostname);
3944 + nfs4_schedule_state_manager(clp);
3945 +diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
3946 +index e11672aa4575..ecdb3baa1283 100644
3947 +--- a/fs/pstore/ram_core.c
3948 ++++ b/fs/pstore/ram_core.c
3949 +@@ -421,7 +421,12 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size,
3950 + vaddr = vmap(pages, page_count, VM_MAP, prot);
3951 + kfree(pages);
3952 +
3953 +- return vaddr;
3954 ++ /*
3955 ++ * Since vmap() uses page granularity, we must add the offset
3956 ++ * into the page here, to get the byte granularity address
3957 ++ * into the mapping to represent the actual "start" location.
3958 ++ */
3959 ++ return vaddr + offset_in_page(start);
3960 + }
3961 +
3962 + static void *persistent_ram_iomap(phys_addr_t start, size_t size,
3963 +@@ -440,6 +445,11 @@ static void *persistent_ram_iomap(phys_addr_t start, size_t size,
3964 + else
3965 + va = ioremap_wc(start, size);
3966 +
3967 ++ /*
3968 ++ * Since request_mem_region() and ioremap() are byte-granularity
3969 ++ * there is no need handle anything special like we do when the
3970 ++ * vmap() case in persistent_ram_vmap() above.
3971 ++ */
3972 + return va;
3973 + }
3974 +
3975 +@@ -460,7 +470,7 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size,
3976 + return -ENOMEM;
3977 + }
3978 +
3979 +- prz->buffer = prz->vaddr + offset_in_page(start);
3980 ++ prz->buffer = prz->vaddr;
3981 + prz->buffer_size = size - sizeof(struct persistent_ram_buffer);
3982 +
3983 + return 0;
3984 +@@ -507,7 +517,8 @@ void persistent_ram_free(struct persistent_ram_zone *prz)
3985 +
3986 + if (prz->vaddr) {
3987 + if (pfn_valid(prz->paddr >> PAGE_SHIFT)) {
3988 +- vunmap(prz->vaddr);
3989 ++ /* We must vunmap() at page-granularity. */
3990 ++ vunmap(prz->vaddr - offset_in_page(prz->paddr));
3991 + } else {
3992 + iounmap(prz->vaddr);
3993 + release_mem_region(prz->paddr, prz->size);
3994 +diff --git a/include/linux/crypto.h b/include/linux/crypto.h
3995 +index cc36484d29e1..de96913306cb 100644
3996 +--- a/include/linux/crypto.h
3997 ++++ b/include/linux/crypto.h
3998 +@@ -111,6 +111,11 @@
3999 + */
4000 + #define CRYPTO_ALG_OPTIONAL_KEY 0x00004000
4001 +
4002 ++/*
4003 ++ * Don't trigger module loading
4004 ++ */
4005 ++#define CRYPTO_NOLOAD 0x00008000
4006 ++
4007 + /*
4008 + * Transform masks and values (for crt_flags).
4009 + */
4010 +diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
4011 +index f2f9e957bf1b..c4d19e77fea8 100644
4012 +--- a/include/linux/mlx5/driver.h
4013 ++++ b/include/linux/mlx5/driver.h
4014 +@@ -950,7 +950,7 @@ int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn);
4015 + void mlx5_health_cleanup(struct mlx5_core_dev *dev);
4016 + int mlx5_health_init(struct mlx5_core_dev *dev);
4017 + void mlx5_start_health_poll(struct mlx5_core_dev *dev);
4018 +-void mlx5_stop_health_poll(struct mlx5_core_dev *dev);
4019 ++void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health);
4020 + void mlx5_drain_health_wq(struct mlx5_core_dev *dev);
4021 + void mlx5_trigger_health_work(struct mlx5_core_dev *dev);
4022 + void mlx5_drain_health_recovery(struct mlx5_core_dev *dev);
4023 +diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
4024 +index 9eb8b3511636..4a98f6e314a9 100644
4025 +--- a/kernel/audit_watch.c
4026 ++++ b/kernel/audit_watch.c
4027 +@@ -419,6 +419,13 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
4028 + struct path parent_path;
4029 + int h, ret = 0;
4030 +
4031 ++ /*
4032 ++ * When we will be calling audit_add_to_parent, krule->watch might have
4033 ++ * been updated and watch might have been freed.
4034 ++ * So we need to keep a reference of watch.
4035 ++ */
4036 ++ audit_get_watch(watch);
4037 ++
4038 + mutex_unlock(&audit_filter_mutex);
4039 +
4040 + /* Avoid calling path_lookup under audit_filter_mutex. */
4041 +@@ -427,8 +434,10 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
4042 + /* caller expects mutex locked */
4043 + mutex_lock(&audit_filter_mutex);
4044 +
4045 +- if (ret)
4046 ++ if (ret) {
4047 ++ audit_put_watch(watch);
4048 + return ret;
4049 ++ }
4050 +
4051 + /* either find an old parent or attach a new one */
4052 + parent = audit_find_parent(d_backing_inode(parent_path.dentry));
4053 +@@ -446,6 +455,7 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
4054 + *list = &audit_inode_hash[h];
4055 + error:
4056 + path_put(&parent_path);
4057 ++ audit_put_watch(watch);
4058 + return ret;
4059 + }
4060 +
4061 +diff --git a/kernel/events/core.c b/kernel/events/core.c
4062 +index 7c394ddf1ce6..812ebf1cbb87 100644
4063 +--- a/kernel/events/core.c
4064 ++++ b/kernel/events/core.c
4065 +@@ -5700,6 +5700,7 @@ perf_output_sample_ustack(struct perf_output_handle *handle, u64 dump_size,
4066 + unsigned long sp;
4067 + unsigned int rem;
4068 + u64 dyn_size;
4069 ++ mm_segment_t fs;
4070 +
4071 + /*
4072 + * We dump:
4073 +@@ -5717,7 +5718,10 @@ perf_output_sample_ustack(struct perf_output_handle *handle, u64 dump_size,
4074 +
4075 + /* Data. */
4076 + sp = perf_user_stack_pointer(regs);
4077 ++ fs = get_fs();
4078 ++ set_fs(USER_DS);
4079 + rem = __output_copy_user(handle, (void *) sp, dump_size);
4080 ++ set_fs(fs);
4081 + dyn_size = dump_size - rem;
4082 +
4083 + perf_output_skip(handle, rem);
4084 +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
4085 +index 0cc7098c6dfd..a5e20ceb0b5a 100644
4086 +--- a/kernel/sched/fair.c
4087 ++++ b/kernel/sched/fair.c
4088 +@@ -757,11 +757,12 @@ static void attach_entity_cfs_rq(struct sched_entity *se);
4089 + * To solve this problem, we also cap the util_avg of successive tasks to
4090 + * only 1/2 of the left utilization budget:
4091 + *
4092 +- * util_avg_cap = (1024 - cfs_rq->avg.util_avg) / 2^n
4093 ++ * util_avg_cap = (cpu_scale - cfs_rq->avg.util_avg) / 2^n
4094 + *
4095 +- * where n denotes the nth task.
4096 ++ * where n denotes the nth task and cpu_scale the CPU capacity.
4097 + *
4098 +- * For example, a simplest series from the beginning would be like:
4099 ++ * For example, for a CPU with 1024 of capacity, a simplest series from
4100 ++ * the beginning would be like:
4101 + *
4102 + * task util_avg: 512, 256, 128, 64, 32, 16, 8, ...
4103 + * cfs_rq util_avg: 512, 768, 896, 960, 992, 1008, 1016, ...
4104 +@@ -773,7 +774,8 @@ void post_init_entity_util_avg(struct sched_entity *se)
4105 + {
4106 + struct cfs_rq *cfs_rq = cfs_rq_of(se);
4107 + struct sched_avg *sa = &se->avg;
4108 +- long cap = (long)(SCHED_CAPACITY_SCALE - cfs_rq->avg.util_avg) / 2;
4109 ++ long cpu_scale = arch_scale_cpu_capacity(NULL, cpu_of(rq_of(cfs_rq)));
4110 ++ long cap = (long)(cpu_scale - cfs_rq->avg.util_avg) / 2;
4111 +
4112 + if (cap > 0) {
4113 + if (cfs_rq->avg.util_avg != 0) {
4114 +diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
4115 +index 929ecb7d6b78..e29608464382 100644
4116 +--- a/kernel/sched/wait.c
4117 ++++ b/kernel/sched/wait.c
4118 +@@ -395,35 +395,36 @@ static inline bool is_kthread_should_stop(void)
4119 + * if (condition)
4120 + * break;
4121 + *
4122 +- * p->state = mode; condition = true;
4123 +- * smp_mb(); // A smp_wmb(); // C
4124 +- * if (!wq_entry->flags & WQ_FLAG_WOKEN) wq_entry->flags |= WQ_FLAG_WOKEN;
4125 +- * schedule() try_to_wake_up();
4126 +- * p->state = TASK_RUNNING; ~~~~~~~~~~~~~~~~~~
4127 +- * wq_entry->flags &= ~WQ_FLAG_WOKEN; condition = true;
4128 +- * smp_mb() // B smp_wmb(); // C
4129 +- * wq_entry->flags |= WQ_FLAG_WOKEN;
4130 +- * }
4131 +- * remove_wait_queue(&wq_head, &wait);
4132 ++ * // in wait_woken() // in woken_wake_function()
4133 + *
4134 ++ * p->state = mode; wq_entry->flags |= WQ_FLAG_WOKEN;
4135 ++ * smp_mb(); // A try_to_wake_up():
4136 ++ * if (!(wq_entry->flags & WQ_FLAG_WOKEN)) <full barrier>
4137 ++ * schedule() if (p->state & mode)
4138 ++ * p->state = TASK_RUNNING; p->state = TASK_RUNNING;
4139 ++ * wq_entry->flags &= ~WQ_FLAG_WOKEN; ~~~~~~~~~~~~~~~~~~
4140 ++ * smp_mb(); // B condition = true;
4141 ++ * } smp_mb(); // C
4142 ++ * remove_wait_queue(&wq_head, &wait); wq_entry->flags |= WQ_FLAG_WOKEN;
4143 + */
4144 + long wait_woken(struct wait_queue_entry *wq_entry, unsigned mode, long timeout)
4145 + {
4146 +- set_current_state(mode); /* A */
4147 + /*
4148 +- * The above implies an smp_mb(), which matches with the smp_wmb() from
4149 +- * woken_wake_function() such that if we observe WQ_FLAG_WOKEN we must
4150 +- * also observe all state before the wakeup.
4151 ++ * The below executes an smp_mb(), which matches with the full barrier
4152 ++ * executed by the try_to_wake_up() in woken_wake_function() such that
4153 ++ * either we see the store to wq_entry->flags in woken_wake_function()
4154 ++ * or woken_wake_function() sees our store to current->state.
4155 + */
4156 ++ set_current_state(mode); /* A */
4157 + if (!(wq_entry->flags & WQ_FLAG_WOKEN) && !is_kthread_should_stop())
4158 + timeout = schedule_timeout(timeout);
4159 + __set_current_state(TASK_RUNNING);
4160 +
4161 + /*
4162 +- * The below implies an smp_mb(), it too pairs with the smp_wmb() from
4163 +- * woken_wake_function() such that we must either observe the wait
4164 +- * condition being true _OR_ WQ_FLAG_WOKEN such that we will not miss
4165 +- * an event.
4166 ++ * The below executes an smp_mb(), which matches with the smp_mb() (C)
4167 ++ * in woken_wake_function() such that either we see the wait condition
4168 ++ * being true or the store to wq_entry->flags in woken_wake_function()
4169 ++ * follows ours in the coherence order.
4170 + */
4171 + smp_store_mb(wq_entry->flags, wq_entry->flags & ~WQ_FLAG_WOKEN); /* B */
4172 +
4173 +@@ -433,14 +434,8 @@ EXPORT_SYMBOL(wait_woken);
4174 +
4175 + int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key)
4176 + {
4177 +- /*
4178 +- * Although this function is called under waitqueue lock, LOCK
4179 +- * doesn't imply write barrier and the users expects write
4180 +- * barrier semantics on wakeup functions. The following
4181 +- * smp_wmb() is equivalent to smp_wmb() in try_to_wake_up()
4182 +- * and is paired with smp_store_mb() in wait_woken().
4183 +- */
4184 +- smp_wmb(); /* C */
4185 ++ /* Pairs with the smp_store_mb() in wait_woken(). */
4186 ++ smp_mb(); /* C */
4187 + wq_entry->flags |= WQ_FLAG_WOKEN;
4188 +
4189 + return default_wake_function(wq_entry, mode, sync, key);
4190 +diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
4191 +index 91e3ba280706..583951e82cee 100644
4192 +--- a/net/bluetooth/af_bluetooth.c
4193 ++++ b/net/bluetooth/af_bluetooth.c
4194 +@@ -159,7 +159,7 @@ void bt_accept_enqueue(struct sock *parent, struct sock *sk)
4195 + BT_DBG("parent %p, sk %p", parent, sk);
4196 +
4197 + sock_hold(sk);
4198 +- lock_sock(sk);
4199 ++ lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
4200 + list_add_tail(&bt_sk(sk)->accept_q, &bt_sk(parent)->accept_q);
4201 + bt_sk(sk)->parent = parent;
4202 + release_sock(sk);
4203 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
4204 +index 168a3e8883d4..9f80b947f53b 100644
4205 +--- a/net/core/skbuff.c
4206 ++++ b/net/core/skbuff.c
4207 +@@ -937,9 +937,6 @@ struct ubuf_info *sock_zerocopy_alloc(struct sock *sk, size_t size)
4208 +
4209 + WARN_ON_ONCE(!in_task());
4210 +
4211 +- if (!sock_flag(sk, SOCK_ZEROCOPY))
4212 +- return NULL;
4213 +-
4214 + skb = sock_omalloc(sk, 0, GFP_KERNEL);
4215 + if (!skb)
4216 + return NULL;
4217 +diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
4218 +index 2459e9cc22a6..dd3bcf22fe8b 100644
4219 +--- a/net/ipv4/ip_gre.c
4220 ++++ b/net/ipv4/ip_gre.c
4221 +@@ -177,6 +177,8 @@ static void ipgre_err(struct sk_buff *skb, u32 info,
4222 +
4223 + if (tpi->proto == htons(ETH_P_TEB))
4224 + itn = net_generic(net, gre_tap_net_id);
4225 ++ else if (tpi->proto == htons(ETH_P_ERSPAN))
4226 ++ itn = net_generic(net, erspan_net_id);
4227 + else
4228 + itn = net_generic(net, ipgre_net_id);
4229 +
4230 +@@ -320,6 +322,8 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
4231 + ip_tunnel_rcv(tunnel, skb, tpi, tun_dst, log_ecn_error);
4232 + return PACKET_RCVD;
4233 + }
4234 ++ return PACKET_REJECT;
4235 ++
4236 + drop:
4237 + kfree_skb(skb);
4238 + return PACKET_RCVD;
4239 +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
4240 +index 7462ec7587ce..f9c985460faa 100644
4241 +--- a/net/ipv4/tcp.c
4242 ++++ b/net/ipv4/tcp.c
4243 +@@ -1177,7 +1177,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
4244 +
4245 + flags = msg->msg_flags;
4246 +
4247 +- if (flags & MSG_ZEROCOPY && size) {
4248 ++ if (flags & MSG_ZEROCOPY && size && sock_flag(sk, SOCK_ZEROCOPY)) {
4249 + if (sk->sk_state != TCP_ESTABLISHED) {
4250 + err = -EINVAL;
4251 + goto out_err;
4252 +diff --git a/net/ipv6/route.c b/net/ipv6/route.c
4253 +index 60efd326014b..30204bc2fc48 100644
4254 +--- a/net/ipv6/route.c
4255 ++++ b/net/ipv6/route.c
4256 +@@ -3239,11 +3239,16 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
4257 +
4258 + err_nh = NULL;
4259 + list_for_each_entry(nh, &rt6_nh_list, next) {
4260 +- rt_last = nh->rt6_info;
4261 + err = __ip6_ins_rt(nh->rt6_info, info, &nh->mxc, extack);
4262 +- /* save reference to first route for notification */
4263 +- if (!rt_notif && !err)
4264 +- rt_notif = nh->rt6_info;
4265 ++
4266 ++ if (!err) {
4267 ++ /* save reference to last route successfully inserted */
4268 ++ rt_last = nh->rt6_info;
4269 ++
4270 ++ /* save reference to first route for notification */
4271 ++ if (!rt_notif)
4272 ++ rt_notif = nh->rt6_info;
4273 ++ }
4274 +
4275 + /* nh->rt6_info is used or freed at this point, reset to NULL*/
4276 + nh->rt6_info = NULL;
4277 +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
4278 +index 288640471c2f..b456b882a6ea 100644
4279 +--- a/net/mac80211/cfg.c
4280 ++++ b/net/mac80211/cfg.c
4281 +@@ -494,7 +494,7 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
4282 + goto out_unlock;
4283 + }
4284 +
4285 +- ieee80211_key_free(key, true);
4286 ++ ieee80211_key_free(key, sdata->vif.type == NL80211_IFTYPE_STATION);
4287 +
4288 + ret = 0;
4289 + out_unlock:
4290 +diff --git a/net/mac80211/key.c b/net/mac80211/key.c
4291 +index 938049395f90..fa10c6142244 100644
4292 +--- a/net/mac80211/key.c
4293 ++++ b/net/mac80211/key.c
4294 +@@ -649,11 +649,15 @@ int ieee80211_key_link(struct ieee80211_key *key,
4295 + {
4296 + struct ieee80211_local *local = sdata->local;
4297 + struct ieee80211_key *old_key;
4298 +- int idx, ret;
4299 +- bool pairwise;
4300 +-
4301 +- pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
4302 +- idx = key->conf.keyidx;
4303 ++ int idx = key->conf.keyidx;
4304 ++ bool pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
4305 ++ /*
4306 ++ * We want to delay tailroom updates only for station - in that
4307 ++ * case it helps roaming speed, but in other cases it hurts and
4308 ++ * can cause warnings to appear.
4309 ++ */
4310 ++ bool delay_tailroom = sdata->vif.type == NL80211_IFTYPE_STATION;
4311 ++ int ret;
4312 +
4313 + mutex_lock(&sdata->local->key_mtx);
4314 +
4315 +@@ -681,14 +685,14 @@ int ieee80211_key_link(struct ieee80211_key *key,
4316 + increment_tailroom_need_count(sdata);
4317 +
4318 + ieee80211_key_replace(sdata, sta, pairwise, old_key, key);
4319 +- ieee80211_key_destroy(old_key, true);
4320 ++ ieee80211_key_destroy(old_key, delay_tailroom);
4321 +
4322 + ieee80211_debugfs_key_add(key);
4323 +
4324 + if (!local->wowlan) {
4325 + ret = ieee80211_key_enable_hw_accel(key);
4326 + if (ret)
4327 +- ieee80211_key_free(key, true);
4328 ++ ieee80211_key_free(key, delay_tailroom);
4329 + } else {
4330 + ret = 0;
4331 + }
4332 +@@ -923,7 +927,8 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local,
4333 + ieee80211_key_replace(key->sdata, key->sta,
4334 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE,
4335 + key, NULL);
4336 +- __ieee80211_key_destroy(key, true);
4337 ++ __ieee80211_key_destroy(key, key->sdata->vif.type ==
4338 ++ NL80211_IFTYPE_STATION);
4339 + }
4340 +
4341 + for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
4342 +@@ -933,7 +938,8 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local,
4343 + ieee80211_key_replace(key->sdata, key->sta,
4344 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE,
4345 + key, NULL);
4346 +- __ieee80211_key_destroy(key, true);
4347 ++ __ieee80211_key_destroy(key, key->sdata->vif.type ==
4348 ++ NL80211_IFTYPE_STATION);
4349 + }
4350 +
4351 + mutex_unlock(&local->key_mtx);
4352 +diff --git a/net/rds/bind.c b/net/rds/bind.c
4353 +index 5aa3a64aa4f0..48257d3a4201 100644
4354 +--- a/net/rds/bind.c
4355 ++++ b/net/rds/bind.c
4356 +@@ -60,11 +60,13 @@ struct rds_sock *rds_find_bound(__be32 addr, __be16 port)
4357 + u64 key = ((u64)addr << 32) | port;
4358 + struct rds_sock *rs;
4359 +
4360 +- rs = rhashtable_lookup_fast(&bind_hash_table, &key, ht_parms);
4361 ++ rcu_read_lock();
4362 ++ rs = rhashtable_lookup(&bind_hash_table, &key, ht_parms);
4363 + if (rs && !sock_flag(rds_rs_to_sk(rs), SOCK_DEAD))
4364 + rds_sock_addref(rs);
4365 + else
4366 + rs = NULL;
4367 ++ rcu_read_unlock();
4368 +
4369 + rdsdebug("returning rs %p for %pI4:%u\n", rs, &addr,
4370 + ntohs(port));
4371 +@@ -157,6 +159,7 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
4372 + goto out;
4373 + }
4374 +
4375 ++ sock_set_flag(sk, SOCK_RCU_FREE);
4376 + ret = rds_add_bound(rs, sin->sin_addr.s_addr, &sin->sin_port);
4377 + if (ret)
4378 + goto out;
4379 +diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
4380 +index fb79caf56d0e..b81aa6d7dc45 100644
4381 +--- a/net/tls/tls_sw.c
4382 ++++ b/net/tls/tls_sw.c
4383 +@@ -170,6 +170,9 @@ static int alloc_encrypted_sg(struct sock *sk, int len)
4384 + rc = alloc_sg(sk, len, ctx->sg_encrypted_data,
4385 + &ctx->sg_encrypted_num_elem, &ctx->sg_encrypted_size, 0);
4386 +
4387 ++ if (rc == -ENOSPC)
4388 ++ ctx->sg_encrypted_num_elem = ARRAY_SIZE(ctx->sg_encrypted_data);
4389 ++
4390 + return rc;
4391 + }
4392 +
4393 +@@ -183,6 +186,9 @@ static int alloc_plaintext_sg(struct sock *sk, int len)
4394 + &ctx->sg_plaintext_num_elem, &ctx->sg_plaintext_size,
4395 + tls_ctx->pending_open_record_frags);
4396 +
4397 ++ if (rc == -ENOSPC)
4398 ++ ctx->sg_plaintext_num_elem = ARRAY_SIZE(ctx->sg_plaintext_data);
4399 ++
4400 + return rc;
4401 + }
4402 +
4403 +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
4404 +index a6c0027cadb5..2fb7a78308e1 100644
4405 +--- a/net/xfrm/xfrm_policy.c
4406 ++++ b/net/xfrm/xfrm_policy.c
4407 +@@ -1831,7 +1831,10 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols,
4408 + /* Try to instantiate a bundle */
4409 + err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family);
4410 + if (err <= 0) {
4411 +- if (err != 0 && err != -EAGAIN)
4412 ++ if (err == 0)
4413 ++ return NULL;
4414 ++
4415 ++ if (err != -EAGAIN)
4416 + XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
4417 + return ERR_PTR(err);
4418 + }
4419 +diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
4420 +index fcbbecf92395..a0ad87e869f9 100644
4421 +--- a/scripts/Kbuild.include
4422 ++++ b/scripts/Kbuild.include
4423 +@@ -403,3 +403,6 @@ endif
4424 + endef
4425 + #
4426 + ###############################################################################
4427 ++
4428 ++# delete partially updated (i.e. corrupted) files on error
4429 ++.DELETE_ON_ERROR:
4430 +diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
4431 +index 1d32cd20009a..ee9c3de5065a 100644
4432 +--- a/security/integrity/evm/evm_crypto.c
4433 ++++ b/security/integrity/evm/evm_crypto.c
4434 +@@ -94,7 +94,8 @@ static struct shash_desc *init_desc(char type)
4435 + mutex_lock(&mutex);
4436 + if (*tfm)
4437 + goto out;
4438 +- *tfm = crypto_alloc_shash(algo, 0, CRYPTO_ALG_ASYNC);
4439 ++ *tfm = crypto_alloc_shash(algo, 0,
4440 ++ CRYPTO_ALG_ASYNC | CRYPTO_NOLOAD);
4441 + if (IS_ERR(*tfm)) {
4442 + rc = PTR_ERR(*tfm);
4443 + pr_err("Can not allocate %s (reason: %ld)\n", algo, rc);
4444 +diff --git a/security/security.c b/security/security.c
4445 +index 4bf0f571b4ef..95a1a0f52880 100644
4446 +--- a/security/security.c
4447 ++++ b/security/security.c
4448 +@@ -111,6 +111,8 @@ static int lsm_append(char *new, char **result)
4449 +
4450 + if (*result == NULL) {
4451 + *result = kstrdup(new, GFP_KERNEL);
4452 ++ if (*result == NULL)
4453 ++ return -ENOMEM;
4454 + } else {
4455 + /* Check if it is the last registered name */
4456 + if (match_last_lsm(*result, new))
4457 +diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
4458 +index fdf01bfd1b07..c8fd5c10b7c6 100644
4459 +--- a/security/smack/smack_lsm.c
4460 ++++ b/security/smack/smack_lsm.c
4461 +@@ -3960,15 +3960,19 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
4462 + struct smack_known *skp = NULL;
4463 + int rc = 0;
4464 + struct smk_audit_info ad;
4465 ++ u16 family = sk->sk_family;
4466 + #ifdef CONFIG_AUDIT
4467 + struct lsm_network_audit net;
4468 + #endif
4469 + #if IS_ENABLED(CONFIG_IPV6)
4470 + struct sockaddr_in6 sadd;
4471 + int proto;
4472 ++
4473 ++ if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP))
4474 ++ family = PF_INET;
4475 + #endif /* CONFIG_IPV6 */
4476 +
4477 +- switch (sk->sk_family) {
4478 ++ switch (family) {
4479 + case PF_INET:
4480 + #ifdef CONFIG_SECURITY_SMACK_NETFILTER
4481 + /*
4482 +@@ -3986,7 +3990,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
4483 + */
4484 + netlbl_secattr_init(&secattr);
4485 +
4486 +- rc = netlbl_skbuff_getattr(skb, sk->sk_family, &secattr);
4487 ++ rc = netlbl_skbuff_getattr(skb, family, &secattr);
4488 + if (rc == 0)
4489 + skp = smack_from_secattr(&secattr, ssp);
4490 + else
4491 +@@ -3999,7 +4003,7 @@ access_check:
4492 + #endif
4493 + #ifdef CONFIG_AUDIT
4494 + smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net);
4495 +- ad.a.u.net->family = sk->sk_family;
4496 ++ ad.a.u.net->family = family;
4497 + ad.a.u.net->netif = skb->skb_iif;
4498 + ipv4_skb_to_auditdata(skb, &ad.a, NULL);
4499 + #endif
4500 +@@ -4013,7 +4017,7 @@ access_check:
4501 + rc = smk_bu_note("IPv4 delivery", skp, ssp->smk_in,
4502 + MAY_WRITE, rc);
4503 + if (rc != 0)
4504 +- netlbl_skbuff_err(skb, sk->sk_family, rc, 0);
4505 ++ netlbl_skbuff_err(skb, family, rc, 0);
4506 + break;
4507 + #if IS_ENABLED(CONFIG_IPV6)
4508 + case PF_INET6:
4509 +@@ -4029,7 +4033,7 @@ access_check:
4510 + skp = smack_net_ambient;
4511 + #ifdef CONFIG_AUDIT
4512 + smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net);
4513 +- ad.a.u.net->family = sk->sk_family;
4514 ++ ad.a.u.net->family = family;
4515 + ad.a.u.net->netif = skb->skb_iif;
4516 + ipv6_skb_to_auditdata(skb, &ad.a, NULL);
4517 + #endif /* CONFIG_AUDIT */
4518 +diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
4519 +index faa67861cbc1..729a85a6211d 100644
4520 +--- a/sound/core/pcm_lib.c
4521 ++++ b/sound/core/pcm_lib.c
4522 +@@ -629,27 +629,33 @@ EXPORT_SYMBOL(snd_interval_refine);
4523 +
4524 + static int snd_interval_refine_first(struct snd_interval *i)
4525 + {
4526 ++ const unsigned int last_max = i->max;
4527 ++
4528 + if (snd_BUG_ON(snd_interval_empty(i)))
4529 + return -EINVAL;
4530 + if (snd_interval_single(i))
4531 + return 0;
4532 + i->max = i->min;
4533 +- i->openmax = i->openmin;
4534 +- if (i->openmax)
4535 ++ if (i->openmin)
4536 + i->max++;
4537 ++ /* only exclude max value if also excluded before refine */
4538 ++ i->openmax = (i->openmax && i->max >= last_max);
4539 + return 1;
4540 + }
4541 +
4542 + static int snd_interval_refine_last(struct snd_interval *i)
4543 + {
4544 ++ const unsigned int last_min = i->min;
4545 ++
4546 + if (snd_BUG_ON(snd_interval_empty(i)))
4547 + return -EINVAL;
4548 + if (snd_interval_single(i))
4549 + return 0;
4550 + i->min = i->max;
4551 +- i->openmin = i->openmax;
4552 +- if (i->openmin)
4553 ++ if (i->openmax)
4554 + i->min--;
4555 ++ /* only exclude min value if also excluded before refine */
4556 ++ i->openmin = (i->openmin && i->min <= last_min);
4557 + return 1;
4558 + }
4559 +
4560 +diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c
4561 +index 45e561c425bf..a3cf837c0ffd 100644
4562 +--- a/sound/isa/msnd/msnd_pinnacle.c
4563 ++++ b/sound/isa/msnd/msnd_pinnacle.c
4564 +@@ -82,10 +82,10 @@
4565 +
4566 + static void set_default_audio_parameters(struct snd_msnd *chip)
4567 + {
4568 +- chip->play_sample_size = DEFSAMPLESIZE;
4569 ++ chip->play_sample_size = snd_pcm_format_width(DEFSAMPLESIZE);
4570 + chip->play_sample_rate = DEFSAMPLERATE;
4571 + chip->play_channels = DEFCHANNELS;
4572 +- chip->capture_sample_size = DEFSAMPLESIZE;
4573 ++ chip->capture_sample_size = snd_pcm_format_width(DEFSAMPLESIZE);
4574 + chip->capture_sample_rate = DEFSAMPLERATE;
4575 + chip->capture_channels = DEFCHANNELS;
4576 + }
4577 +diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c
4578 +index e52e68b56238..1bfc8db1826a 100644
4579 +--- a/sound/soc/codecs/rt5514.c
4580 ++++ b/sound/soc/codecs/rt5514.c
4581 +@@ -64,8 +64,8 @@ static const struct reg_sequence rt5514_patch[] = {
4582 + {RT5514_ANA_CTRL_LDO10, 0x00028604},
4583 + {RT5514_ANA_CTRL_ADCFED, 0x00000800},
4584 + {RT5514_ASRC_IN_CTRL1, 0x00000003},
4585 +- {RT5514_DOWNFILTER0_CTRL3, 0x10000362},
4586 +- {RT5514_DOWNFILTER1_CTRL3, 0x10000362},
4587 ++ {RT5514_DOWNFILTER0_CTRL3, 0x10000352},
4588 ++ {RT5514_DOWNFILTER1_CTRL3, 0x10000352},
4589 + };
4590 +
4591 + static const struct reg_default rt5514_reg[] = {
4592 +@@ -92,10 +92,10 @@ static const struct reg_default rt5514_reg[] = {
4593 + {RT5514_ASRC_IN_CTRL1, 0x00000003},
4594 + {RT5514_DOWNFILTER0_CTRL1, 0x00020c2f},
4595 + {RT5514_DOWNFILTER0_CTRL2, 0x00020c2f},
4596 +- {RT5514_DOWNFILTER0_CTRL3, 0x10000362},
4597 ++ {RT5514_DOWNFILTER0_CTRL3, 0x10000352},
4598 + {RT5514_DOWNFILTER1_CTRL1, 0x00020c2f},
4599 + {RT5514_DOWNFILTER1_CTRL2, 0x00020c2f},
4600 +- {RT5514_DOWNFILTER1_CTRL3, 0x10000362},
4601 ++ {RT5514_DOWNFILTER1_CTRL3, 0x10000352},
4602 + {RT5514_ANA_CTRL_LDO10, 0x00028604},
4603 + {RT5514_ANA_CTRL_LDO18_16, 0x02000345},
4604 + {RT5514_ANA_CTRL_ADC12, 0x0000a2a8},
4605 +diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
4606 +index f058f2bdd519..33b4d14af2b3 100644
4607 +--- a/sound/soc/samsung/i2s.c
4608 ++++ b/sound/soc/samsung/i2s.c
4609 +@@ -552,8 +552,11 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
4610 + }
4611 +
4612 + ret = clk_prepare_enable(i2s->op_clk);
4613 +- if (ret)
4614 ++ if (ret) {
4615 ++ clk_put(i2s->op_clk);
4616 ++ i2s->op_clk = NULL;
4617 + goto err;
4618 ++ }
4619 + i2s->rclk_srcrate = clk_get_rate(i2s->op_clk);
4620 +
4621 + /* Over-ride the other's */
4622 +diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c
4623 +index 68698f3d72f9..52e2fbe446d1 100644
4624 +--- a/sound/soc/samsung/tm2_wm5110.c
4625 ++++ b/sound/soc/samsung/tm2_wm5110.c
4626 +@@ -436,8 +436,7 @@ static int tm2_probe(struct platform_device *pdev)
4627 + snd_soc_card_set_drvdata(card, priv);
4628 + card->dev = dev;
4629 +
4630 +- priv->gpio_mic_bias = devm_gpiod_get(dev, "mic-bias",
4631 +- GPIOF_OUT_INIT_LOW);
4632 ++ priv->gpio_mic_bias = devm_gpiod_get(dev, "mic-bias", GPIOD_OUT_HIGH);
4633 + if (IS_ERR(priv->gpio_mic_bias)) {
4634 + dev_err(dev, "Failed to get mic bias gpio\n");
4635 + return PTR_ERR(priv->gpio_mic_bias);
4636 +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
4637 +index 69bf5cf1e91e..15cbe2565703 100644
4638 +--- a/sound/usb/quirks-table.h
4639 ++++ b/sound/usb/quirks-table.h
4640 +@@ -2875,7 +2875,8 @@ YAMAHA_DEVICE(0x7010, "UB99"),
4641 + */
4642 +
4643 + #define AU0828_DEVICE(vid, pid, vname, pname) { \
4644 +- USB_DEVICE_VENDOR_SPEC(vid, pid), \
4645 ++ .idVendor = vid, \
4646 ++ .idProduct = pid, \
4647 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
4648 + USB_DEVICE_ID_MATCH_INT_CLASS | \
4649 + USB_DEVICE_ID_MATCH_INT_SUBCLASS, \
4650 +diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
4651 +index 4c99c57736ce..3965186b375a 100644
4652 +--- a/tools/hv/hv_kvp_daemon.c
4653 ++++ b/tools/hv/hv_kvp_daemon.c
4654 +@@ -286,7 +286,7 @@ static int kvp_key_delete(int pool, const __u8 *key, int key_size)
4655 + * Found a match; just move the remaining
4656 + * entries up.
4657 + */
4658 +- if (i == num_records) {
4659 ++ if (i == (num_records - 1)) {
4660 + kvp_file_info[pool].num_records--;
4661 + kvp_update_file(pool);
4662 + return 0;
4663 +diff --git a/tools/perf/arch/powerpc/util/skip-callchain-idx.c b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
4664 +index bd630c222e65..9a53f6e9ef43 100644
4665 +--- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c
4666 ++++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
4667 +@@ -58,9 +58,13 @@ static int check_return_reg(int ra_regno, Dwarf_Frame *frame)
4668 + }
4669 +
4670 + /*
4671 +- * Check if return address is on the stack.
4672 ++ * Check if return address is on the stack. If return address
4673 ++ * is in a register (typically R0), it is yet to be saved on
4674 ++ * the stack.
4675 + */
4676 +- if (nops != 0 || ops != NULL)
4677 ++ if ((nops != 0 || ops != NULL) &&
4678 ++ !(nops == 1 && ops[0].atom == DW_OP_regx &&
4679 ++ ops[0].number2 == 0 && ops[0].offset == 0))
4680 + return 0;
4681 +
4682 + /*
4683 +@@ -246,7 +250,7 @@ int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain)
4684 + if (!chain || chain->nr < 3)
4685 + return skip_slot;
4686 +
4687 +- ip = chain->ips[2];
4688 ++ ip = chain->ips[1];
4689 +
4690 + thread__find_addr_location(thread, PERF_RECORD_MISC_USER,
4691 + MAP__FUNCTION, ip, &al);
4692 +diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
4693 +index 53d06f37406a..5966f1f9b160 100644
4694 +--- a/tools/perf/tests/builtin-test.c
4695 ++++ b/tools/perf/tests/builtin-test.c
4696 +@@ -589,7 +589,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
4697 + for (subi = 0; subi < subn; subi++) {
4698 + pr_info("%2d.%1d: %-*s:", i, subi + 1, subw,
4699 + t->subtest.get_desc(subi));
4700 +- err = test_and_print(t, skip, subi);
4701 ++ err = test_and_print(t, skip, subi + 1);
4702 + if (err != TEST_OK && t->subtest.skip_if_fail)
4703 + skip = true;
4704 + }
4705 +diff --git a/tools/perf/util/comm.c b/tools/perf/util/comm.c
4706 +index 8808570f8e9c..327e01cb1aa2 100644
4707 +--- a/tools/perf/util/comm.c
4708 ++++ b/tools/perf/util/comm.c
4709 +@@ -18,9 +18,10 @@ static struct rb_root comm_str_root;
4710 +
4711 + static struct comm_str *comm_str__get(struct comm_str *cs)
4712 + {
4713 +- if (cs)
4714 +- refcount_inc(&cs->refcnt);
4715 +- return cs;
4716 ++ if (cs && refcount_inc_not_zero(&cs->refcnt))
4717 ++ return cs;
4718 ++
4719 ++ return NULL;
4720 + }
4721 +
4722 + static void comm_str__put(struct comm_str *cs)
4723 +@@ -62,9 +63,14 @@ static struct comm_str *comm_str__findnew(const char *str, struct rb_root *root)
4724 + parent = *p;
4725 + iter = rb_entry(parent, struct comm_str, rb_node);
4726 +
4727 ++ /*
4728 ++ * If we race with comm_str__put, iter->refcnt is 0
4729 ++ * and it will be removed within comm_str__put call
4730 ++ * shortly, ignore it in this search.
4731 ++ */
4732 + cmp = strcmp(str, iter->str);
4733 +- if (!cmp)
4734 +- return comm_str__get(iter);
4735 ++ if (!cmp && comm_str__get(iter))
4736 ++ return iter;
4737 +
4738 + if (cmp < 0)
4739 + p = &(*p)->rb_left;
4740 +diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
4741 +index 8a678a3d5a2a..1ceb332575bd 100644
4742 +--- a/tools/perf/util/header.c
4743 ++++ b/tools/perf/util/header.c
4744 +@@ -2209,7 +2209,7 @@ static const struct feature_ops feat_ops[HEADER_LAST_FEATURE] = {
4745 + FEAT_OPR(NUMA_TOPOLOGY, numa_topology, true),
4746 + FEAT_OPN(BRANCH_STACK, branch_stack, false),
4747 + FEAT_OPR(PMU_MAPPINGS, pmu_mappings, false),
4748 +- FEAT_OPN(GROUP_DESC, group_desc, false),
4749 ++ FEAT_OPR(GROUP_DESC, group_desc, false),
4750 + FEAT_OPN(AUXTRACE, auxtrace, false),
4751 + FEAT_OPN(STAT, stat, false),
4752 + FEAT_OPN(CACHE, cache, true),
4753 +diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
4754 +index ca6cd146aafe..dcf73c5dab6e 100644
4755 +--- a/tools/testing/selftests/timers/raw_skew.c
4756 ++++ b/tools/testing/selftests/timers/raw_skew.c
4757 +@@ -134,6 +134,11 @@ int main(int argv, char **argc)
4758 + printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000)));
4759 +
4760 + if (llabs(eppm - ppm) > 1000) {
4761 ++ if (tx1.offset || tx2.offset ||
4762 ++ tx1.freq != tx2.freq || tx1.tick != tx2.tick) {
4763 ++ printf(" [SKIP]\n");
4764 ++ return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
4765 ++ }
4766 + printf(" [FAILED]\n");
4767 + return ksft_exit_fail();
4768 + }
4769 +diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c
4770 +index 5801261f3add..6f7f26ae72b4 100644
4771 +--- a/virt/kvm/arm/vgic/vgic-init.c
4772 ++++ b/virt/kvm/arm/vgic/vgic-init.c
4773 +@@ -277,6 +277,10 @@ int vgic_init(struct kvm *kvm)
4774 + if (vgic_initialized(kvm))
4775 + return 0;
4776 +
4777 ++ /* Are we also in the middle of creating a VCPU? */
4778 ++ if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus))
4779 ++ return -EBUSY;
4780 ++
4781 + /* freeze the number of spis */
4782 + if (!dist->nr_spis)
4783 + dist->nr_spis = VGIC_NR_IRQS_LEGACY - VGIC_NR_PRIVATE_IRQS;
4784 +diff --git a/virt/kvm/arm/vgic/vgic-mmio-v2.c b/virt/kvm/arm/vgic/vgic-mmio-v2.c
4785 +index af003268bf3e..7ea5928244fa 100644
4786 +--- a/virt/kvm/arm/vgic/vgic-mmio-v2.c
4787 ++++ b/virt/kvm/arm/vgic/vgic-mmio-v2.c
4788 +@@ -348,6 +348,9 @@ static void vgic_mmio_write_apr(struct kvm_vcpu *vcpu,
4789 +
4790 + if (n > vgic_v3_max_apr_idx(vcpu))
4791 + return;
4792 ++
4793 ++ n = array_index_nospec(n, 4);
4794 ++
4795 + /* GICv3 only uses ICH_AP1Rn for memory mapped (GICv2) guests */
4796 + vgicv3->vgic_ap1r[n] = val;
4797 + }