Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Wed, 26 Sep 2018 10:42:57
Message-Id: 1537958560.5952a88ca812123bc877a705a09eca931b0da0be.mpagano@gentoo
1 commit: 5952a88ca812123bc877a705a09eca931b0da0be
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 26 10:42:40 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 26 10:42:40 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=5952a88c
7
8 Linux patch 4.9.129
9
10 0000_README | 4 +
11 1128_linux-4.9.129.patch | 2979 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 2983 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 582011b..cf72302 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -555,6 +555,10 @@ Patch: 1127_linux-4.9.128.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.9.128
21
22 +Patch: 1128_linux-4.9.129.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.9.129
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/1128_linux-4.9.129.patch b/1128_linux-4.9.129.patch
31 new file mode 100644
32 index 0000000..4815392
33 --- /dev/null
34 +++ b/1128_linux-4.9.129.patch
35 @@ -0,0 +1,2979 @@
36 +diff --git a/Makefile b/Makefile
37 +index 1892bdb6a760..3f3c340374c5 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 9
43 +-SUBLEVEL = 128
44 ++SUBLEVEL = 129
45 + EXTRAVERSION =
46 + NAME = Roaring Lionus
47 +
48 +diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
49 +index c0fb4a698c56..386b93c06a8c 100644
50 +--- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
51 ++++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
52 +@@ -188,6 +188,8 @@
53 + regulator-max-microvolt = <2950000>;
54 +
55 + regulator-boot-on;
56 ++ regulator-system-load = <200000>;
57 ++ regulator-allow-set-load;
58 + };
59 +
60 + l21 {
61 +diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
62 +index 06332f626565..3e1430a886b2 100644
63 +--- a/arch/arm/mach-exynos/suspend.c
64 ++++ b/arch/arm/mach-exynos/suspend.c
65 +@@ -252,6 +252,7 @@ static int __init exynos_pmu_irq_init(struct device_node *node,
66 + NULL);
67 + if (!domain) {
68 + iounmap(pmu_base_addr);
69 ++ pmu_base_addr = NULL;
70 + return -ENOMEM;
71 + }
72 +
73 +diff --git a/arch/arm/mach-hisi/hotplug.c b/arch/arm/mach-hisi/hotplug.c
74 +index a129aae72602..909bb2493781 100644
75 +--- a/arch/arm/mach-hisi/hotplug.c
76 ++++ b/arch/arm/mach-hisi/hotplug.c
77 +@@ -148,13 +148,20 @@ static int hi3xxx_hotplug_init(void)
78 + struct device_node *node;
79 +
80 + node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
81 +- if (node) {
82 +- ctrl_base = of_iomap(node, 0);
83 +- id = HI3620_CTRL;
84 +- return 0;
85 ++ if (!node) {
86 ++ id = ERROR_CTRL;
87 ++ return -ENOENT;
88 + }
89 +- id = ERROR_CTRL;
90 +- return -ENOENT;
91 ++
92 ++ ctrl_base = of_iomap(node, 0);
93 ++ of_node_put(node);
94 ++ if (!ctrl_base) {
95 ++ id = ERROR_CTRL;
96 ++ return -ENOMEM;
97 ++ }
98 ++
99 ++ id = HI3620_CTRL;
100 ++ return 0;
101 + }
102 +
103 + void hi3xxx_set_cpu(int cpu, bool enable)
104 +@@ -173,11 +180,15 @@ static bool hix5hd2_hotplug_init(void)
105 + struct device_node *np;
106 +
107 + np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl");
108 +- if (np) {
109 +- ctrl_base = of_iomap(np, 0);
110 +- return true;
111 +- }
112 +- return false;
113 ++ if (!np)
114 ++ return false;
115 ++
116 ++ ctrl_base = of_iomap(np, 0);
117 ++ of_node_put(np);
118 ++ if (!ctrl_base)
119 ++ return false;
120 ++
121 ++ return true;
122 + }
123 +
124 + void hix5hd2_set_cpu(int cpu, bool enable)
125 +@@ -219,10 +230,10 @@ void hip01_set_cpu(int cpu, bool enable)
126 +
127 + if (!ctrl_base) {
128 + np = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl");
129 +- if (np)
130 +- ctrl_base = of_iomap(np, 0);
131 +- else
132 +- BUG();
133 ++ BUG_ON(!np);
134 ++ ctrl_base = of_iomap(np, 0);
135 ++ of_node_put(np);
136 ++ BUG_ON(!ctrl_base);
137 + }
138 +
139 + if (enable) {
140 +diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
141 +index bb062b547110..601be6127628 100644
142 +--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
143 ++++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
144 +@@ -170,7 +170,7 @@
145 + led@6 {
146 + label = "apq8016-sbc:blue:bt";
147 + gpios = <&pm8916_mpps 3 GPIO_ACTIVE_HIGH>;
148 +- linux,default-trigger = "bt";
149 ++ linux,default-trigger = "bluetooth-power";
150 + default-state = "off";
151 + };
152 + };
153 +diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c
154 +index f206dafbb0a3..26a058d58d37 100644
155 +--- a/arch/mips/ath79/setup.c
156 ++++ b/arch/mips/ath79/setup.c
157 +@@ -40,6 +40,7 @@ static char ath79_sys_type[ATH79_SYS_TYPE_LEN];
158 +
159 + static void ath79_restart(char *command)
160 + {
161 ++ local_irq_disable();
162 + ath79_device_reset_set(AR71XX_RESET_FULL_CHIP);
163 + for (;;)
164 + if (cpu_wait)
165 +diff --git a/arch/mips/include/asm/mach-ath79/ath79.h b/arch/mips/include/asm/mach-ath79/ath79.h
166 +index 441faa92c3cd..6e6c0fead776 100644
167 +--- a/arch/mips/include/asm/mach-ath79/ath79.h
168 ++++ b/arch/mips/include/asm/mach-ath79/ath79.h
169 +@@ -134,6 +134,7 @@ static inline u32 ath79_pll_rr(unsigned reg)
170 + static inline void ath79_reset_wr(unsigned reg, u32 val)
171 + {
172 + __raw_writel(val, ath79_reset_base + reg);
173 ++ (void) __raw_readl(ath79_reset_base + reg); /* flush */
174 + }
175 +
176 + static inline u32 ath79_reset_rr(unsigned reg)
177 +diff --git a/arch/mips/jz4740/Platform b/arch/mips/jz4740/Platform
178 +index 28448d358c10..a2a5a85ea1f9 100644
179 +--- a/arch/mips/jz4740/Platform
180 ++++ b/arch/mips/jz4740/Platform
181 +@@ -1,4 +1,4 @@
182 + platform-$(CONFIG_MACH_INGENIC) += jz4740/
183 + cflags-$(CONFIG_MACH_INGENIC) += -I$(srctree)/arch/mips/include/asm/mach-jz4740
184 + load-$(CONFIG_MACH_INGENIC) += 0xffffffff80010000
185 +-zload-$(CONFIG_MACH_INGENIC) += 0xffffffff80600000
186 ++zload-$(CONFIG_MACH_INGENIC) += 0xffffffff81000000
187 +diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c
188 +index f9dbfb14af33..e88344e3d508 100644
189 +--- a/arch/mips/kernel/vdso.c
190 ++++ b/arch/mips/kernel/vdso.c
191 +@@ -14,12 +14,14 @@
192 + #include <linux/init.h>
193 + #include <linux/ioport.h>
194 + #include <linux/irqchip/mips-gic.h>
195 ++#include <linux/kernel.h>
196 + #include <linux/mm.h>
197 + #include <linux/sched.h>
198 + #include <linux/slab.h>
199 + #include <linux/timekeeper_internal.h>
200 +
201 + #include <asm/abi.h>
202 ++#include <asm/page.h>
203 + #include <asm/vdso.h>
204 +
205 + /* Kernel-provided data used by the VDSO. */
206 +@@ -129,12 +131,30 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
207 + vvar_size = gic_size + PAGE_SIZE;
208 + size = vvar_size + image->size;
209 +
210 ++ /*
211 ++ * Find a region that's large enough for us to perform the
212 ++ * colour-matching alignment below.
213 ++ */
214 ++ if (cpu_has_dc_aliases)
215 ++ size += shm_align_mask + 1;
216 ++
217 + base = get_unmapped_area(NULL, 0, size, 0, 0);
218 + if (IS_ERR_VALUE(base)) {
219 + ret = base;
220 + goto out;
221 + }
222 +
223 ++ /*
224 ++ * If we suffer from dcache aliasing, ensure that the VDSO data page
225 ++ * mapping is coloured the same as the kernel's mapping of that memory.
226 ++ * This ensures that when the kernel updates the VDSO data userland
227 ++ * will observe it without requiring cache invalidations.
228 ++ */
229 ++ if (cpu_has_dc_aliases) {
230 ++ base = __ALIGN_MASK(base, shm_align_mask);
231 ++ base += ((unsigned long)&vdso_data - gic_size) & shm_align_mask;
232 ++ }
233 ++
234 + data_addr = base + gic_size;
235 + vdso_addr = data_addr + PAGE_SIZE;
236 +
237 +diff --git a/arch/mips/loongson64/common/cs5536/cs5536_ohci.c b/arch/mips/loongson64/common/cs5536/cs5536_ohci.c
238 +index f7c905e50dc4..92dc6bafc127 100644
239 +--- a/arch/mips/loongson64/common/cs5536/cs5536_ohci.c
240 ++++ b/arch/mips/loongson64/common/cs5536/cs5536_ohci.c
241 +@@ -138,7 +138,7 @@ u32 pci_ohci_read_reg(int reg)
242 + break;
243 + case PCI_OHCI_INT_REG:
244 + _rdmsr(DIVIL_MSR_REG(PIC_YSEL_LOW), &hi, &lo);
245 +- if ((lo & 0x00000f00) == CS5536_USB_INTR)
246 ++ if (((lo >> PIC_YSEL_LOW_USB_SHIFT) & 0xf) == CS5536_USB_INTR)
247 + conf_data = 1;
248 + break;
249 + default:
250 +diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
251 +index 6c9a65b52e63..7fb61ebc99a2 100644
252 +--- a/arch/powerpc/platforms/powernv/opal.c
253 ++++ b/arch/powerpc/platforms/powernv/opal.c
254 +@@ -369,7 +369,7 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
255 + /* Closed or other error drop */
256 + if (rc != OPAL_SUCCESS && rc != OPAL_BUSY &&
257 + rc != OPAL_BUSY_EVENT) {
258 +- written = total_len;
259 ++ written += total_len;
260 + break;
261 + }
262 + if (rc == OPAL_SUCCESS) {
263 +diff --git a/crypto/api.c b/crypto/api.c
264 +index bbc147cb5dec..abf53e67e3d8 100644
265 +--- a/crypto/api.c
266 ++++ b/crypto/api.c
267 +@@ -215,7 +215,7 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask)
268 + type &= mask;
269 +
270 + alg = crypto_alg_lookup(name, type, mask);
271 +- if (!alg) {
272 ++ if (!alg && !(mask & CRYPTO_NOLOAD)) {
273 + request_module("crypto-%s", name);
274 +
275 + if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask &
276 +diff --git a/drivers/base/core.c b/drivers/base/core.c
277 +index a0ed957d738f..f43caad30e1e 100644
278 +--- a/drivers/base/core.c
279 ++++ b/drivers/base/core.c
280 +@@ -2072,6 +2072,9 @@ void device_shutdown(void)
281 + {
282 + struct device *dev, *parent;
283 +
284 ++ wait_for_device_probe();
285 ++ device_block_probing();
286 ++
287 + spin_lock(&devices_kset->list_lock);
288 + /*
289 + * Walk the devices list backward, shutting down each in turn.
290 +diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
291 +index a5d402de5584..20724abd38bd 100644
292 +--- a/drivers/clk/clk-fixed-factor.c
293 ++++ b/drivers/clk/clk-fixed-factor.c
294 +@@ -177,8 +177,15 @@ static struct clk *_of_fixed_factor_clk_setup(struct device_node *node)
295 +
296 + clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags,
297 + mult, div);
298 +- if (IS_ERR(clk))
299 ++ if (IS_ERR(clk)) {
300 ++ /*
301 ++ * If parent clock is not registered, registration would fail.
302 ++ * Clear OF_POPULATED flag so that clock registration can be
303 ++ * attempted again from probe function.
304 ++ */
305 ++ of_node_clear_flag(node, OF_POPULATED);
306 + return clk;
307 ++ }
308 +
309 + ret = of_clk_add_provider(node, of_clk_src_simple_get, clk);
310 + if (ret) {
311 +diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
312 +index d1d7787ce211..db2901646403 100644
313 +--- a/drivers/clk/imx/clk-imx6ul.c
314 ++++ b/drivers/clk/imx/clk-imx6ul.c
315 +@@ -120,6 +120,7 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
316 +
317 + np = of_find_compatible_node(NULL, NULL, "fsl,imx6ul-anatop");
318 + base = of_iomap(np, 0);
319 ++ of_node_put(np);
320 + WARN_ON(!base);
321 +
322 + 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));
323 +diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
324 +index 0c49956ee0ce..4d0ec7bb3bc9 100644
325 +--- a/drivers/crypto/sahara.c
326 ++++ b/drivers/crypto/sahara.c
327 +@@ -1352,7 +1352,7 @@ err_sha_v4_algs:
328 +
329 + err_sha_v3_algs:
330 + for (j = 0; j < k; j++)
331 +- crypto_unregister_ahash(&sha_v4_algs[j]);
332 ++ crypto_unregister_ahash(&sha_v3_algs[j]);
333 +
334 + err_aes_algs:
335 + for (j = 0; j < i; j++)
336 +@@ -1368,7 +1368,7 @@ static void sahara_unregister_algs(struct sahara_dev *dev)
337 + for (i = 0; i < ARRAY_SIZE(aes_algs); i++)
338 + crypto_unregister_alg(&aes_algs[i]);
339 +
340 +- for (i = 0; i < ARRAY_SIZE(sha_v4_algs); i++)
341 ++ for (i = 0; i < ARRAY_SIZE(sha_v3_algs); i++)
342 + crypto_unregister_ahash(&sha_v3_algs[i]);
343 +
344 + if (dev->version > SAHARA_VERSION_3)
345 +diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c
346 +index 71866646ffef..be1f5c26fae8 100644
347 +--- a/drivers/dma/mv_xor_v2.c
348 ++++ b/drivers/dma/mv_xor_v2.c
349 +@@ -844,6 +844,8 @@ static int mv_xor_v2_remove(struct platform_device *pdev)
350 +
351 + platform_msi_domain_free_irqs(&pdev->dev);
352 +
353 ++ tasklet_kill(&xor_dev->irq_tasklet);
354 ++
355 + clk_disable_unprepare(xor_dev->clk);
356 +
357 + return 0;
358 +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
359 +index b9dad4e40bb8..6d7e3cd4aba4 100644
360 +--- a/drivers/dma/pl330.c
361 ++++ b/drivers/dma/pl330.c
362 +@@ -2167,13 +2167,14 @@ static int pl330_terminate_all(struct dma_chan *chan)
363 +
364 + pm_runtime_get_sync(pl330->ddma.dev);
365 + spin_lock_irqsave(&pch->lock, flags);
366 ++
367 + spin_lock(&pl330->lock);
368 + _stop(pch->thread);
369 +- spin_unlock(&pl330->lock);
370 +-
371 + pch->thread->req[0].desc = NULL;
372 + pch->thread->req[1].desc = NULL;
373 + pch->thread->req_running = -1;
374 ++ spin_unlock(&pl330->lock);
375 ++
376 + power_down = pch->active;
377 + pch->active = false;
378 +
379 +diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c
380 +index 8efe13075c92..1d1c9693ebfb 100644
381 +--- a/drivers/firmware/efi/arm-init.c
382 ++++ b/drivers/firmware/efi/arm-init.c
383 +@@ -250,7 +250,6 @@ void __init efi_init(void)
384 + reserve_regions();
385 + efi_memattr_init();
386 + efi_esrt_init();
387 +- efi_memmap_unmap();
388 +
389 + memblock_reserve(params.mmap & PAGE_MASK,
390 + PAGE_ALIGN(params.mmap_size +
391 +diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c
392 +index 6bdf39e1e385..4d788e0debfe 100644
393 +--- a/drivers/firmware/efi/arm-runtime.c
394 ++++ b/drivers/firmware/efi/arm-runtime.c
395 +@@ -118,11 +118,13 @@ static int __init arm_enable_runtime_services(void)
396 + {
397 + u64 mapsize;
398 +
399 +- if (!efi_enabled(EFI_BOOT)) {
400 ++ if (!efi_enabled(EFI_BOOT) || !efi_enabled(EFI_MEMMAP)) {
401 + pr_info("EFI services will not be available.\n");
402 + return 0;
403 + }
404 +
405 ++ efi_memmap_unmap();
406 ++
407 + if (efi_runtime_disabled()) {
408 + pr_info("EFI runtime services will be disabled.\n");
409 + return 0;
410 +diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c
411 +index 311c9d0e8cbb..241dd7c63d2c 100644
412 +--- a/drivers/firmware/efi/esrt.c
413 ++++ b/drivers/firmware/efi/esrt.c
414 +@@ -333,7 +333,8 @@ void __init efi_esrt_init(void)
415 +
416 + end = esrt_data + size;
417 + pr_info("Reserving ESRT space from %pa to %pa.\n", &esrt_data, &end);
418 +- efi_mem_reserve(esrt_data, esrt_data_size);
419 ++ if (md.type == EFI_BOOT_SERVICES_DATA)
420 ++ efi_mem_reserve(esrt_data, esrt_data_size);
421 +
422 + pr_debug("esrt-init: loaded.\n");
423 + err_memunmap:
424 +diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
425 +index 76ac906b4d78..7a6305884f97 100644
426 +--- a/drivers/gpio/gpio-pxa.c
427 ++++ b/drivers/gpio/gpio-pxa.c
428 +@@ -660,6 +660,8 @@ static int pxa_gpio_probe(struct platform_device *pdev)
429 + pchip->irq0 = irq0;
430 + pchip->irq1 = irq1;
431 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
432 ++ if (!res)
433 ++ return -EINVAL;
434 + gpio_reg_base = devm_ioremap(&pdev->dev, res->start,
435 + resource_size(res));
436 + if (!gpio_reg_base)
437 +diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
438 +index 346fbda39220..6c4d72872309 100644
439 +--- a/drivers/gpio/gpiolib.h
440 ++++ b/drivers/gpio/gpiolib.h
441 +@@ -85,7 +85,7 @@ struct acpi_gpio_info {
442 + };
443 +
444 + /* gpio suffixes used for ACPI and device tree lookup */
445 +-static const char * const gpio_suffixes[] = { "gpios", "gpio" };
446 ++static __maybe_unused const char * const gpio_suffixes[] = { "gpios", "gpio" };
447 +
448 + #ifdef CONFIG_OF_GPIO
449 + struct gpio_desc *of_find_gpio(struct device *dev,
450 +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
451 +index 171480bb95d0..6e7eb76189f9 100644
452 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
453 ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
454 +@@ -124,6 +124,8 @@ struct kfd_process *kfd_get_process(const struct task_struct *thread)
455 + return ERR_PTR(-EINVAL);
456 +
457 + process = find_process(thread);
458 ++ if (!process)
459 ++ return ERR_PTR(-EINVAL);
460 +
461 + return process;
462 + }
463 +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
464 +index 9b638bd905ff..d370bf8bc409 100644
465 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
466 ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
467 +@@ -23,6 +23,10 @@
468 + #ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER
469 + #include "priv.h"
470 +
471 ++#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
472 ++#include <asm/dma-iommu.h>
473 ++#endif
474 ++
475 + static int
476 + nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev)
477 + {
478 +@@ -95,6 +99,15 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev)
479 + unsigned long pgsize_bitmap;
480 + int ret;
481 +
482 ++#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
483 ++ if (dev->archdata.mapping) {
484 ++ struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);
485 ++
486 ++ arm_iommu_detach_device(dev);
487 ++ arm_iommu_release_mapping(mapping);
488 ++ }
489 ++#endif
490 ++
491 + if (!tdev->func->iommu_bit)
492 + return;
493 +
494 +diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
495 +index a188a3959f1a..6ad827b93ae1 100644
496 +--- a/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
497 ++++ b/drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
498 +@@ -823,7 +823,7 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx)
499 + int ret, i;
500 +
501 + ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id));
502 +- if (ret < ARRAY_SIZE(id) || id[0] == 0x00) {
503 ++ if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] == 0x00) {
504 + dev_err(ctx->dev, "read id failed\n");
505 + ctx->error = -EIO;
506 + return;
507 +diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c
508 +index d6e5ded24418..8774bf17c853 100644
509 +--- a/drivers/gpu/ipu-v3/ipu-csi.c
510 ++++ b/drivers/gpu/ipu-v3/ipu-csi.c
511 +@@ -316,13 +316,17 @@ static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code)
512 + /*
513 + * Fill a CSI bus config struct from mbus_config and mbus_framefmt.
514 + */
515 +-static void fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
516 ++static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
517 + struct v4l2_mbus_config *mbus_cfg,
518 + struct v4l2_mbus_framefmt *mbus_fmt)
519 + {
520 ++ int ret;
521 ++
522 + memset(csicfg, 0, sizeof(*csicfg));
523 +
524 +- mbus_code_to_bus_cfg(csicfg, mbus_fmt->code);
525 ++ ret = mbus_code_to_bus_cfg(csicfg, mbus_fmt->code);
526 ++ if (ret < 0)
527 ++ return ret;
528 +
529 + switch (mbus_cfg->type) {
530 + case V4L2_MBUS_PARALLEL:
531 +@@ -353,6 +357,8 @@ static void fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
532 + /* will never get here, keep compiler quiet */
533 + break;
534 + }
535 ++
536 ++ return 0;
537 + }
538 +
539 + int ipu_csi_init_interface(struct ipu_csi *csi,
540 +@@ -362,8 +368,11 @@ int ipu_csi_init_interface(struct ipu_csi *csi,
541 + struct ipu_csi_bus_config cfg;
542 + unsigned long flags;
543 + u32 width, height, data = 0;
544 ++ int ret;
545 +
546 +- fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt);
547 ++ ret = fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt);
548 ++ if (ret < 0)
549 ++ return ret;
550 +
551 + /* set default sensor frame width and height */
552 + width = mbus_fmt->width;
553 +@@ -567,11 +576,14 @@ int ipu_csi_set_mipi_datatype(struct ipu_csi *csi, u32 vc,
554 + struct ipu_csi_bus_config cfg;
555 + unsigned long flags;
556 + u32 temp;
557 ++ int ret;
558 +
559 + if (vc > 3)
560 + return -EINVAL;
561 +
562 +- mbus_code_to_bus_cfg(&cfg, mbus_fmt->code);
563 ++ ret = mbus_code_to_bus_cfg(&cfg, mbus_fmt->code);
564 ++ if (ret < 0)
565 ++ return ret;
566 +
567 + spin_lock_irqsave(&csi->lock, flags);
568 +
569 +diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
570 +index ff579a7c6d00..7473c6ea99e9 100644
571 +--- a/drivers/hwtracing/coresight/coresight-tpiu.c
572 ++++ b/drivers/hwtracing/coresight/coresight-tpiu.c
573 +@@ -47,8 +47,9 @@
574 +
575 + /** register definition **/
576 + /* FFSR - 0x300 */
577 +-#define FFSR_FT_STOPPED BIT(1)
578 ++#define FFSR_FT_STOPPED_BIT 1
579 + /* FFCR - 0x304 */
580 ++#define FFCR_FON_MAN_BIT 6
581 + #define FFCR_FON_MAN BIT(6)
582 + #define FFCR_STOP_FI BIT(12)
583 +
584 +@@ -93,9 +94,9 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata)
585 + /* Generate manual flush */
586 + writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
587 + /* Wait for flush to complete */
588 +- coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0);
589 ++ coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN_BIT, 0);
590 + /* Wait for formatter to stop */
591 +- coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1);
592 ++ coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED_BIT, 1);
593 +
594 + CS_LOCK(drvdata->base);
595 + }
596 +diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
597 +index 4383324ec01c..398e44a9ec45 100644
598 +--- a/drivers/hwtracing/coresight/coresight.c
599 ++++ b/drivers/hwtracing/coresight/coresight.c
600 +@@ -107,7 +107,7 @@ static int coresight_find_link_inport(struct coresight_device *csdev,
601 + dev_err(&csdev->dev, "couldn't find inport, parent: %s, child: %s\n",
602 + dev_name(&parent->dev), dev_name(&csdev->dev));
603 +
604 +- return 0;
605 ++ return -ENODEV;
606 + }
607 +
608 + static int coresight_find_link_outport(struct coresight_device *csdev,
609 +@@ -125,7 +125,7 @@ static int coresight_find_link_outport(struct coresight_device *csdev,
610 + dev_err(&csdev->dev, "couldn't find outport, parent: %s, child: %s\n",
611 + dev_name(&csdev->dev), dev_name(&child->dev));
612 +
613 +- return 0;
614 ++ return -ENODEV;
615 + }
616 +
617 + static int coresight_enable_sink(struct coresight_device *csdev, u32 mode)
618 +@@ -178,6 +178,9 @@ static int coresight_enable_link(struct coresight_device *csdev,
619 + else
620 + refport = 0;
621 +
622 ++ if (refport < 0)
623 ++ return refport;
624 ++
625 + if (atomic_inc_return(&csdev->refcnt[refport]) == 1) {
626 + if (link_ops(csdev)->enable) {
627 + ret = link_ops(csdev)->enable(csdev, inport, outport);
628 +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
629 +index 575afba1056a..85d4ef319c90 100644
630 +--- a/drivers/infiniband/core/cma.c
631 ++++ b/drivers/infiniband/core/cma.c
632 +@@ -673,6 +673,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
633 + dgid = (union ib_gid *) &addr->sib_addr;
634 + pkey = ntohs(addr->sib_pkey);
635 +
636 ++ mutex_lock(&lock);
637 + list_for_each_entry(cur_dev, &dev_list, list) {
638 + for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
639 + if (!rdma_cap_af_ib(cur_dev->device, p))
640 +@@ -696,18 +697,19 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
641 + cma_dev = cur_dev;
642 + sgid = gid;
643 + id_priv->id.port_num = p;
644 ++ goto found;
645 + }
646 + }
647 + }
648 + }
649 +-
650 +- if (!cma_dev)
651 +- return -ENODEV;
652 ++ mutex_unlock(&lock);
653 ++ return -ENODEV;
654 +
655 + found:
656 + cma_attach_to_dev(id_priv, cma_dev);
657 +- addr = (struct sockaddr_ib *) cma_src_addr(id_priv);
658 +- memcpy(&addr->sib_addr, &sgid, sizeof sgid);
659 ++ mutex_unlock(&lock);
660 ++ addr = (struct sockaddr_ib *)cma_src_addr(id_priv);
661 ++ memcpy(&addr->sib_addr, &sgid, sizeof(sgid));
662 + cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr);
663 + return 0;
664 + }
665 +diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
666 +index 46f062842a9a..db6bb026ae90 100644
667 +--- a/drivers/infiniband/sw/rxe/rxe_recv.c
668 ++++ b/drivers/infiniband/sw/rxe/rxe_recv.c
669 +@@ -225,9 +225,14 @@ static int hdr_check(struct rxe_pkt_info *pkt)
670 + goto err1;
671 + }
672 +
673 ++ if (unlikely(qpn == 0)) {
674 ++ pr_warn_once("QP 0 not supported");
675 ++ goto err1;
676 ++ }
677 ++
678 + if (qpn != IB_MULTICAST_QPN) {
679 +- index = (qpn == 0) ? port->qp_smi_index :
680 +- ((qpn == 1) ? port->qp_gsi_index : qpn);
681 ++ index = (qpn == 1) ? port->qp_gsi_index : qpn;
682 ++
683 + qp = rxe_pool_get_index(&rxe->qp_pool, index);
684 + if (unlikely(!qp)) {
685 + pr_warn_ratelimited("no qp matches qpn 0x%x\n", qpn);
686 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
687 +index 75761667be59..ad9b486ca7ea 100644
688 +--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
689 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
690 +@@ -1009,12 +1009,14 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
691 +
692 + skb_queue_head_init(&skqueue);
693 +
694 ++ netif_tx_lock_bh(p->dev);
695 + spin_lock_irq(&priv->lock);
696 + set_bit(IPOIB_FLAG_OPER_UP, &p->flags);
697 + if (p->neigh)
698 + while ((skb = __skb_dequeue(&p->neigh->queue)))
699 + __skb_queue_tail(&skqueue, skb);
700 + spin_unlock_irq(&priv->lock);
701 ++ netif_tx_unlock_bh(p->dev);
702 +
703 + while ((skb = __skb_dequeue(&skqueue))) {
704 + skb->dev = p->dev;
705 +diff --git a/drivers/input/touchscreen/rohm_bu21023.c b/drivers/input/touchscreen/rohm_bu21023.c
706 +index 611156a2ef80..be29984c0e4c 100644
707 +--- a/drivers/input/touchscreen/rohm_bu21023.c
708 ++++ b/drivers/input/touchscreen/rohm_bu21023.c
709 +@@ -304,7 +304,7 @@ static int rohm_i2c_burst_read(struct i2c_client *client, u8 start, void *buf,
710 + msg[1].len = len;
711 + msg[1].buf = buf;
712 +
713 +- i2c_lock_adapter(adap);
714 ++ i2c_lock_bus(adap, I2C_LOCK_SEGMENT);
715 +
716 + for (i = 0; i < 2; i++) {
717 + if (__i2c_transfer(adap, &msg[i], 1) < 0) {
718 +@@ -313,7 +313,7 @@ static int rohm_i2c_burst_read(struct i2c_client *client, u8 start, void *buf,
719 + }
720 + }
721 +
722 +- i2c_unlock_adapter(adap);
723 ++ i2c_unlock_bus(adap, I2C_LOCK_SEGMENT);
724 +
725 + return ret;
726 + }
727 +diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
728 +index 7f294f785ce6..ff4be1174ff0 100644
729 +--- a/drivers/iommu/arm-smmu-v3.c
730 ++++ b/drivers/iommu/arm-smmu-v3.c
731 +@@ -1233,6 +1233,7 @@ static irqreturn_t arm_smmu_priq_thread(int irq, void *dev)
732 +
733 + /* Sync our overflow flag, as we believe we're up to speed */
734 + q->cons = Q_OVF(q, q->prod) | Q_WRP(q, q->cons) | Q_IDX(q, q->cons);
735 ++ writel(q->cons, q->cons_reg);
736 + return IRQ_HANDLED;
737 + }
738 +
739 +diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c
740 +index 0ea8dd44026c..3a06c000f97b 100644
741 +--- a/drivers/media/pci/tw686x/tw686x-video.c
742 ++++ b/drivers/media/pci/tw686x/tw686x-video.c
743 +@@ -1190,6 +1190,14 @@ int tw686x_video_init(struct tw686x_dev *dev)
744 + return err;
745 + }
746 +
747 ++ /* Initialize vc->dev and vc->ch for the error path */
748 ++ for (ch = 0; ch < max_channels(dev); ch++) {
749 ++ struct tw686x_video_channel *vc = &dev->video_channels[ch];
750 ++
751 ++ vc->dev = dev;
752 ++ vc->ch = ch;
753 ++ }
754 ++
755 + for (ch = 0; ch < max_channels(dev); ch++) {
756 + struct tw686x_video_channel *vc = &dev->video_channels[ch];
757 + struct video_device *vdev;
758 +@@ -1198,9 +1206,6 @@ int tw686x_video_init(struct tw686x_dev *dev)
759 + spin_lock_init(&vc->qlock);
760 + INIT_LIST_HEAD(&vc->vidq_queued);
761 +
762 +- vc->dev = dev;
763 +- vc->ch = ch;
764 +-
765 + /* default settings */
766 + err = tw686x_set_standard(vc, V4L2_STD_NTSC);
767 + if (err)
768 +diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
769 +index b3a9fa75e8e7..f7ca1fab4808 100644
770 +--- a/drivers/media/v4l2-core/videobuf2-core.c
771 ++++ b/drivers/media/v4l2-core/videobuf2-core.c
772 +@@ -1375,6 +1375,11 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb)
773 + struct vb2_buffer *vb;
774 + int ret;
775 +
776 ++ if (q->error) {
777 ++ dprintk(1, "fatal error occurred on queue\n");
778 ++ return -EIO;
779 ++ }
780 ++
781 + vb = q->bufs[index];
782 +
783 + switch (vb->state) {
784 +diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c
785 +index 84e313107233..7b9052ea7413 100644
786 +--- a/drivers/mfd/88pm860x-i2c.c
787 ++++ b/drivers/mfd/88pm860x-i2c.c
788 +@@ -146,14 +146,14 @@ int pm860x_page_reg_write(struct i2c_client *i2c, int reg,
789 + unsigned char zero;
790 + int ret;
791 +
792 +- i2c_lock_adapter(i2c->adapter);
793 ++ i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
794 + read_device(i2c, 0xFA, 0, &zero);
795 + read_device(i2c, 0xFB, 0, &zero);
796 + read_device(i2c, 0xFF, 0, &zero);
797 + ret = write_device(i2c, reg, 1, &data);
798 + read_device(i2c, 0xFE, 0, &zero);
799 + read_device(i2c, 0xFC, 0, &zero);
800 +- i2c_unlock_adapter(i2c->adapter);
801 ++ i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
802 + return ret;
803 + }
804 + EXPORT_SYMBOL(pm860x_page_reg_write);
805 +@@ -164,14 +164,14 @@ int pm860x_page_bulk_read(struct i2c_client *i2c, int reg,
806 + unsigned char zero = 0;
807 + int ret;
808 +
809 +- i2c_lock_adapter(i2c->adapter);
810 ++ i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
811 + read_device(i2c, 0xfa, 0, &zero);
812 + read_device(i2c, 0xfb, 0, &zero);
813 + read_device(i2c, 0xff, 0, &zero);
814 + ret = read_device(i2c, reg, count, buf);
815 + read_device(i2c, 0xFE, 0, &zero);
816 + read_device(i2c, 0xFC, 0, &zero);
817 +- i2c_unlock_adapter(i2c->adapter);
818 ++ i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
819 + return ret;
820 + }
821 + EXPORT_SYMBOL(pm860x_page_bulk_read);
822 +diff --git a/drivers/misc/hmc6352.c b/drivers/misc/hmc6352.c
823 +index 90520d76633f..9cde4c5bfba4 100644
824 +--- a/drivers/misc/hmc6352.c
825 ++++ b/drivers/misc/hmc6352.c
826 +@@ -27,6 +27,7 @@
827 + #include <linux/err.h>
828 + #include <linux/delay.h>
829 + #include <linux/sysfs.h>
830 ++#include <linux/nospec.h>
831 +
832 + static DEFINE_MUTEX(compass_mutex);
833 +
834 +@@ -50,6 +51,7 @@ static int compass_store(struct device *dev, const char *buf, size_t count,
835 + return ret;
836 + if (val >= strlen(map))
837 + return -EINVAL;
838 ++ val = array_index_nospec(val, strlen(map));
839 + mutex_lock(&compass_mutex);
840 + ret = compass_command(c, map[val]);
841 + mutex_unlock(&compass_mutex);
842 +diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
843 +index 75b9d4ac8b1e..371f5f66a9d6 100644
844 +--- a/drivers/misc/mei/bus-fixup.c
845 ++++ b/drivers/misc/mei/bus-fixup.c
846 +@@ -178,7 +178,7 @@ static int mei_nfc_if_version(struct mei_cl *cl,
847 +
848 + ret = 0;
849 + bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length);
850 +- if (bytes_recv < if_version_length) {
851 ++ if (bytes_recv < 0 || bytes_recv < if_version_length) {
852 + dev_err(bus->dev, "Could not read IF version\n");
853 + ret = -EIO;
854 + goto err;
855 +diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
856 +index dd7f15a65eed..ae4a570abae3 100644
857 +--- a/drivers/misc/mei/hbm.c
858 ++++ b/drivers/misc/mei/hbm.c
859 +@@ -1137,15 +1137,18 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
860 +
861 + props_res = (struct hbm_props_response *)mei_msg;
862 +
863 +- if (props_res->status) {
864 ++ if (props_res->status == MEI_HBMS_CLIENT_NOT_FOUND) {
865 ++ dev_dbg(dev->dev, "hbm: properties response: %d CLIENT_NOT_FOUND\n",
866 ++ props_res->me_addr);
867 ++ } else if (props_res->status) {
868 + dev_err(dev->dev, "hbm: properties response: wrong status = %d %s\n",
869 + props_res->status,
870 + mei_hbm_status_str(props_res->status));
871 + return -EPROTO;
872 ++ } else {
873 ++ mei_hbm_me_cl_add(dev, props_res);
874 + }
875 +
876 +- mei_hbm_me_cl_add(dev, props_res);
877 +-
878 + /* request property for the next client */
879 + if (mei_hbm_prop_req(dev, props_res->me_addr + 1))
880 + return -EIO;
881 +diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
882 +index a082aa330f47..f7d1c8c4e5ad 100644
883 +--- a/drivers/mmc/host/omap_hsmmc.c
884 ++++ b/drivers/mmc/host/omap_hsmmc.c
885 +@@ -2215,6 +2215,7 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
886 + dma_release_channel(host->tx_chan);
887 + dma_release_channel(host->rx_chan);
888 +
889 ++ dev_pm_clear_wake_irq(host->dev);
890 + pm_runtime_dont_use_autosuspend(host->dev);
891 + pm_runtime_put_sync(host->dev);
892 + pm_runtime_disable(host->dev);
893 +diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
894 +index 20b6ff5b4af1..088a3ae0dff0 100644
895 +--- a/drivers/mmc/host/sdhci-tegra.c
896 ++++ b/drivers/mmc/host/sdhci-tegra.c
897 +@@ -350,7 +350,8 @@ static const struct sdhci_pltfm_data sdhci_tegra30_pdata = {
898 + SDHCI_QUIRK_NO_HISPD_BIT |
899 + SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
900 + SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
901 +- .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
902 ++ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
903 ++ SDHCI_QUIRK2_BROKEN_HS200,
904 + .ops = &tegra_sdhci_ops,
905 + };
906 +
907 +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
908 +index 44ea9d88651f..6bf58d27b6fc 100644
909 +--- a/drivers/mmc/host/sdhci.c
910 ++++ b/drivers/mmc/host/sdhci.c
911 +@@ -3328,14 +3328,21 @@ int sdhci_setup_host(struct sdhci_host *host)
912 + mmc_gpio_get_cd(host->mmc) < 0)
913 + mmc->caps |= MMC_CAP_NEEDS_POLL;
914 +
915 +- /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */
916 + if (!IS_ERR(mmc->supply.vqmmc)) {
917 + ret = regulator_enable(mmc->supply.vqmmc);
918 ++
919 ++ /* If vqmmc provides no 1.8V signalling, then there's no UHS */
920 + if (!regulator_is_supported_voltage(mmc->supply.vqmmc, 1700000,
921 + 1950000))
922 + host->caps1 &= ~(SDHCI_SUPPORT_SDR104 |
923 + SDHCI_SUPPORT_SDR50 |
924 + SDHCI_SUPPORT_DDR50);
925 ++
926 ++ /* In eMMC case vqmmc might be a fixed 1.8V regulator */
927 ++ if (!regulator_is_supported_voltage(mmc->supply.vqmmc, 2700000,
928 ++ 3600000))
929 ++ host->flags &= ~SDHCI_SIGNALING_330;
930 ++
931 + if (ret) {
932 + pr_warn("%s: Failed to enable vqmmc regulator: %d\n",
933 + mmc_hostname(mmc), ret);
934 +diff --git a/drivers/mtd/maps/solutionengine.c b/drivers/mtd/maps/solutionengine.c
935 +index bb580bc16445..c07f21b20463 100644
936 +--- a/drivers/mtd/maps/solutionengine.c
937 ++++ b/drivers/mtd/maps/solutionengine.c
938 +@@ -59,9 +59,9 @@ static int __init init_soleng_maps(void)
939 + return -ENXIO;
940 + }
941 + }
942 +- printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
943 +- soleng_flash_map.phys & 0x1fffffff,
944 +- soleng_eprom_map.phys & 0x1fffffff);
945 ++ printk(KERN_NOTICE "Solution Engine: Flash at 0x%pap, EPROM at 0x%pap\n",
946 ++ &soleng_flash_map.phys,
947 ++ &soleng_eprom_map.phys);
948 + flash_mtd->owner = THIS_MODULE;
949 +
950 + eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map);
951 +diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
952 +index b4092eab53ac..95b6a6640bca 100644
953 +--- a/drivers/mtd/mtdchar.c
954 ++++ b/drivers/mtd/mtdchar.c
955 +@@ -160,8 +160,12 @@ static ssize_t mtdchar_read(struct file *file, char __user *buf, size_t count,
956 +
957 + pr_debug("MTD_read\n");
958 +
959 +- if (*ppos + count > mtd->size)
960 +- count = mtd->size - *ppos;
961 ++ if (*ppos + count > mtd->size) {
962 ++ if (*ppos < mtd->size)
963 ++ count = mtd->size - *ppos;
964 ++ else
965 ++ count = 0;
966 ++ }
967 +
968 + if (!count)
969 + return 0;
970 +@@ -246,7 +250,7 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c
971 +
972 + pr_debug("MTD_write\n");
973 +
974 +- if (*ppos == mtd->size)
975 ++ if (*ppos >= mtd->size)
976 + return -ENOSPC;
977 +
978 + if (*ppos + count > mtd->size)
979 +diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
980 +index 30e855004c57..8887dd3abed7 100644
981 +--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
982 ++++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
983 +@@ -4500,7 +4500,7 @@ int be_cmd_get_profile_config(struct be_adapter *adapter,
984 + port_res->max_vfs += le16_to_cpu(pcie->num_vfs);
985 + }
986 + }
987 +- return status;
988 ++ goto err;
989 + }
990 +
991 + pcie = be_get_pcie_desc(resp->func_param, desc_count,
992 +diff --git a/drivers/net/ethernet/intel/e1000e/defines.h b/drivers/net/ethernet/intel/e1000e/defines.h
993 +index afb7ebe20b24..824fd44e25f0 100644
994 +--- a/drivers/net/ethernet/intel/e1000e/defines.h
995 ++++ b/drivers/net/ethernet/intel/e1000e/defines.h
996 +@@ -400,6 +400,10 @@
997 + #define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */
998 + #define E1000_ICR_RXO 0x00000040 /* Receiver Overrun */
999 + #define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */
1000 ++#define E1000_ICR_MDAC 0x00000200 /* MDIO Access Complete */
1001 ++#define E1000_ICR_SRPD 0x00010000 /* Small Receive Packet Detected */
1002 ++#define E1000_ICR_ACK 0x00020000 /* Receive ACK Frame Detected */
1003 ++#define E1000_ICR_MNG 0x00040000 /* Manageability Event Detected */
1004 + #define E1000_ICR_ECCER 0x00400000 /* Uncorrectable ECC Error */
1005 + /* If this bit asserted, the driver should claim the interrupt */
1006 + #define E1000_ICR_INT_ASSERTED 0x80000000
1007 +@@ -407,7 +411,7 @@
1008 + #define E1000_ICR_RXQ1 0x00200000 /* Rx Queue 1 Interrupt */
1009 + #define E1000_ICR_TXQ0 0x00400000 /* Tx Queue 0 Interrupt */
1010 + #define E1000_ICR_TXQ1 0x00800000 /* Tx Queue 1 Interrupt */
1011 +-#define E1000_ICR_OTHER 0x01000000 /* Other Interrupts */
1012 ++#define E1000_ICR_OTHER 0x01000000 /* Other Interrupt */
1013 +
1014 + /* PBA ECC Register */
1015 + #define E1000_PBA_ECC_COUNTER_MASK 0xFFF00000 /* ECC counter mask */
1016 +@@ -431,12 +435,27 @@
1017 + E1000_IMS_RXSEQ | \
1018 + E1000_IMS_LSC)
1019 +
1020 ++/* These are all of the events related to the OTHER interrupt.
1021 ++ */
1022 ++#define IMS_OTHER_MASK ( \
1023 ++ E1000_IMS_LSC | \
1024 ++ E1000_IMS_RXO | \
1025 ++ E1000_IMS_MDAC | \
1026 ++ E1000_IMS_SRPD | \
1027 ++ E1000_IMS_ACK | \
1028 ++ E1000_IMS_MNG)
1029 ++
1030 + /* Interrupt Mask Set */
1031 + #define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */
1032 + #define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */
1033 + #define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */
1034 + #define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */
1035 ++#define E1000_IMS_RXO E1000_ICR_RXO /* Receiver Overrun */
1036 + #define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */
1037 ++#define E1000_IMS_MDAC E1000_ICR_MDAC /* MDIO Access Complete */
1038 ++#define E1000_IMS_SRPD E1000_ICR_SRPD /* Small Receive Packet */
1039 ++#define E1000_IMS_ACK E1000_ICR_ACK /* Receive ACK Frame Detected */
1040 ++#define E1000_IMS_MNG E1000_ICR_MNG /* Manageability Event */
1041 + #define E1000_IMS_ECCER E1000_ICR_ECCER /* Uncorrectable ECC Error */
1042 + #define E1000_IMS_RXQ0 E1000_ICR_RXQ0 /* Rx Queue 0 Interrupt */
1043 + #define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */
1044 +diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
1045 +index 7ddac956ffb5..dc7d671b903c 100644
1046 +--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
1047 ++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
1048 +@@ -1364,9 +1364,6 @@ out:
1049 + * Checks to see of the link status of the hardware has changed. If a
1050 + * change in link status has been detected, then we read the PHY registers
1051 + * to get the current speed/duplex if link exists.
1052 +- *
1053 +- * Returns a negative error code (-E1000_ERR_*) or 0 (link down) or 1 (link
1054 +- * up).
1055 + **/
1056 + static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1057 + {
1058 +@@ -1382,7 +1379,8 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1059 + * Change or Rx Sequence Error interrupt.
1060 + */
1061 + if (!mac->get_link_status)
1062 +- return 1;
1063 ++ return 0;
1064 ++ mac->get_link_status = false;
1065 +
1066 + /* First we want to see if the MII Status Register reports
1067 + * link. If so, then we want to get the current speed/duplex
1068 +@@ -1390,12 +1388,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1069 + */
1070 + ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
1071 + if (ret_val)
1072 +- return ret_val;
1073 ++ goto out;
1074 +
1075 + if (hw->mac.type == e1000_pchlan) {
1076 + ret_val = e1000_k1_gig_workaround_hv(hw, link);
1077 + if (ret_val)
1078 +- return ret_val;
1079 ++ goto out;
1080 + }
1081 +
1082 + /* When connected at 10Mbps half-duplex, some parts are excessively
1083 +@@ -1430,7 +1428,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1084 +
1085 + ret_val = hw->phy.ops.acquire(hw);
1086 + if (ret_val)
1087 +- return ret_val;
1088 ++ goto out;
1089 +
1090 + if (hw->mac.type == e1000_pch2lan)
1091 + emi_addr = I82579_RX_CONFIG;
1092 +@@ -1453,7 +1451,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1093 + hw->phy.ops.release(hw);
1094 +
1095 + if (ret_val)
1096 +- return ret_val;
1097 ++ goto out;
1098 +
1099 + if (hw->mac.type == e1000_pch_spt) {
1100 + u16 data;
1101 +@@ -1462,14 +1460,14 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1102 + if (speed == SPEED_1000) {
1103 + ret_val = hw->phy.ops.acquire(hw);
1104 + if (ret_val)
1105 +- return ret_val;
1106 ++ goto out;
1107 +
1108 + ret_val = e1e_rphy_locked(hw,
1109 + PHY_REG(776, 20),
1110 + &data);
1111 + if (ret_val) {
1112 + hw->phy.ops.release(hw);
1113 +- return ret_val;
1114 ++ goto out;
1115 + }
1116 +
1117 + ptr_gap = (data & (0x3FF << 2)) >> 2;
1118 +@@ -1483,18 +1481,18 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1119 + }
1120 + hw->phy.ops.release(hw);
1121 + if (ret_val)
1122 +- return ret_val;
1123 ++ goto out;
1124 + } else {
1125 + ret_val = hw->phy.ops.acquire(hw);
1126 + if (ret_val)
1127 +- return ret_val;
1128 ++ goto out;
1129 +
1130 + ret_val = e1e_wphy_locked(hw,
1131 + PHY_REG(776, 20),
1132 + 0xC023);
1133 + hw->phy.ops.release(hw);
1134 + if (ret_val)
1135 +- return ret_val;
1136 ++ goto out;
1137 +
1138 + }
1139 + }
1140 +@@ -1521,7 +1519,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1141 + (hw->adapter->pdev->device == E1000_DEV_ID_PCH_I218_V3)) {
1142 + ret_val = e1000_k1_workaround_lpt_lp(hw, link);
1143 + if (ret_val)
1144 +- return ret_val;
1145 ++ goto out;
1146 + }
1147 + if ((hw->mac.type == e1000_pch_lpt) ||
1148 + (hw->mac.type == e1000_pch_spt)) {
1149 +@@ -1530,7 +1528,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1150 + */
1151 + ret_val = e1000_platform_pm_pch_lpt(hw, link);
1152 + if (ret_val)
1153 +- return ret_val;
1154 ++ goto out;
1155 + }
1156 +
1157 + /* Clear link partner's EEE ability */
1158 +@@ -1550,9 +1548,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1159 + }
1160 +
1161 + if (!link)
1162 +- return 0; /* No link detected */
1163 +-
1164 +- mac->get_link_status = false;
1165 ++ goto out;
1166 +
1167 + switch (hw->mac.type) {
1168 + case e1000_pch2lan:
1169 +@@ -1600,7 +1596,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1170 + * we have already determined whether we have link or not.
1171 + */
1172 + if (!mac->autoneg)
1173 +- return 1;
1174 ++ return -E1000_ERR_CONFIG;
1175 +
1176 + /* Auto-Neg is enabled. Auto Speed Detection takes care
1177 + * of MAC speed/duplex configuration. So we only need to
1178 +@@ -1614,12 +1610,14 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
1179 + * different link partner.
1180 + */
1181 + ret_val = e1000e_config_fc_after_link_up(hw);
1182 +- if (ret_val) {
1183 ++ if (ret_val)
1184 + e_dbg("Error configuring flow control\n");
1185 +- return ret_val;
1186 +- }
1187 +
1188 +- return 1;
1189 ++ return ret_val;
1190 ++
1191 ++out:
1192 ++ mac->get_link_status = true;
1193 ++ return ret_val;
1194 + }
1195 +
1196 + static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
1197 +diff --git a/drivers/net/ethernet/intel/e1000e/mac.c b/drivers/net/ethernet/intel/e1000e/mac.c
1198 +index db735644b312..5bdc3a2d4fd7 100644
1199 +--- a/drivers/net/ethernet/intel/e1000e/mac.c
1200 ++++ b/drivers/net/ethernet/intel/e1000e/mac.c
1201 +@@ -410,9 +410,6 @@ void e1000e_clear_hw_cntrs_base(struct e1000_hw *hw)
1202 + * Checks to see of the link status of the hardware has changed. If a
1203 + * change in link status has been detected, then we read the PHY registers
1204 + * to get the current speed/duplex if link exists.
1205 +- *
1206 +- * Returns a negative error code (-E1000_ERR_*) or 0 (link down) or 1 (link
1207 +- * up).
1208 + **/
1209 + s32 e1000e_check_for_copper_link(struct e1000_hw *hw)
1210 + {
1211 +@@ -426,20 +423,16 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw)
1212 + * Change or Rx Sequence Error interrupt.
1213 + */
1214 + if (!mac->get_link_status)
1215 +- return 1;
1216 ++ return 0;
1217 ++ mac->get_link_status = false;
1218 +
1219 + /* First we want to see if the MII Status Register reports
1220 + * link. If so, then we want to get the current speed/duplex
1221 + * of the PHY.
1222 + */
1223 + ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);
1224 +- if (ret_val)
1225 +- return ret_val;
1226 +-
1227 +- if (!link)
1228 +- return 0; /* No link detected */
1229 +-
1230 +- mac->get_link_status = false;
1231 ++ if (ret_val || !link)
1232 ++ goto out;
1233 +
1234 + /* Check if there was DownShift, must be checked
1235 + * immediately after link-up
1236 +@@ -450,7 +443,7 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw)
1237 + * we have already determined whether we have link or not.
1238 + */
1239 + if (!mac->autoneg)
1240 +- return 1;
1241 ++ return -E1000_ERR_CONFIG;
1242 +
1243 + /* Auto-Neg is enabled. Auto Speed Detection takes care
1244 + * of MAC speed/duplex configuration. So we only need to
1245 +@@ -464,12 +457,14 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw)
1246 + * different link partner.
1247 + */
1248 + ret_val = e1000e_config_fc_after_link_up(hw);
1249 +- if (ret_val) {
1250 ++ if (ret_val)
1251 + e_dbg("Error configuring flow control\n");
1252 +- return ret_val;
1253 +- }
1254 +
1255 +- return 1;
1256 ++ return ret_val;
1257 ++
1258 ++out:
1259 ++ mac->get_link_status = true;
1260 ++ return ret_val;
1261 + }
1262 +
1263 + /**
1264 +diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
1265 +index 9c95222e6536..6855b3380a83 100644
1266 +--- a/drivers/net/ethernet/intel/e1000e/netdev.c
1267 ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c
1268 +@@ -1911,30 +1911,20 @@ static irqreturn_t e1000_msix_other(int __always_unused irq, void *data)
1269 + struct net_device *netdev = data;
1270 + struct e1000_adapter *adapter = netdev_priv(netdev);
1271 + struct e1000_hw *hw = &adapter->hw;
1272 +- u32 icr;
1273 +- bool enable = true;
1274 +-
1275 +- icr = er32(ICR);
1276 +- if (icr & E1000_ICR_RXO) {
1277 +- ew32(ICR, E1000_ICR_RXO);
1278 +- enable = false;
1279 +- /* napi poll will re-enable Other, make sure it runs */
1280 +- if (napi_schedule_prep(&adapter->napi)) {
1281 +- adapter->total_rx_bytes = 0;
1282 +- adapter->total_rx_packets = 0;
1283 +- __napi_schedule(&adapter->napi);
1284 +- }
1285 +- }
1286 ++ u32 icr = er32(ICR);
1287 ++
1288 ++ if (icr & adapter->eiac_mask)
1289 ++ ew32(ICS, (icr & adapter->eiac_mask));
1290 ++
1291 + if (icr & E1000_ICR_LSC) {
1292 +- ew32(ICR, E1000_ICR_LSC);
1293 + hw->mac.get_link_status = true;
1294 + /* guard against interrupt when we're going down */
1295 + if (!test_bit(__E1000_DOWN, &adapter->state))
1296 + mod_timer(&adapter->watchdog_timer, jiffies + 1);
1297 + }
1298 +
1299 +- if (enable && !test_bit(__E1000_DOWN, &adapter->state))
1300 +- ew32(IMS, E1000_IMS_OTHER);
1301 ++ if (!test_bit(__E1000_DOWN, &adapter->state))
1302 ++ ew32(IMS, E1000_IMS_OTHER | IMS_OTHER_MASK);
1303 +
1304 + return IRQ_HANDLED;
1305 + }
1306 +@@ -2037,7 +2027,6 @@ static void e1000_configure_msix(struct e1000_adapter *adapter)
1307 + hw->hw_addr + E1000_EITR_82574(vector));
1308 + else
1309 + writel(1, hw->hw_addr + E1000_EITR_82574(vector));
1310 +- adapter->eiac_mask |= E1000_IMS_OTHER;
1311 +
1312 + /* Cause Tx interrupts on every write back */
1313 + ivar |= BIT(31);
1314 +@@ -2262,7 +2251,8 @@ static void e1000_irq_enable(struct e1000_adapter *adapter)
1315 +
1316 + if (adapter->msix_entries) {
1317 + ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574);
1318 +- ew32(IMS, adapter->eiac_mask | E1000_IMS_LSC);
1319 ++ ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER |
1320 ++ IMS_OTHER_MASK);
1321 + } else if ((hw->mac.type == e1000_pch_lpt) ||
1322 + (hw->mac.type == e1000_pch_spt)) {
1323 + ew32(IMS, IMS_ENABLE_MASK | E1000_IMS_ECCER);
1324 +@@ -2705,8 +2695,7 @@ static int e1000e_poll(struct napi_struct *napi, int weight)
1325 + napi_complete_done(napi, work_done);
1326 + if (!test_bit(__E1000_DOWN, &adapter->state)) {
1327 + if (adapter->msix_entries)
1328 +- ew32(IMS, adapter->rx_ring->ims_val |
1329 +- E1000_IMS_OTHER);
1330 ++ ew32(IMS, adapter->rx_ring->ims_val);
1331 + else
1332 + e1000_irq_enable(adapter);
1333 + }
1334 +@@ -5085,7 +5074,7 @@ static bool e1000e_has_link(struct e1000_adapter *adapter)
1335 + case e1000_media_type_copper:
1336 + if (hw->mac.get_link_status) {
1337 + ret_val = hw->mac.ops.check_for_link(hw);
1338 +- link_active = ret_val > 0;
1339 ++ link_active = !hw->mac.get_link_status;
1340 + } else {
1341 + link_active = true;
1342 + }
1343 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
1344 +index 8beecd615a21..448e71e07668 100644
1345 +--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
1346 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
1347 +@@ -339,9 +339,17 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev)
1348 + add_timer(&health->timer);
1349 + }
1350 +
1351 +-void mlx5_stop_health_poll(struct mlx5_core_dev *dev)
1352 ++void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health)
1353 + {
1354 + struct mlx5_core_health *health = &dev->priv.health;
1355 ++ unsigned long flags;
1356 ++
1357 ++ if (disable_health) {
1358 ++ spin_lock_irqsave(&health->wq_lock, flags);
1359 ++ set_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags);
1360 ++ set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags);
1361 ++ spin_unlock_irqrestore(&health->wq_lock, flags);
1362 ++ }
1363 +
1364 + del_timer_sync(&health->timer);
1365 + }
1366 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
1367 +index 3c183b8c083a..6698a3a07406 100644
1368 +--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
1369 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
1370 +@@ -787,8 +787,10 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
1371 + priv->numa_node = dev_to_node(&dev->pdev->dev);
1372 +
1373 + priv->dbg_root = debugfs_create_dir(dev_name(&pdev->dev), mlx5_debugfs_root);
1374 +- if (!priv->dbg_root)
1375 ++ if (!priv->dbg_root) {
1376 ++ dev_err(&pdev->dev, "Cannot create debugfs dir, aborting\n");
1377 + return -ENOMEM;
1378 ++ }
1379 +
1380 + err = mlx5_pci_enable_device(dev);
1381 + if (err) {
1382 +@@ -837,7 +839,7 @@ static void mlx5_pci_close(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
1383 + pci_clear_master(dev->pdev);
1384 + release_bar(dev->pdev);
1385 + mlx5_pci_disable_device(dev);
1386 +- debugfs_remove(priv->dbg_root);
1387 ++ debugfs_remove_recursive(priv->dbg_root);
1388 + }
1389 +
1390 + static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
1391 +@@ -1130,7 +1132,7 @@ err_cleanup_once:
1392 + mlx5_cleanup_once(dev);
1393 +
1394 + err_stop_poll:
1395 +- mlx5_stop_health_poll(dev);
1396 ++ mlx5_stop_health_poll(dev, boot);
1397 + if (mlx5_cmd_teardown_hca(dev)) {
1398 + dev_err(&dev->pdev->dev, "tear_down_hca failed, skip cleanup\n");
1399 + goto out_err;
1400 +@@ -1187,7 +1189,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
1401 + mlx5_disable_msix(dev);
1402 + if (cleanup)
1403 + mlx5_cleanup_once(dev);
1404 +- mlx5_stop_health_poll(dev);
1405 ++ mlx5_stop_health_poll(dev, cleanup);
1406 + err = mlx5_cmd_teardown_hca(dev);
1407 + if (err) {
1408 + dev_err(&dev->pdev->dev, "tear_down_hca failed, skip cleanup\n");
1409 +diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
1410 +index eee6e59e6cf3..2e8703da536d 100644
1411 +--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
1412 ++++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
1413 +@@ -990,7 +990,7 @@ static void nfp_net_tx_complete(struct nfp_net_tx_ring *tx_ring)
1414 + * @nn: NFP Net device
1415 + * @tx_ring: TX ring structure
1416 + *
1417 +- * Assumes that the device is stopped
1418 ++ * Assumes that the device is stopped, must be idempotent.
1419 + */
1420 + static void
1421 + nfp_net_tx_ring_reset(struct nfp_net *nn, struct nfp_net_tx_ring *tx_ring)
1422 +@@ -1144,13 +1144,18 @@ static void nfp_net_rx_give_one(struct nfp_net_rx_ring *rx_ring,
1423 + * nfp_net_rx_ring_reset() - Reflect in SW state of freelist after disable
1424 + * @rx_ring: RX ring structure
1425 + *
1426 +- * Warning: Do *not* call if ring buffers were never put on the FW freelist
1427 +- * (i.e. device was not enabled)!
1428 ++ * Assumes that the device is stopped, must be idempotent.
1429 + */
1430 + static void nfp_net_rx_ring_reset(struct nfp_net_rx_ring *rx_ring)
1431 + {
1432 + unsigned int wr_idx, last_idx;
1433 +
1434 ++ /* wr_p == rd_p means ring was never fed FL bufs. RX rings are always
1435 ++ * kept at cnt - 1 FL bufs.
1436 ++ */
1437 ++ if (rx_ring->wr_p == 0 && rx_ring->rd_p == 0)
1438 ++ return;
1439 ++
1440 + /* Move the empty entry to the end of the list */
1441 + wr_idx = rx_ring->wr_p % rx_ring->cnt;
1442 + last_idx = rx_ring->cnt - 1;
1443 +@@ -1919,6 +1924,8 @@ static void nfp_net_vec_clear_ring_data(struct nfp_net *nn, unsigned int idx)
1444 + /**
1445 + * nfp_net_clear_config_and_disable() - Clear control BAR and disable NFP
1446 + * @nn: NFP Net device to reconfigure
1447 ++ *
1448 ++ * Warning: must be fully idempotent.
1449 + */
1450 + static void nfp_net_clear_config_and_disable(struct nfp_net *nn)
1451 + {
1452 +diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
1453 +index a8bd68f252e9..7a62316c570d 100644
1454 +--- a/drivers/net/wan/fsl_ucc_hdlc.c
1455 ++++ b/drivers/net/wan/fsl_ucc_hdlc.c
1456 +@@ -161,7 +161,7 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
1457 + priv->ucc_pram_offset = qe_muram_alloc(sizeof(struct ucc_hdlc_param),
1458 + ALIGNMENT_OF_UCC_HDLC_PRAM);
1459 +
1460 +- if (priv->ucc_pram_offset < 0) {
1461 ++ if (IS_ERR_VALUE(priv->ucc_pram_offset)) {
1462 + dev_err(priv->dev, "Can not allocate MURAM for hdlc parameter.\n");
1463 + ret = -ENOMEM;
1464 + goto free_tx_bd;
1465 +@@ -197,14 +197,14 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
1466 +
1467 + /* Alloc riptr, tiptr */
1468 + riptr = qe_muram_alloc(32, 32);
1469 +- if (riptr < 0) {
1470 ++ if (IS_ERR_VALUE(riptr)) {
1471 + dev_err(priv->dev, "Cannot allocate MURAM mem for Receive internal temp data pointer\n");
1472 + ret = -ENOMEM;
1473 + goto free_tx_skbuff;
1474 + }
1475 +
1476 + tiptr = qe_muram_alloc(32, 32);
1477 +- if (tiptr < 0) {
1478 ++ if (IS_ERR_VALUE(tiptr)) {
1479 + dev_err(priv->dev, "Cannot allocate MURAM mem for Transmit internal temp data pointer\n");
1480 + ret = -ENOMEM;
1481 + goto free_riptr;
1482 +diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
1483 +index cd2c6ffdbdde..7f6af10f09ee 100644
1484 +--- a/drivers/net/xen-netfront.c
1485 ++++ b/drivers/net/xen-netfront.c
1486 +@@ -86,8 +86,7 @@ struct netfront_cb {
1487 + /* IRQ name is queue name with "-tx" or "-rx" appended */
1488 + #define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3)
1489 +
1490 +-static DECLARE_WAIT_QUEUE_HEAD(module_load_q);
1491 +-static DECLARE_WAIT_QUEUE_HEAD(module_unload_q);
1492 ++static DECLARE_WAIT_QUEUE_HEAD(module_wq);
1493 +
1494 + struct netfront_stats {
1495 + u64 packets;
1496 +@@ -1350,11 +1349,11 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
1497 + netif_carrier_off(netdev);
1498 +
1499 + xenbus_switch_state(dev, XenbusStateInitialising);
1500 +- wait_event(module_load_q,
1501 +- xenbus_read_driver_state(dev->otherend) !=
1502 +- XenbusStateClosed &&
1503 +- xenbus_read_driver_state(dev->otherend) !=
1504 +- XenbusStateUnknown);
1505 ++ wait_event(module_wq,
1506 ++ xenbus_read_driver_state(dev->otherend) !=
1507 ++ XenbusStateClosed &&
1508 ++ xenbus_read_driver_state(dev->otherend) !=
1509 ++ XenbusStateUnknown);
1510 + return netdev;
1511 +
1512 + exit:
1513 +@@ -1622,6 +1621,7 @@ static int xennet_init_queue(struct netfront_queue *queue)
1514 + {
1515 + unsigned short i;
1516 + int err = 0;
1517 ++ char *devid;
1518 +
1519 + spin_lock_init(&queue->tx_lock);
1520 + spin_lock_init(&queue->rx_lock);
1521 +@@ -1629,8 +1629,9 @@ static int xennet_init_queue(struct netfront_queue *queue)
1522 + setup_timer(&queue->rx_refill_timer, rx_refill_timeout,
1523 + (unsigned long)queue);
1524 +
1525 +- snprintf(queue->name, sizeof(queue->name), "%s-q%u",
1526 +- queue->info->netdev->name, queue->id);
1527 ++ devid = strrchr(queue->info->xbdev->nodename, '/') + 1;
1528 ++ snprintf(queue->name, sizeof(queue->name), "vif%s-q%u",
1529 ++ devid, queue->id);
1530 +
1531 + /* Initialise tx_skbs as a free chain containing every entry. */
1532 + queue->tx_skb_freelist = 0;
1533 +@@ -2037,15 +2038,14 @@ static void netback_changed(struct xenbus_device *dev,
1534 +
1535 + dev_dbg(&dev->dev, "%s\n", xenbus_strstate(backend_state));
1536 +
1537 ++ wake_up_all(&module_wq);
1538 ++
1539 + switch (backend_state) {
1540 + case XenbusStateInitialising:
1541 + case XenbusStateInitialised:
1542 + case XenbusStateReconfiguring:
1543 + case XenbusStateReconfigured:
1544 +- break;
1545 +-
1546 + case XenbusStateUnknown:
1547 +- wake_up_all(&module_unload_q);
1548 + break;
1549 +
1550 + case XenbusStateInitWait:
1551 +@@ -2061,12 +2061,10 @@ static void netback_changed(struct xenbus_device *dev,
1552 + break;
1553 +
1554 + case XenbusStateClosed:
1555 +- wake_up_all(&module_unload_q);
1556 + if (dev->state == XenbusStateClosed)
1557 + break;
1558 + /* Missed the backend's CLOSING state -- fallthrough */
1559 + case XenbusStateClosing:
1560 +- wake_up_all(&module_unload_q);
1561 + xenbus_frontend_closed(dev);
1562 + break;
1563 + }
1564 +@@ -2174,14 +2172,14 @@ static int xennet_remove(struct xenbus_device *dev)
1565 +
1566 + if (xenbus_read_driver_state(dev->otherend) != XenbusStateClosed) {
1567 + xenbus_switch_state(dev, XenbusStateClosing);
1568 +- wait_event(module_unload_q,
1569 ++ wait_event(module_wq,
1570 + xenbus_read_driver_state(dev->otherend) ==
1571 + XenbusStateClosing ||
1572 + xenbus_read_driver_state(dev->otherend) ==
1573 + XenbusStateUnknown);
1574 +
1575 + xenbus_switch_state(dev, XenbusStateClosed);
1576 +- wait_event(module_unload_q,
1577 ++ wait_event(module_wq,
1578 + xenbus_read_driver_state(dev->otherend) ==
1579 + XenbusStateClosed ||
1580 + xenbus_read_driver_state(dev->otherend) ==
1581 +diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
1582 +index 01cf1c1a841a..8de329546b82 100644
1583 +--- a/drivers/parport/parport_sunbpp.c
1584 ++++ b/drivers/parport/parport_sunbpp.c
1585 +@@ -286,12 +286,16 @@ static int bpp_probe(struct platform_device *op)
1586 +
1587 + ops = kmemdup(&parport_sunbpp_ops, sizeof(struct parport_operations),
1588 + GFP_KERNEL);
1589 +- if (!ops)
1590 ++ if (!ops) {
1591 ++ err = -ENOMEM;
1592 + goto out_unmap;
1593 ++ }
1594 +
1595 + dprintk(("register_port\n"));
1596 +- if (!(p = parport_register_port((unsigned long)base, irq, dma, ops)))
1597 ++ if (!(p = parport_register_port((unsigned long)base, irq, dma, ops))) {
1598 ++ err = -ENOMEM;
1599 + goto out_free_ops;
1600 ++ }
1601 +
1602 + p->size = size;
1603 + p->dev = &op->dev;
1604 +diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
1605 +index 664b641fd776..8093afd17aa4 100644
1606 +--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
1607 ++++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
1608 +@@ -287,31 +287,47 @@ static int pmic_gpio_config_get(struct pinctrl_dev *pctldev,
1609 +
1610 + switch (param) {
1611 + case PIN_CONFIG_DRIVE_PUSH_PULL:
1612 +- arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_CMOS;
1613 ++ if (pad->buffer_type != PMIC_GPIO_OUT_BUF_CMOS)
1614 ++ return -EINVAL;
1615 ++ arg = 1;
1616 + break;
1617 + case PIN_CONFIG_DRIVE_OPEN_DRAIN:
1618 +- arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS;
1619 ++ if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS)
1620 ++ return -EINVAL;
1621 ++ arg = 1;
1622 + break;
1623 + case PIN_CONFIG_DRIVE_OPEN_SOURCE:
1624 +- arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS;
1625 ++ if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS)
1626 ++ return -EINVAL;
1627 ++ arg = 1;
1628 + break;
1629 + case PIN_CONFIG_BIAS_PULL_DOWN:
1630 +- arg = pad->pullup == PMIC_GPIO_PULL_DOWN;
1631 ++ if (pad->pullup != PMIC_GPIO_PULL_DOWN)
1632 ++ return -EINVAL;
1633 ++ arg = 1;
1634 + break;
1635 + case PIN_CONFIG_BIAS_DISABLE:
1636 +- arg = pad->pullup = PMIC_GPIO_PULL_DISABLE;
1637 ++ if (pad->pullup != PMIC_GPIO_PULL_DISABLE)
1638 ++ return -EINVAL;
1639 ++ arg = 1;
1640 + break;
1641 + case PIN_CONFIG_BIAS_PULL_UP:
1642 +- arg = pad->pullup == PMIC_GPIO_PULL_UP_30;
1643 ++ if (pad->pullup != PMIC_GPIO_PULL_UP_30)
1644 ++ return -EINVAL;
1645 ++ arg = 1;
1646 + break;
1647 + case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
1648 +- arg = !pad->is_enabled;
1649 ++ if (pad->is_enabled)
1650 ++ return -EINVAL;
1651 ++ arg = 1;
1652 + break;
1653 + case PIN_CONFIG_POWER_SOURCE:
1654 + arg = pad->power_source;
1655 + break;
1656 + case PIN_CONFIG_INPUT_ENABLE:
1657 +- arg = pad->input_enabled;
1658 ++ if (!pad->input_enabled)
1659 ++ return -EINVAL;
1660 ++ arg = 1;
1661 + break;
1662 + case PIN_CONFIG_OUTPUT:
1663 + arg = pad->out_value;
1664 +diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
1665 +index 074bf2fa1c55..79a228937072 100644
1666 +--- a/drivers/platform/x86/toshiba_acpi.c
1667 ++++ b/drivers/platform/x86/toshiba_acpi.c
1668 +@@ -34,6 +34,7 @@
1669 + #define TOSHIBA_ACPI_VERSION "0.24"
1670 + #define PROC_INTERFACE_VERSION 1
1671 +
1672 ++#include <linux/compiler.h>
1673 + #include <linux/kernel.h>
1674 + #include <linux/module.h>
1675 + #include <linux/moduleparam.h>
1676 +@@ -1687,7 +1688,7 @@ static const struct file_operations keys_proc_fops = {
1677 + .write = keys_proc_write,
1678 + };
1679 +
1680 +-static int version_proc_show(struct seq_file *m, void *v)
1681 ++static int __maybe_unused version_proc_show(struct seq_file *m, void *v)
1682 + {
1683 + seq_printf(m, "driver: %s\n", TOSHIBA_ACPI_VERSION);
1684 + seq_printf(m, "proc_interface: %d\n", PROC_INTERFACE_VERSION);
1685 +diff --git a/drivers/rtc/rtc-bq4802.c b/drivers/rtc/rtc-bq4802.c
1686 +index bd170cb3361c..5747a54cbd42 100644
1687 +--- a/drivers/rtc/rtc-bq4802.c
1688 ++++ b/drivers/rtc/rtc-bq4802.c
1689 +@@ -164,6 +164,10 @@ static int bq4802_probe(struct platform_device *pdev)
1690 + } else if (p->r->flags & IORESOURCE_MEM) {
1691 + p->regs = devm_ioremap(&pdev->dev, p->r->start,
1692 + resource_size(p->r));
1693 ++ if (!p->regs){
1694 ++ err = -ENOMEM;
1695 ++ goto out;
1696 ++ }
1697 + p->read = bq4802_read_mem;
1698 + p->write = bq4802_write_mem;
1699 + } else {
1700 +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
1701 +index 283416aefa56..258a72869f57 100644
1702 +--- a/drivers/s390/net/qeth_core_main.c
1703 ++++ b/drivers/s390/net/qeth_core_main.c
1704 +@@ -3499,13 +3499,14 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index,
1705 + qdio_flags = QDIO_FLAG_SYNC_OUTPUT;
1706 + if (atomic_read(&queue->set_pci_flags_count))
1707 + qdio_flags |= QDIO_FLAG_PCI_OUT;
1708 ++ atomic_add(count, &queue->used_buffers);
1709 ++
1710 + rc = do_QDIO(CARD_DDEV(queue->card), qdio_flags,
1711 + queue->queue_no, index, count);
1712 + if (queue->card->options.performance_stats)
1713 + queue->card->perf_stats.outbound_do_qdio_time +=
1714 + qeth_get_micros() -
1715 + queue->card->perf_stats.outbound_do_qdio_start_time;
1716 +- atomic_add(count, &queue->used_buffers);
1717 + if (rc) {
1718 + queue->card->stats.tx_errors += count;
1719 + /* ignore temporary SIGA errors without busy condition */
1720 +diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
1721 +index db6a285d41e0..0a7a6da36dfd 100644
1722 +--- a/drivers/s390/net/qeth_core_sys.c
1723 ++++ b/drivers/s390/net/qeth_core_sys.c
1724 +@@ -423,6 +423,7 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
1725 + if (card->discipline) {
1726 + card->discipline->remove(card->gdev);
1727 + qeth_core_free_discipline(card);
1728 ++ card->options.layer2 = -1;
1729 + }
1730 +
1731 + rc = qeth_core_load_discipline(card, newdis);
1732 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
1733 +index a9c950d29ce2..25ae9b9895a9 100644
1734 +--- a/drivers/usb/class/cdc-acm.c
1735 ++++ b/drivers/usb/class/cdc-acm.c
1736 +@@ -705,20 +705,9 @@ static int acm_tty_write(struct tty_struct *tty,
1737 + }
1738 +
1739 + if (acm->susp_count) {
1740 +- if (acm->putbuffer) {
1741 +- /* now to preserve order */
1742 +- usb_anchor_urb(acm->putbuffer->urb, &acm->delayed);
1743 +- acm->putbuffer = NULL;
1744 +- }
1745 + usb_anchor_urb(wb->urb, &acm->delayed);
1746 + spin_unlock_irqrestore(&acm->write_lock, flags);
1747 + return count;
1748 +- } else {
1749 +- if (acm->putbuffer) {
1750 +- /* at this point there is no good way to handle errors */
1751 +- acm_start_wb(acm, acm->putbuffer);
1752 +- acm->putbuffer = NULL;
1753 +- }
1754 + }
1755 +
1756 + stat = acm_start_wb(acm, wb);
1757 +@@ -729,66 +718,6 @@ static int acm_tty_write(struct tty_struct *tty,
1758 + return count;
1759 + }
1760 +
1761 +-static void acm_tty_flush_chars(struct tty_struct *tty)
1762 +-{
1763 +- struct acm *acm = tty->driver_data;
1764 +- struct acm_wb *cur;
1765 +- int err;
1766 +- unsigned long flags;
1767 +-
1768 +- spin_lock_irqsave(&acm->write_lock, flags);
1769 +-
1770 +- cur = acm->putbuffer;
1771 +- if (!cur) /* nothing to do */
1772 +- goto out;
1773 +-
1774 +- acm->putbuffer = NULL;
1775 +- err = usb_autopm_get_interface_async(acm->control);
1776 +- if (err < 0) {
1777 +- cur->use = 0;
1778 +- acm->putbuffer = cur;
1779 +- goto out;
1780 +- }
1781 +-
1782 +- if (acm->susp_count)
1783 +- usb_anchor_urb(cur->urb, &acm->delayed);
1784 +- else
1785 +- acm_start_wb(acm, cur);
1786 +-out:
1787 +- spin_unlock_irqrestore(&acm->write_lock, flags);
1788 +- return;
1789 +-}
1790 +-
1791 +-static int acm_tty_put_char(struct tty_struct *tty, unsigned char ch)
1792 +-{
1793 +- struct acm *acm = tty->driver_data;
1794 +- struct acm_wb *cur;
1795 +- int wbn;
1796 +- unsigned long flags;
1797 +-
1798 +-overflow:
1799 +- cur = acm->putbuffer;
1800 +- if (!cur) {
1801 +- spin_lock_irqsave(&acm->write_lock, flags);
1802 +- wbn = acm_wb_alloc(acm);
1803 +- if (wbn >= 0) {
1804 +- cur = &acm->wb[wbn];
1805 +- acm->putbuffer = cur;
1806 +- }
1807 +- spin_unlock_irqrestore(&acm->write_lock, flags);
1808 +- if (!cur)
1809 +- return 0;
1810 +- }
1811 +-
1812 +- if (cur->len == acm->writesize) {
1813 +- acm_tty_flush_chars(tty);
1814 +- goto overflow;
1815 +- }
1816 +-
1817 +- cur->buf[cur->len++] = ch;
1818 +- return 1;
1819 +-}
1820 +-
1821 + static int acm_tty_write_room(struct tty_struct *tty)
1822 + {
1823 + struct acm *acm = tty->driver_data;
1824 +@@ -1940,8 +1869,6 @@ static const struct tty_operations acm_ops = {
1825 + .cleanup = acm_tty_cleanup,
1826 + .hangup = acm_tty_hangup,
1827 + .write = acm_tty_write,
1828 +- .put_char = acm_tty_put_char,
1829 +- .flush_chars = acm_tty_flush_chars,
1830 + .write_room = acm_tty_write_room,
1831 + .ioctl = acm_tty_ioctl,
1832 + .throttle = acm_tty_throttle,
1833 +diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
1834 +index 1f1eabfd8462..b30ac5fcde68 100644
1835 +--- a/drivers/usb/class/cdc-acm.h
1836 ++++ b/drivers/usb/class/cdc-acm.h
1837 +@@ -94,7 +94,6 @@ struct acm {
1838 + unsigned long read_urbs_free;
1839 + struct urb *read_urbs[ACM_NR];
1840 + struct acm_rb read_buffers[ACM_NR];
1841 +- struct acm_wb *putbuffer; /* for acm_tty_put_char() */
1842 + int rx_buflimit;
1843 + spinlock_t read_lock;
1844 + int write_used; /* number of non-empty write buffers */
1845 +diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
1846 +index 9f001659807a..adc0f78dc54d 100644
1847 +--- a/drivers/usb/class/cdc-wdm.c
1848 ++++ b/drivers/usb/class/cdc-wdm.c
1849 +@@ -470,7 +470,7 @@ static int service_outstanding_interrupt(struct wdm_device *desc)
1850 +
1851 + set_bit(WDM_RESPONDING, &desc->flags);
1852 + spin_unlock_irq(&desc->iuspin);
1853 +- rv = usb_submit_urb(desc->response, GFP_KERNEL);
1854 ++ rv = usb_submit_urb(desc->response, GFP_ATOMIC);
1855 + spin_lock_irq(&desc->iuspin);
1856 + if (rv) {
1857 + dev_err(&desc->intf->dev,
1858 +diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
1859 +index 7859d738df41..7af23b215254 100644
1860 +--- a/drivers/usb/core/hcd-pci.c
1861 ++++ b/drivers/usb/core/hcd-pci.c
1862 +@@ -528,8 +528,6 @@ static int resume_common(struct device *dev, int event)
1863 + event == PM_EVENT_RESTORE);
1864 + if (retval) {
1865 + dev_err(dev, "PCI post-resume error %d!\n", retval);
1866 +- if (hcd->shared_hcd)
1867 +- usb_hc_died(hcd->shared_hcd);
1868 + usb_hc_died(hcd);
1869 + }
1870 + }
1871 +diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
1872 +index 9cb66475c211..c0c5d5b3ec40 100644
1873 +--- a/drivers/usb/core/message.c
1874 ++++ b/drivers/usb/core/message.c
1875 +@@ -1279,6 +1279,11 @@ void usb_enable_interface(struct usb_device *dev,
1876 + * is submitted that needs that bandwidth. Some other operating systems
1877 + * allocate bandwidth early, when a configuration is chosen.
1878 + *
1879 ++ * xHCI reserves bandwidth and configures the alternate setting in
1880 ++ * usb_hcd_alloc_bandwidth(). If it fails the original interface altsetting
1881 ++ * may be disabled. Drivers cannot rely on any particular alternate
1882 ++ * setting being in effect after a failure.
1883 ++ *
1884 + * This call is synchronous, and may not be used in an interrupt context.
1885 + * Also, drivers must not change altsettings while urbs are scheduled for
1886 + * endpoints in that interface; all such urbs must first be completed
1887 +@@ -1314,6 +1319,12 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1888 + alternate);
1889 + return -EINVAL;
1890 + }
1891 ++ /*
1892 ++ * usb3 hosts configure the interface in usb_hcd_alloc_bandwidth,
1893 ++ * including freeing dropped endpoint ring buffers.
1894 ++ * Make sure the interface endpoints are flushed before that
1895 ++ */
1896 ++ usb_disable_interface(dev, iface, false);
1897 +
1898 + /* Make sure we have enough bandwidth for this alternate interface.
1899 + * Remove the current alt setting and add the new alt setting.
1900 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1901 +index 99f67764765f..37a5e07b3488 100644
1902 +--- a/drivers/usb/core/quirks.c
1903 ++++ b/drivers/usb/core/quirks.c
1904 +@@ -37,6 +37,10 @@ static const struct usb_device_id usb_quirk_list[] = {
1905 + /* CBM - Flash disk */
1906 + { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
1907 +
1908 ++ /* WORLDE Controller KS49 or Prodipe MIDI 49C USB controller */
1909 ++ { USB_DEVICE(0x0218, 0x0201), .driver_info =
1910 ++ USB_QUIRK_CONFIG_INTF_STRINGS },
1911 ++
1912 + /* WORLDE easy key (easykey.25) MIDI controller */
1913 + { USB_DEVICE(0x0218, 0x0401), .driver_info =
1914 + USB_QUIRK_CONFIG_INTF_STRINGS },
1915 +@@ -259,6 +263,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1916 + { USB_DEVICE(0x2040, 0x7200), .driver_info =
1917 + USB_QUIRK_CONFIG_INTF_STRINGS },
1918 +
1919 ++ /* DJI CineSSD */
1920 ++ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
1921 ++
1922 + /* INTEL VALUE SSD */
1923 + { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
1924 +
1925 +diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
1926 +index d133252ef2c3..7a8c36642293 100644
1927 +--- a/drivers/usb/gadget/udc/net2280.c
1928 ++++ b/drivers/usb/gadget/udc/net2280.c
1929 +@@ -1549,11 +1549,14 @@ static int net2280_pullup(struct usb_gadget *_gadget, int is_on)
1930 + writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
1931 + } else {
1932 + writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
1933 +- stop_activity(dev, dev->driver);
1934 ++ stop_activity(dev, NULL);
1935 + }
1936 +
1937 + spin_unlock_irqrestore(&dev->lock, flags);
1938 +
1939 ++ if (!is_on && dev->driver)
1940 ++ dev->driver->disconnect(&dev->gadget);
1941 ++
1942 + return 0;
1943 + }
1944 +
1945 +@@ -2470,8 +2473,11 @@ static void stop_activity(struct net2280 *dev, struct usb_gadget_driver *driver)
1946 + nuke(&dev->ep[i]);
1947 +
1948 + /* report disconnect; the driver is already quiesced */
1949 +- if (driver)
1950 ++ if (driver) {
1951 ++ spin_unlock(&dev->lock);
1952 + driver->disconnect(&dev->gadget);
1953 ++ spin_lock(&dev->lock);
1954 ++ }
1955 +
1956 + usb_reinit(dev);
1957 + }
1958 +@@ -3345,6 +3351,8 @@ next_endpoints:
1959 + BIT(PCI_RETRY_ABORT_INTERRUPT))
1960 +
1961 + static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
1962 ++__releases(dev->lock)
1963 ++__acquires(dev->lock)
1964 + {
1965 + struct net2280_ep *ep;
1966 + u32 tmp, num, mask, scratch;
1967 +@@ -3385,12 +3393,14 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
1968 + if (disconnect || reset) {
1969 + stop_activity(dev, dev->driver);
1970 + ep0_start(dev);
1971 ++ spin_unlock(&dev->lock);
1972 + if (reset)
1973 + usb_gadget_udc_reset
1974 + (&dev->gadget, dev->driver);
1975 + else
1976 + (dev->driver->disconnect)
1977 + (&dev->gadget);
1978 ++ spin_lock(&dev->lock);
1979 + return;
1980 + }
1981 + }
1982 +@@ -3409,6 +3419,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
1983 + tmp = BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT);
1984 + if (stat & tmp) {
1985 + writel(tmp, &dev->regs->irqstat1);
1986 ++ spin_unlock(&dev->lock);
1987 + if (stat & BIT(SUSPEND_REQUEST_INTERRUPT)) {
1988 + if (dev->driver->suspend)
1989 + dev->driver->suspend(&dev->gadget);
1990 +@@ -3419,6 +3430,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
1991 + dev->driver->resume(&dev->gadget);
1992 + /* at high speed, note erratum 0133 */
1993 + }
1994 ++ spin_lock(&dev->lock);
1995 + stat &= ~tmp;
1996 + }
1997 +
1998 +diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
1999 +index b1ae944c83a9..924c08ab0724 100644
2000 +--- a/drivers/usb/gadget/udc/renesas_usb3.c
2001 ++++ b/drivers/usb/gadget/udc/renesas_usb3.c
2002 +@@ -628,12 +628,15 @@ static void usb3_irq_epc_int_1_speed(struct renesas_usb3 *usb3)
2003 + switch (speed) {
2004 + case USB_STA_SPEED_SS:
2005 + usb3->gadget.speed = USB_SPEED_SUPER;
2006 ++ usb3->gadget.ep0->maxpacket = USB3_EP0_SS_MAX_PACKET_SIZE;
2007 + break;
2008 + case USB_STA_SPEED_HS:
2009 + usb3->gadget.speed = USB_SPEED_HIGH;
2010 ++ usb3->gadget.ep0->maxpacket = USB3_EP0_HSFS_MAX_PACKET_SIZE;
2011 + break;
2012 + case USB_STA_SPEED_FS:
2013 + usb3->gadget.speed = USB_SPEED_FULL;
2014 ++ usb3->gadget.ep0->maxpacket = USB3_EP0_HSFS_MAX_PACKET_SIZE;
2015 + break;
2016 + default:
2017 + usb3->gadget.speed = USB_SPEED_UNKNOWN;
2018 +@@ -1858,7 +1861,7 @@ static int renesas_usb3_init_ep(struct renesas_usb3 *usb3, struct device *dev,
2019 + /* for control pipe */
2020 + usb3->gadget.ep0 = &usb3_ep->ep;
2021 + usb_ep_set_maxpacket_limit(&usb3_ep->ep,
2022 +- USB3_EP0_HSFS_MAX_PACKET_SIZE);
2023 ++ USB3_EP0_SS_MAX_PACKET_SIZE);
2024 + usb3_ep->ep.caps.type_control = true;
2025 + usb3_ep->ep.caps.dir_in = true;
2026 + usb3_ep->ep.caps.dir_out = true;
2027 +diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
2028 +index 43d52931b5bf..43618976d68a 100644
2029 +--- a/drivers/usb/host/u132-hcd.c
2030 ++++ b/drivers/usb/host/u132-hcd.c
2031 +@@ -2559,7 +2559,7 @@ static int u132_get_frame(struct usb_hcd *hcd)
2032 + } else {
2033 + int frame = 0;
2034 + dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n");
2035 +- msleep(100);
2036 ++ mdelay(100);
2037 + return frame;
2038 + }
2039 + }
2040 +diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
2041 +index 9ff66525924e..e77465a30ac6 100644
2042 +--- a/drivers/usb/misc/uss720.c
2043 ++++ b/drivers/usb/misc/uss720.c
2044 +@@ -385,7 +385,7 @@ static unsigned char parport_uss720_frob_control(struct parport *pp, unsigned ch
2045 + mask &= 0x0f;
2046 + val &= 0x0f;
2047 + d = (priv->reg[1] & (~mask)) ^ val;
2048 +- if (set_1284_register(pp, 2, d, GFP_KERNEL))
2049 ++ if (set_1284_register(pp, 2, d, GFP_ATOMIC))
2050 + return 0;
2051 + priv->reg[1] = d;
2052 + return d & 0xf;
2053 +@@ -395,7 +395,7 @@ static unsigned char parport_uss720_read_status(struct parport *pp)
2054 + {
2055 + unsigned char ret;
2056 +
2057 +- if (get_1284_register(pp, 1, &ret, GFP_KERNEL))
2058 ++ if (get_1284_register(pp, 1, &ret, GFP_ATOMIC))
2059 + return 0;
2060 + return ret & 0xf8;
2061 + }
2062 +diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
2063 +index f36968ee2e70..e36c6c6452cd 100644
2064 +--- a/drivers/usb/misc/yurex.c
2065 ++++ b/drivers/usb/misc/yurex.c
2066 +@@ -431,13 +431,13 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
2067 + {
2068 + struct usb_yurex *dev;
2069 + int i, set = 0, retval = 0;
2070 +- char buffer[16];
2071 ++ char buffer[16 + 1];
2072 + char *data = buffer;
2073 + unsigned long long c, c2 = 0;
2074 + signed long timeout = 0;
2075 + DEFINE_WAIT(wait);
2076 +
2077 +- count = min(sizeof(buffer), count);
2078 ++ count = min(sizeof(buffer) - 1, count);
2079 + dev = file->private_data;
2080 +
2081 + /* verify that we actually have some data to write */
2082 +@@ -456,6 +456,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
2083 + retval = -EFAULT;
2084 + goto error;
2085 + }
2086 ++ buffer[count] = 0;
2087 + memset(dev->cntl_buffer, CMD_PADDING, YUREX_BUF_SIZE);
2088 +
2089 + switch (buffer[0]) {
2090 +diff --git a/drivers/usb/serial/io_ti.h b/drivers/usb/serial/io_ti.h
2091 +index 1bd67b24f916..bc9ff5ebd67c 100644
2092 +--- a/drivers/usb/serial/io_ti.h
2093 ++++ b/drivers/usb/serial/io_ti.h
2094 +@@ -178,7 +178,7 @@ struct ump_interrupt {
2095 + } __attribute__((packed));
2096 +
2097 +
2098 +-#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3)
2099 ++#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 6) & 0x01)
2100 + #define TIUMP_GET_FUNC_FROM_CODE(c) ((c) & 0x0f)
2101 + #define TIUMP_INTERRUPT_CODE_LSR 0x03
2102 + #define TIUMP_INTERRUPT_CODE_MSR 0x04
2103 +diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
2104 +index 6bcb874b4832..836cb93ba49e 100644
2105 +--- a/drivers/usb/serial/ti_usb_3410_5052.c
2106 ++++ b/drivers/usb/serial/ti_usb_3410_5052.c
2107 +@@ -1129,7 +1129,7 @@ static void ti_break(struct tty_struct *tty, int break_state)
2108 +
2109 + static int ti_get_port_from_code(unsigned char code)
2110 + {
2111 +- return (code >> 4) - 3;
2112 ++ return (code >> 6) & 0x01;
2113 + }
2114 +
2115 + static int ti_get_func_from_code(unsigned char code)
2116 +diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
2117 +index 8cd2926fb1fe..344ec8631481 100644
2118 +--- a/drivers/usb/storage/scsiglue.c
2119 ++++ b/drivers/usb/storage/scsiglue.c
2120 +@@ -392,6 +392,15 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
2121 + return 0;
2122 + }
2123 +
2124 ++ if ((us->fflags & US_FL_NO_ATA_1X) &&
2125 ++ (srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) {
2126 ++ memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB,
2127 ++ sizeof(usb_stor_sense_invalidCDB));
2128 ++ srb->result = SAM_STAT_CHECK_CONDITION;
2129 ++ done(srb);
2130 ++ return 0;
2131 ++ }
2132 ++
2133 + /* enqueue the command and wake up the control thread */
2134 + srb->scsi_done = done;
2135 + us->srb = srb;
2136 +diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
2137 +index 8dd200f92020..64af88977b03 100644
2138 +--- a/drivers/usb/storage/uas.c
2139 ++++ b/drivers/usb/storage/uas.c
2140 +@@ -842,6 +842,27 @@ static int uas_slave_configure(struct scsi_device *sdev)
2141 + sdev->skip_ms_page_8 = 1;
2142 + sdev->wce_default_on = 1;
2143 + }
2144 ++
2145 ++ /*
2146 ++ * Some disks return the total number of blocks in response
2147 ++ * to READ CAPACITY rather than the highest block number.
2148 ++ * If this device makes that mistake, tell the sd driver.
2149 ++ */
2150 ++ if (devinfo->flags & US_FL_FIX_CAPACITY)
2151 ++ sdev->fix_capacity = 1;
2152 ++
2153 ++ /*
2154 ++ * Some devices don't like MODE SENSE with page=0x3f,
2155 ++ * which is the command used for checking if a device
2156 ++ * is write-protected. Now that we tell the sd driver
2157 ++ * to do a 192-byte transfer with this command the
2158 ++ * majority of devices work fine, but a few still can't
2159 ++ * handle it. The sd driver will simply assume those
2160 ++ * devices are write-enabled.
2161 ++ */
2162 ++ if (devinfo->flags & US_FL_NO_WP_DETECT)
2163 ++ sdev->skip_ms_page_3f = 1;
2164 ++
2165 + scsi_change_queue_depth(sdev, devinfo->qdepth - 2);
2166 + return 0;
2167 + }
2168 +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
2169 +index fc5ed351defb..0a86b3f3638e 100644
2170 +--- a/drivers/usb/storage/unusual_devs.h
2171 ++++ b/drivers/usb/storage/unusual_devs.h
2172 +@@ -2307,6 +2307,13 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
2173 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2174 + US_FL_GO_SLOW ),
2175 +
2176 ++/* Reported-by: Tim Anderson <tsa@×××××××××××××××.com> */
2177 ++UNUSUAL_DEV( 0x2ca3, 0x0031, 0x0000, 0x9999,
2178 ++ "DJI",
2179 ++ "CineSSD",
2180 ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2181 ++ US_FL_NO_ATA_1X),
2182 ++
2183 + /*
2184 + * Reported by Frederic Marchal <frederic.marchal@××××××××××.com>
2185 + * Mio Moov 330
2186 +diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c
2187 +index 2510fa728d77..de119f11b78f 100644
2188 +--- a/drivers/video/fbdev/core/modedb.c
2189 ++++ b/drivers/video/fbdev/core/modedb.c
2190 +@@ -644,7 +644,7 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
2191 + *
2192 + * Valid mode specifiers for @mode_option:
2193 + *
2194 +- * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] or
2195 ++ * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][p][m] or
2196 + * <name>[-<bpp>][@<refresh>]
2197 + *
2198 + * with <xres>, <yres>, <bpp> and <refresh> decimal numbers and
2199 +@@ -653,10 +653,10 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
2200 + * If 'M' is present after yres (and before refresh/bpp if present),
2201 + * the function will compute the timings using VESA(tm) Coordinated
2202 + * Video Timings (CVT). If 'R' is present after 'M', will compute with
2203 +- * reduced blanking (for flatpanels). If 'i' is present, compute
2204 +- * interlaced mode. If 'm' is present, add margins equal to 1.8%
2205 +- * of xres rounded down to 8 pixels, and 1.8% of yres. The char
2206 +- * 'i' and 'm' must be after 'M' and 'R'. Example:
2207 ++ * reduced blanking (for flatpanels). If 'i' or 'p' are present, compute
2208 ++ * interlaced or progressive mode. If 'm' is present, add margins equal
2209 ++ * to 1.8% of xres rounded down to 8 pixels, and 1.8% of yres. The chars
2210 ++ * 'i', 'p' and 'm' must be after 'M' and 'R'. Example:
2211 + *
2212 + * 1024x768MR-8@60m - Reduced blank with margins at 60Hz.
2213 + *
2214 +@@ -697,7 +697,8 @@ int fb_find_mode(struct fb_var_screeninfo *var,
2215 + unsigned int namelen = strlen(name);
2216 + int res_specified = 0, bpp_specified = 0, refresh_specified = 0;
2217 + unsigned int xres = 0, yres = 0, bpp = default_bpp, refresh = 0;
2218 +- int yres_specified = 0, cvt = 0, rb = 0, interlace = 0;
2219 ++ int yres_specified = 0, cvt = 0, rb = 0;
2220 ++ int interlace_specified = 0, interlace = 0;
2221 + int margins = 0;
2222 + u32 best, diff, tdiff;
2223 +
2224 +@@ -748,9 +749,17 @@ int fb_find_mode(struct fb_var_screeninfo *var,
2225 + if (!cvt)
2226 + margins = 1;
2227 + break;
2228 ++ case 'p':
2229 ++ if (!cvt) {
2230 ++ interlace = 0;
2231 ++ interlace_specified = 1;
2232 ++ }
2233 ++ break;
2234 + case 'i':
2235 +- if (!cvt)
2236 ++ if (!cvt) {
2237 + interlace = 1;
2238 ++ interlace_specified = 1;
2239 ++ }
2240 + break;
2241 + default:
2242 + goto done;
2243 +@@ -819,11 +828,21 @@ done:
2244 + if ((name_matches(db[i], name, namelen) ||
2245 + (res_specified && res_matches(db[i], xres, yres))) &&
2246 + !fb_try_mode(var, info, &db[i], bpp)) {
2247 +- if (refresh_specified && db[i].refresh == refresh)
2248 +- return 1;
2249 ++ const int db_interlace = (db[i].vmode &
2250 ++ FB_VMODE_INTERLACED ? 1 : 0);
2251 ++ int score = abs(db[i].refresh - refresh);
2252 ++
2253 ++ if (interlace_specified)
2254 ++ score += abs(db_interlace - interlace);
2255 ++
2256 ++ if (!interlace_specified ||
2257 ++ db_interlace == interlace)
2258 ++ if (refresh_specified &&
2259 ++ db[i].refresh == refresh)
2260 ++ return 1;
2261 +
2262 +- if (abs(db[i].refresh - refresh) < diff) {
2263 +- diff = abs(db[i].refresh - refresh);
2264 ++ if (score < diff) {
2265 ++ diff = score;
2266 + best = i;
2267 + }
2268 + }
2269 +diff --git a/drivers/video/fbdev/goldfishfb.c b/drivers/video/fbdev/goldfishfb.c
2270 +index 7f6c9e6cfc6c..14a93cb21310 100644
2271 +--- a/drivers/video/fbdev/goldfishfb.c
2272 ++++ b/drivers/video/fbdev/goldfishfb.c
2273 +@@ -301,6 +301,7 @@ static int goldfish_fb_remove(struct platform_device *pdev)
2274 + dma_free_coherent(&pdev->dev, framesize, (void *)fb->fb.screen_base,
2275 + fb->fb.fix.smem_start);
2276 + iounmap(fb->reg_base);
2277 ++ kfree(fb);
2278 + return 0;
2279 + }
2280 +
2281 +diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c
2282 +index 6429f33167f5..77c97c697fea 100644
2283 +--- a/drivers/video/fbdev/omap/omapfb_main.c
2284 ++++ b/drivers/video/fbdev/omap/omapfb_main.c
2285 +@@ -956,7 +956,7 @@ int omapfb_register_client(struct omapfb_notifier_block *omapfb_nb,
2286 + {
2287 + int r;
2288 +
2289 +- if ((unsigned)omapfb_nb->plane_idx > OMAPFB_PLANE_NUM)
2290 ++ if ((unsigned)omapfb_nb->plane_idx >= OMAPFB_PLANE_NUM)
2291 + return -EINVAL;
2292 +
2293 + if (!notifier_inited) {
2294 +diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
2295 +index ef73f14d7ba0..8503310a3816 100644
2296 +--- a/drivers/video/fbdev/pxafb.c
2297 ++++ b/drivers/video/fbdev/pxafb.c
2298 +@@ -2128,8 +2128,8 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
2299 + return -EINVAL;
2300 +
2301 + ret = -ENOMEM;
2302 +- info->modes = kmalloc_array(timings->num_timings,
2303 +- sizeof(info->modes[0]), GFP_KERNEL);
2304 ++ info->modes = kcalloc(timings->num_timings, sizeof(info->modes[0]),
2305 ++ GFP_KERNEL);
2306 + if (!info->modes)
2307 + goto out;
2308 + info->num_modes = timings->num_timings;
2309 +diff --git a/drivers/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c
2310 +index badee04ef496..71b5dca95bdb 100644
2311 +--- a/drivers/video/fbdev/via/viafbdev.c
2312 ++++ b/drivers/video/fbdev/via/viafbdev.c
2313 +@@ -19,6 +19,7 @@
2314 + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2315 + */
2316 +
2317 ++#include <linux/compiler.h>
2318 + #include <linux/module.h>
2319 + #include <linux/seq_file.h>
2320 + #include <linux/slab.h>
2321 +@@ -1468,7 +1469,7 @@ static const struct file_operations viafb_vt1636_proc_fops = {
2322 +
2323 + #endif /* CONFIG_FB_VIA_DIRECT_PROCFS */
2324 +
2325 +-static int viafb_sup_odev_proc_show(struct seq_file *m, void *v)
2326 ++static int __maybe_unused viafb_sup_odev_proc_show(struct seq_file *m, void *v)
2327 + {
2328 + via_odev_to_seq(m, supported_odev_map[
2329 + viaparinfo->shared->chip_info.gfx_chip_name]);
2330 +diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
2331 +index a4fabf60d5ee..e7e25a86bbff 100644
2332 +--- a/fs/binfmt_elf.c
2333 ++++ b/fs/binfmt_elf.c
2334 +@@ -1706,7 +1706,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
2335 + const struct user_regset *regset = &view->regsets[i];
2336 + do_thread_regset_writeback(t->task, regset);
2337 + if (regset->core_note_type && regset->get &&
2338 +- (!regset->active || regset->active(t->task, regset))) {
2339 ++ (!regset->active || regset->active(t->task, regset) > 0)) {
2340 + int ret;
2341 + size_t size = regset->n * regset->size;
2342 + void *data = kmalloc(size, GFP_KERNEL);
2343 +diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
2344 +index a27fc8791551..ef24b4527459 100644
2345 +--- a/fs/cifs/readdir.c
2346 ++++ b/fs/cifs/readdir.c
2347 +@@ -376,8 +376,15 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
2348 +
2349 + new_entry = old_entry + sizeof(FIND_FILE_STANDARD_INFO) +
2350 + pfData->FileNameLength;
2351 +- } else
2352 +- new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset);
2353 ++ } else {
2354 ++ u32 next_offset = le32_to_cpu(pDirInfo->NextEntryOffset);
2355 ++
2356 ++ if (old_entry + next_offset < old_entry) {
2357 ++ cifs_dbg(VFS, "invalid offset %u\n", next_offset);
2358 ++ return NULL;
2359 ++ }
2360 ++ new_entry = old_entry + next_offset;
2361 ++ }
2362 + cifs_dbg(FYI, "new entry %p old entry %p\n", new_entry, old_entry);
2363 + /* validate that new_entry is not past end of SMB */
2364 + if (new_entry >= end_of_smb) {
2365 +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
2366 +index 383cf8148fe7..50251a8af0ce 100644
2367 +--- a/fs/cifs/smb2pdu.c
2368 ++++ b/fs/cifs/smb2pdu.c
2369 +@@ -2565,33 +2565,38 @@ num_entries(char *bufstart, char *end_of_buf, char **lastentry, size_t size)
2370 + int len;
2371 + unsigned int entrycount = 0;
2372 + unsigned int next_offset = 0;
2373 +- FILE_DIRECTORY_INFO *entryptr;
2374 ++ char *entryptr;
2375 ++ FILE_DIRECTORY_INFO *dir_info;
2376 +
2377 + if (bufstart == NULL)
2378 + return 0;
2379 +
2380 +- entryptr = (FILE_DIRECTORY_INFO *)bufstart;
2381 ++ entryptr = bufstart;
2382 +
2383 + while (1) {
2384 +- entryptr = (FILE_DIRECTORY_INFO *)
2385 +- ((char *)entryptr + next_offset);
2386 +-
2387 +- if ((char *)entryptr + size > end_of_buf) {
2388 ++ if (entryptr + next_offset < entryptr ||
2389 ++ entryptr + next_offset > end_of_buf ||
2390 ++ entryptr + next_offset + size > end_of_buf) {
2391 + cifs_dbg(VFS, "malformed search entry would overflow\n");
2392 + break;
2393 + }
2394 +
2395 +- len = le32_to_cpu(entryptr->FileNameLength);
2396 +- if ((char *)entryptr + len + size > end_of_buf) {
2397 ++ entryptr = entryptr + next_offset;
2398 ++ dir_info = (FILE_DIRECTORY_INFO *)entryptr;
2399 ++
2400 ++ len = le32_to_cpu(dir_info->FileNameLength);
2401 ++ if (entryptr + len < entryptr ||
2402 ++ entryptr + len > end_of_buf ||
2403 ++ entryptr + len + size > end_of_buf) {
2404 + cifs_dbg(VFS, "directory entry name would overflow frame end of buf %p\n",
2405 + end_of_buf);
2406 + break;
2407 + }
2408 +
2409 +- *lastentry = (char *)entryptr;
2410 ++ *lastentry = entryptr;
2411 + entrycount++;
2412 +
2413 +- next_offset = le32_to_cpu(entryptr->NextEntryOffset);
2414 ++ next_offset = le32_to_cpu(dir_info->NextEntryOffset);
2415 + if (!next_offset)
2416 + break;
2417 + }
2418 +diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
2419 +index 56fb26127fef..d2a1a79fa324 100644
2420 +--- a/fs/configfs/dir.c
2421 ++++ b/fs/configfs/dir.c
2422 +@@ -1777,6 +1777,16 @@ void configfs_unregister_group(struct config_group *group)
2423 + struct dentry *dentry = group->cg_item.ci_dentry;
2424 + struct dentry *parent = group->cg_item.ci_parent->ci_dentry;
2425 +
2426 ++ mutex_lock(&subsys->su_mutex);
2427 ++ if (!group->cg_item.ci_parent->ci_group) {
2428 ++ /*
2429 ++ * The parent has already been unlinked and detached
2430 ++ * due to a rmdir.
2431 ++ */
2432 ++ goto unlink_group;
2433 ++ }
2434 ++ mutex_unlock(&subsys->su_mutex);
2435 ++
2436 + inode_lock_nested(d_inode(parent), I_MUTEX_PARENT);
2437 + spin_lock(&configfs_dirent_lock);
2438 + configfs_detach_prep(dentry, NULL);
2439 +@@ -1791,6 +1801,7 @@ void configfs_unregister_group(struct config_group *group)
2440 + dput(dentry);
2441 +
2442 + mutex_lock(&subsys->su_mutex);
2443 ++unlink_group:
2444 + unlink_group(group);
2445 + mutex_unlock(&subsys->su_mutex);
2446 + }
2447 +diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
2448 +index fc5da4cbe88c..39af17b407f0 100644
2449 +--- a/fs/gfs2/bmap.c
2450 ++++ b/fs/gfs2/bmap.c
2451 +@@ -1472,7 +1472,7 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
2452 + end_of_file = (i_size_read(&ip->i_inode) + sdp->sd_sb.sb_bsize - 1) >> shift;
2453 + lblock = offset >> shift;
2454 + lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
2455 +- if (lblock_stop > end_of_file)
2456 ++ if (lblock_stop > end_of_file && ip != GFS2_I(sdp->sd_rindex))
2457 + return 1;
2458 +
2459 + size = (lblock_stop - lblock) << shift;
2460 +diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
2461 +index 86ccc0159393..832824994aae 100644
2462 +--- a/fs/gfs2/rgrp.c
2463 ++++ b/fs/gfs2/rgrp.c
2464 +@@ -1675,7 +1675,8 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
2465 +
2466 + while(1) {
2467 + bi = rbm_bi(rbm);
2468 +- if (test_bit(GBF_FULL, &bi->bi_flags) &&
2469 ++ if ((ip == NULL || !gfs2_rs_active(&ip->i_res)) &&
2470 ++ test_bit(GBF_FULL, &bi->bi_flags) &&
2471 + (state == GFS2_BLKST_FREE))
2472 + goto next_bitmap;
2473 +
2474 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
2475 +index e7ca62a86dab..eb55ab6930b5 100644
2476 +--- a/fs/nfs/nfs4proc.c
2477 ++++ b/fs/nfs/nfs4proc.c
2478 +@@ -2539,14 +2539,18 @@ static void nfs41_check_delegation_stateid(struct nfs4_state *state)
2479 + }
2480 +
2481 + nfs4_stateid_copy(&stateid, &delegation->stateid);
2482 +- if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags) ||
2483 +- !test_and_clear_bit(NFS_DELEGATION_TEST_EXPIRED,
2484 +- &delegation->flags)) {
2485 ++ if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) {
2486 + rcu_read_unlock();
2487 + nfs_finish_clear_delegation_stateid(state, &stateid);
2488 + return;
2489 + }
2490 +
2491 ++ if (!test_and_clear_bit(NFS_DELEGATION_TEST_EXPIRED,
2492 ++ &delegation->flags)) {
2493 ++ rcu_read_unlock();
2494 ++ return;
2495 ++ }
2496 ++
2497 + cred = get_rpccred(delegation->cred);
2498 + rcu_read_unlock();
2499 + status = nfs41_test_and_free_expired_stateid(server, &stateid, cred);
2500 +diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
2501 +index 353691366fca..857af951831f 100644
2502 +--- a/fs/nfs/nfs4state.c
2503 ++++ b/fs/nfs/nfs4state.c
2504 +@@ -1336,6 +1336,8 @@ int nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4_
2505 +
2506 + if (!nfs4_state_mark_reclaim_nograce(clp, state))
2507 + return -EBADF;
2508 ++ nfs_inode_find_delegation_state_and_recover(state->inode,
2509 ++ &state->stateid);
2510 + dprintk("%s: scheduling stateid recovery for server %s\n", __func__,
2511 + clp->cl_hostname);
2512 + nfs4_schedule_state_manager(clp);
2513 +diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
2514 +index e11672aa4575..ecdb3baa1283 100644
2515 +--- a/fs/pstore/ram_core.c
2516 ++++ b/fs/pstore/ram_core.c
2517 +@@ -421,7 +421,12 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size,
2518 + vaddr = vmap(pages, page_count, VM_MAP, prot);
2519 + kfree(pages);
2520 +
2521 +- return vaddr;
2522 ++ /*
2523 ++ * Since vmap() uses page granularity, we must add the offset
2524 ++ * into the page here, to get the byte granularity address
2525 ++ * into the mapping to represent the actual "start" location.
2526 ++ */
2527 ++ return vaddr + offset_in_page(start);
2528 + }
2529 +
2530 + static void *persistent_ram_iomap(phys_addr_t start, size_t size,
2531 +@@ -440,6 +445,11 @@ static void *persistent_ram_iomap(phys_addr_t start, size_t size,
2532 + else
2533 + va = ioremap_wc(start, size);
2534 +
2535 ++ /*
2536 ++ * Since request_mem_region() and ioremap() are byte-granularity
2537 ++ * there is no need handle anything special like we do when the
2538 ++ * vmap() case in persistent_ram_vmap() above.
2539 ++ */
2540 + return va;
2541 + }
2542 +
2543 +@@ -460,7 +470,7 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size,
2544 + return -ENOMEM;
2545 + }
2546 +
2547 +- prz->buffer = prz->vaddr + offset_in_page(start);
2548 ++ prz->buffer = prz->vaddr;
2549 + prz->buffer_size = size - sizeof(struct persistent_ram_buffer);
2550 +
2551 + return 0;
2552 +@@ -507,7 +517,8 @@ void persistent_ram_free(struct persistent_ram_zone *prz)
2553 +
2554 + if (prz->vaddr) {
2555 + if (pfn_valid(prz->paddr >> PAGE_SHIFT)) {
2556 +- vunmap(prz->vaddr);
2557 ++ /* We must vunmap() at page-granularity. */
2558 ++ vunmap(prz->vaddr - offset_in_page(prz->paddr));
2559 + } else {
2560 + iounmap(prz->vaddr);
2561 + release_mem_region(prz->paddr, prz->size);
2562 +diff --git a/include/linux/crypto.h b/include/linux/crypto.h
2563 +index 8edb3ba6f640..9de26962338e 100644
2564 +--- a/include/linux/crypto.h
2565 ++++ b/include/linux/crypto.h
2566 +@@ -108,6 +108,11 @@
2567 + */
2568 + #define CRYPTO_ALG_OPTIONAL_KEY 0x00004000
2569 +
2570 ++/*
2571 ++ * Don't trigger module loading
2572 ++ */
2573 ++#define CRYPTO_NOLOAD 0x00008000
2574 ++
2575 + /*
2576 + * Transform masks and values (for crt_flags).
2577 + */
2578 +diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
2579 +index 7751d72a6a40..859fd209603a 100644
2580 +--- a/include/linux/mlx5/driver.h
2581 ++++ b/include/linux/mlx5/driver.h
2582 +@@ -786,7 +786,7 @@ void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar);
2583 + void mlx5_health_cleanup(struct mlx5_core_dev *dev);
2584 + int mlx5_health_init(struct mlx5_core_dev *dev);
2585 + void mlx5_start_health_poll(struct mlx5_core_dev *dev);
2586 +-void mlx5_stop_health_poll(struct mlx5_core_dev *dev);
2587 ++void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health);
2588 + void mlx5_drain_health_wq(struct mlx5_core_dev *dev);
2589 + void mlx5_drain_health_recovery(struct mlx5_core_dev *dev);
2590 + int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size,
2591 +diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
2592 +index 690e1e3c59f7..f036b6ada6ef 100644
2593 +--- a/kernel/audit_watch.c
2594 ++++ b/kernel/audit_watch.c
2595 +@@ -419,6 +419,13 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
2596 + struct path parent_path;
2597 + int h, ret = 0;
2598 +
2599 ++ /*
2600 ++ * When we will be calling audit_add_to_parent, krule->watch might have
2601 ++ * been updated and watch might have been freed.
2602 ++ * So we need to keep a reference of watch.
2603 ++ */
2604 ++ audit_get_watch(watch);
2605 ++
2606 + mutex_unlock(&audit_filter_mutex);
2607 +
2608 + /* Avoid calling path_lookup under audit_filter_mutex. */
2609 +@@ -427,8 +434,10 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
2610 + /* caller expects mutex locked */
2611 + mutex_lock(&audit_filter_mutex);
2612 +
2613 +- if (ret)
2614 ++ if (ret) {
2615 ++ audit_put_watch(watch);
2616 + return ret;
2617 ++ }
2618 +
2619 + /* either find an old parent or attach a new one */
2620 + parent = audit_find_parent(d_backing_inode(parent_path.dentry));
2621 +@@ -446,6 +455,7 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
2622 + *list = &audit_inode_hash[h];
2623 + error:
2624 + path_put(&parent_path);
2625 ++ audit_put_watch(watch);
2626 + return ret;
2627 + }
2628 +
2629 +diff --git a/kernel/events/core.c b/kernel/events/core.c
2630 +index 6e6ec229c780..95bd00d9f2c3 100644
2631 +--- a/kernel/events/core.c
2632 ++++ b/kernel/events/core.c
2633 +@@ -5563,6 +5563,7 @@ perf_output_sample_ustack(struct perf_output_handle *handle, u64 dump_size,
2634 + unsigned long sp;
2635 + unsigned int rem;
2636 + u64 dyn_size;
2637 ++ mm_segment_t fs;
2638 +
2639 + /*
2640 + * We dump:
2641 +@@ -5580,7 +5581,10 @@ perf_output_sample_ustack(struct perf_output_handle *handle, u64 dump_size,
2642 +
2643 + /* Data. */
2644 + sp = perf_user_stack_pointer(regs);
2645 ++ fs = get_fs();
2646 ++ set_fs(USER_DS);
2647 + rem = __output_copy_user(handle, (void *) sp, dump_size);
2648 ++ set_fs(fs);
2649 + dyn_size = dump_size - rem;
2650 +
2651 + perf_output_skip(handle, rem);
2652 +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
2653 +index d7801f6877af..e63fd12f923a 100644
2654 +--- a/net/mac80211/cfg.c
2655 ++++ b/net/mac80211/cfg.c
2656 +@@ -454,7 +454,7 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
2657 + goto out_unlock;
2658 + }
2659 +
2660 +- ieee80211_key_free(key, true);
2661 ++ ieee80211_key_free(key, sdata->vif.type == NL80211_IFTYPE_STATION);
2662 +
2663 + ret = 0;
2664 + out_unlock:
2665 +diff --git a/net/mac80211/key.c b/net/mac80211/key.c
2666 +index 4c625a325ce2..6e02f8dfce2b 100644
2667 +--- a/net/mac80211/key.c
2668 ++++ b/net/mac80211/key.c
2669 +@@ -648,11 +648,15 @@ int ieee80211_key_link(struct ieee80211_key *key,
2670 + {
2671 + struct ieee80211_local *local = sdata->local;
2672 + struct ieee80211_key *old_key;
2673 +- int idx, ret;
2674 +- bool pairwise;
2675 +-
2676 +- pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
2677 +- idx = key->conf.keyidx;
2678 ++ int idx = key->conf.keyidx;
2679 ++ bool pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
2680 ++ /*
2681 ++ * We want to delay tailroom updates only for station - in that
2682 ++ * case it helps roaming speed, but in other cases it hurts and
2683 ++ * can cause warnings to appear.
2684 ++ */
2685 ++ bool delay_tailroom = sdata->vif.type == NL80211_IFTYPE_STATION;
2686 ++ int ret;
2687 +
2688 + mutex_lock(&sdata->local->key_mtx);
2689 +
2690 +@@ -680,14 +684,14 @@ int ieee80211_key_link(struct ieee80211_key *key,
2691 + increment_tailroom_need_count(sdata);
2692 +
2693 + ieee80211_key_replace(sdata, sta, pairwise, old_key, key);
2694 +- ieee80211_key_destroy(old_key, true);
2695 ++ ieee80211_key_destroy(old_key, delay_tailroom);
2696 +
2697 + ieee80211_debugfs_key_add(key);
2698 +
2699 + if (!local->wowlan) {
2700 + ret = ieee80211_key_enable_hw_accel(key);
2701 + if (ret)
2702 +- ieee80211_key_free(key, true);
2703 ++ ieee80211_key_free(key, delay_tailroom);
2704 + } else {
2705 + ret = 0;
2706 + }
2707 +@@ -922,7 +926,8 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local,
2708 + ieee80211_key_replace(key->sdata, key->sta,
2709 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE,
2710 + key, NULL);
2711 +- __ieee80211_key_destroy(key, true);
2712 ++ __ieee80211_key_destroy(key, key->sdata->vif.type ==
2713 ++ NL80211_IFTYPE_STATION);
2714 + }
2715 +
2716 + for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
2717 +@@ -932,7 +937,8 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local,
2718 + ieee80211_key_replace(key->sdata, key->sta,
2719 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE,
2720 + key, NULL);
2721 +- __ieee80211_key_destroy(key, true);
2722 ++ __ieee80211_key_destroy(key, key->sdata->vif.type ==
2723 ++ NL80211_IFTYPE_STATION);
2724 + }
2725 +
2726 + mutex_unlock(&local->key_mtx);
2727 +diff --git a/net/rds/bind.c b/net/rds/bind.c
2728 +index adb53ae97a02..cc7e3a138598 100644
2729 +--- a/net/rds/bind.c
2730 ++++ b/net/rds/bind.c
2731 +@@ -60,11 +60,13 @@ struct rds_sock *rds_find_bound(__be32 addr, __be16 port)
2732 + u64 key = ((u64)addr << 32) | port;
2733 + struct rds_sock *rs;
2734 +
2735 +- rs = rhashtable_lookup_fast(&bind_hash_table, &key, ht_parms);
2736 ++ rcu_read_lock();
2737 ++ rs = rhashtable_lookup(&bind_hash_table, &key, ht_parms);
2738 + if (rs && !sock_flag(rds_rs_to_sk(rs), SOCK_DEAD))
2739 + rds_sock_addref(rs);
2740 + else
2741 + rs = NULL;
2742 ++ rcu_read_unlock();
2743 +
2744 + rdsdebug("returning rs %p for %pI4:%u\n", rs, &addr,
2745 + ntohs(port));
2746 +@@ -157,6 +159,7 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
2747 + goto out;
2748 + }
2749 +
2750 ++ sock_set_flag(sk, SOCK_RCU_FREE);
2751 + ret = rds_add_bound(rs, sin->sin_addr.s_addr, &sin->sin_port);
2752 + if (ret)
2753 + goto out;
2754 +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
2755 +index 1f943d97dc29..d0dcfc68c043 100644
2756 +--- a/net/xfrm/xfrm_policy.c
2757 ++++ b/net/xfrm/xfrm_policy.c
2758 +@@ -1873,7 +1873,10 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols,
2759 + /* Try to instantiate a bundle */
2760 + err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family);
2761 + if (err <= 0) {
2762 +- if (err != 0 && err != -EAGAIN)
2763 ++ if (err == 0)
2764 ++ return NULL;
2765 ++
2766 ++ if (err != -EAGAIN)
2767 + XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
2768 + return ERR_PTR(err);
2769 + }
2770 +diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
2771 +index 63774307a751..8f8965608ee3 100644
2772 +--- a/scripts/Kbuild.include
2773 ++++ b/scripts/Kbuild.include
2774 +@@ -394,3 +394,6 @@ endif
2775 + endef
2776 + #
2777 + ###############################################################################
2778 ++
2779 ++# delete partially updated (i.e. corrupted) files on error
2780 ++.DELETE_ON_ERROR:
2781 +diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
2782 +index bf663915412e..6fcbd8e99baf 100644
2783 +--- a/security/integrity/evm/evm_crypto.c
2784 ++++ b/security/integrity/evm/evm_crypto.c
2785 +@@ -94,7 +94,8 @@ static struct shash_desc *init_desc(char type)
2786 + mutex_lock(&mutex);
2787 + if (*tfm)
2788 + goto out;
2789 +- *tfm = crypto_alloc_shash(algo, 0, CRYPTO_ALG_ASYNC);
2790 ++ *tfm = crypto_alloc_shash(algo, 0,
2791 ++ CRYPTO_ALG_ASYNC | CRYPTO_NOLOAD);
2792 + if (IS_ERR(*tfm)) {
2793 + rc = PTR_ERR(*tfm);
2794 + pr_err("Can not allocate %s (reason: %ld)\n", algo, rc);
2795 +diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
2796 +index ca3ea985c100..fb7c534fb57d 100644
2797 +--- a/security/smack/smack_lsm.c
2798 ++++ b/security/smack/smack_lsm.c
2799 +@@ -3966,15 +3966,19 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
2800 + struct smack_known *skp = NULL;
2801 + int rc = 0;
2802 + struct smk_audit_info ad;
2803 ++ u16 family = sk->sk_family;
2804 + #ifdef CONFIG_AUDIT
2805 + struct lsm_network_audit net;
2806 + #endif
2807 + #if IS_ENABLED(CONFIG_IPV6)
2808 + struct sockaddr_in6 sadd;
2809 + int proto;
2810 ++
2811 ++ if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP))
2812 ++ family = PF_INET;
2813 + #endif /* CONFIG_IPV6 */
2814 +
2815 +- switch (sk->sk_family) {
2816 ++ switch (family) {
2817 + case PF_INET:
2818 + #ifdef CONFIG_SECURITY_SMACK_NETFILTER
2819 + /*
2820 +@@ -3992,7 +3996,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
2821 + */
2822 + netlbl_secattr_init(&secattr);
2823 +
2824 +- rc = netlbl_skbuff_getattr(skb, sk->sk_family, &secattr);
2825 ++ rc = netlbl_skbuff_getattr(skb, family, &secattr);
2826 + if (rc == 0)
2827 + skp = smack_from_secattr(&secattr, ssp);
2828 + else
2829 +@@ -4005,7 +4009,7 @@ access_check:
2830 + #endif
2831 + #ifdef CONFIG_AUDIT
2832 + smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net);
2833 +- ad.a.u.net->family = sk->sk_family;
2834 ++ ad.a.u.net->family = family;
2835 + ad.a.u.net->netif = skb->skb_iif;
2836 + ipv4_skb_to_auditdata(skb, &ad.a, NULL);
2837 + #endif
2838 +@@ -4019,7 +4023,7 @@ access_check:
2839 + rc = smk_bu_note("IPv4 delivery", skp, ssp->smk_in,
2840 + MAY_WRITE, rc);
2841 + if (rc != 0)
2842 +- netlbl_skbuff_err(skb, sk->sk_family, rc, 0);
2843 ++ netlbl_skbuff_err(skb, family, rc, 0);
2844 + break;
2845 + #if IS_ENABLED(CONFIG_IPV6)
2846 + case PF_INET6:
2847 +@@ -4035,7 +4039,7 @@ access_check:
2848 + skp = smack_net_ambient;
2849 + #ifdef CONFIG_AUDIT
2850 + smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net);
2851 +- ad.a.u.net->family = sk->sk_family;
2852 ++ ad.a.u.net->family = family;
2853 + ad.a.u.net->netif = skb->skb_iif;
2854 + ipv6_skb_to_auditdata(skb, &ad.a, NULL);
2855 + #endif /* CONFIG_AUDIT */
2856 +diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
2857 +index 9306604f5070..f57a58ac7ae0 100644
2858 +--- a/sound/core/pcm_lib.c
2859 ++++ b/sound/core/pcm_lib.c
2860 +@@ -648,27 +648,33 @@ EXPORT_SYMBOL(snd_interval_refine);
2861 +
2862 + static int snd_interval_refine_first(struct snd_interval *i)
2863 + {
2864 ++ const unsigned int last_max = i->max;
2865 ++
2866 + if (snd_BUG_ON(snd_interval_empty(i)))
2867 + return -EINVAL;
2868 + if (snd_interval_single(i))
2869 + return 0;
2870 + i->max = i->min;
2871 +- i->openmax = i->openmin;
2872 +- if (i->openmax)
2873 ++ if (i->openmin)
2874 + i->max++;
2875 ++ /* only exclude max value if also excluded before refine */
2876 ++ i->openmax = (i->openmax && i->max >= last_max);
2877 + return 1;
2878 + }
2879 +
2880 + static int snd_interval_refine_last(struct snd_interval *i)
2881 + {
2882 ++ const unsigned int last_min = i->min;
2883 ++
2884 + if (snd_BUG_ON(snd_interval_empty(i)))
2885 + return -EINVAL;
2886 + if (snd_interval_single(i))
2887 + return 0;
2888 + i->min = i->max;
2889 +- i->openmin = i->openmax;
2890 +- if (i->openmin)
2891 ++ if (i->openmax)
2892 + i->min--;
2893 ++ /* only exclude min value if also excluded before refine */
2894 ++ i->openmin = (i->openmin && i->min <= last_min);
2895 + return 1;
2896 + }
2897 +
2898 +diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c
2899 +index a31ea6c22d19..2d7379dec1f0 100644
2900 +--- a/sound/isa/msnd/msnd_pinnacle.c
2901 ++++ b/sound/isa/msnd/msnd_pinnacle.c
2902 +@@ -82,10 +82,10 @@
2903 +
2904 + static void set_default_audio_parameters(struct snd_msnd *chip)
2905 + {
2906 +- chip->play_sample_size = DEFSAMPLESIZE;
2907 ++ chip->play_sample_size = snd_pcm_format_width(DEFSAMPLESIZE);
2908 + chip->play_sample_rate = DEFSAMPLERATE;
2909 + chip->play_channels = DEFCHANNELS;
2910 +- chip->capture_sample_size = DEFSAMPLESIZE;
2911 ++ chip->capture_sample_size = snd_pcm_format_width(DEFSAMPLESIZE);
2912 + chip->capture_sample_rate = DEFSAMPLERATE;
2913 + chip->capture_channels = DEFCHANNELS;
2914 + }
2915 +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
2916 +index 69bf5cf1e91e..15cbe2565703 100644
2917 +--- a/sound/usb/quirks-table.h
2918 ++++ b/sound/usb/quirks-table.h
2919 +@@ -2875,7 +2875,8 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2920 + */
2921 +
2922 + #define AU0828_DEVICE(vid, pid, vname, pname) { \
2923 +- USB_DEVICE_VENDOR_SPEC(vid, pid), \
2924 ++ .idVendor = vid, \
2925 ++ .idProduct = pid, \
2926 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
2927 + USB_DEVICE_ID_MATCH_INT_CLASS | \
2928 + USB_DEVICE_ID_MATCH_INT_SUBCLASS, \
2929 +diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
2930 +index 60a94b3e532e..177480066816 100644
2931 +--- a/tools/hv/hv_kvp_daemon.c
2932 ++++ b/tools/hv/hv_kvp_daemon.c
2933 +@@ -286,7 +286,7 @@ static int kvp_key_delete(int pool, const __u8 *key, int key_size)
2934 + * Found a match; just move the remaining
2935 + * entries up.
2936 + */
2937 +- if (i == num_records) {
2938 ++ if (i == (num_records - 1)) {
2939 + kvp_file_info[pool].num_records--;
2940 + kvp_update_file(pool);
2941 + return 0;
2942 +diff --git a/tools/perf/arch/powerpc/util/skip-callchain-idx.c b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
2943 +index bd630c222e65..9a53f6e9ef43 100644
2944 +--- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c
2945 ++++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c
2946 +@@ -58,9 +58,13 @@ static int check_return_reg(int ra_regno, Dwarf_Frame *frame)
2947 + }
2948 +
2949 + /*
2950 +- * Check if return address is on the stack.
2951 ++ * Check if return address is on the stack. If return address
2952 ++ * is in a register (typically R0), it is yet to be saved on
2953 ++ * the stack.
2954 + */
2955 +- if (nops != 0 || ops != NULL)
2956 ++ if ((nops != 0 || ops != NULL) &&
2957 ++ !(nops == 1 && ops[0].atom == DW_OP_regx &&
2958 ++ ops[0].number2 == 0 && ops[0].offset == 0))
2959 + return 0;
2960 +
2961 + /*
2962 +@@ -246,7 +250,7 @@ int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain)
2963 + if (!chain || chain->nr < 3)
2964 + return skip_slot;
2965 +
2966 +- ip = chain->ips[2];
2967 ++ ip = chain->ips[1];
2968 +
2969 + thread__find_addr_location(thread, PERF_RECORD_MISC_USER,
2970 + MAP__FUNCTION, ip, &al);
2971 +diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
2972 +index 778668a2a966..ade7213943ad 100644
2973 +--- a/tools/perf/tests/builtin-test.c
2974 ++++ b/tools/perf/tests/builtin-test.c
2975 +@@ -413,7 +413,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
2976 + for (subi = 0; subi < subn; subi++) {
2977 + pr_info("%2d.%1d: %-*s:", i, subi + 1, subw,
2978 + t->subtest.get_desc(subi));
2979 +- err = test_and_print(t, skip, subi);
2980 ++ err = test_and_print(t, skip, subi + 1);
2981 + if (err != TEST_OK && t->subtest.skip_if_fail)
2982 + skip = true;
2983 + }
2984 +diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
2985 +index 30906bfd9c1b..0ab937a17ebb 100644
2986 +--- a/tools/testing/selftests/timers/raw_skew.c
2987 ++++ b/tools/testing/selftests/timers/raw_skew.c
2988 +@@ -146,6 +146,11 @@ int main(int argv, char **argc)
2989 + printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000)));
2990 +
2991 + if (llabs(eppm - ppm) > 1000) {
2992 ++ if (tx1.offset || tx2.offset ||
2993 ++ tx1.freq != tx2.freq || tx1.tick != tx2.tick) {
2994 ++ printf(" [SKIP]\n");
2995 ++ return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
2996 ++ }
2997 + printf(" [FAILED]\n");
2998 + return ksft_exit_fail();
2999 + }
3000 +diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c
3001 +index 539d3f5cb619..80d8888549ee 100644
3002 +--- a/virt/kvm/arm/vgic/vgic-init.c
3003 ++++ b/virt/kvm/arm/vgic/vgic-init.c
3004 +@@ -241,6 +241,10 @@ int vgic_init(struct kvm *kvm)
3005 + if (vgic_initialized(kvm))
3006 + return 0;
3007 +
3008 ++ /* Are we also in the middle of creating a VCPU? */
3009 ++ if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus))
3010 ++ return -EBUSY;
3011 ++
3012 + /* freeze the number of spis */
3013 + if (!dist->nr_spis)
3014 + dist->nr_spis = VGIC_NR_IRQS_LEGACY - VGIC_NR_PRIVATE_IRQS;