Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Tue, 29 Dec 2020 14:20:36
Message-Id: 1609251621.f5d14b47246aa5dd8097ff4ee573ffe0f4415855.mpagano@gentoo
1 commit: f5d14b47246aa5dd8097ff4ee573ffe0f4415855
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Tue Dec 29 14:20:21 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 29 14:20:21 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=f5d14b47
7
8 Linux patch 4.14.213
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1212_linux-4.14.213.patch | 6547 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 6551 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 0c54420..ff5e177 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -891,6 +891,10 @@ Patch: 1211_linux-4.14.212.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.14.212
23
24 +Patch: 1212_linux-4.14.213.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.14.213
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1212_linux-4.14.213.patch b/1212_linux-4.14.213.patch
33 new file mode 100644
34 index 0000000..4f2ea07
35 --- /dev/null
36 +++ b/1212_linux-4.14.213.patch
37 @@ -0,0 +1,6547 @@
38 +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
39 +index 357c64b53cdc7..3a1507362eb1e 100644
40 +--- a/Documentation/admin-guide/kernel-parameters.txt
41 ++++ b/Documentation/admin-guide/kernel-parameters.txt
42 +@@ -4750,6 +4750,7 @@
43 + device);
44 + j = NO_REPORT_LUNS (don't use report luns
45 + command, uas only);
46 ++ k = NO_SAME (do not use WRITE_SAME, uas only)
47 + l = NOT_LOCKABLE (don't try to lock and
48 + unlock ejectable media, not on uas);
49 + m = MAX_SECTORS_64 (don't transfer more
50 +diff --git a/Makefile b/Makefile
51 +index 37c1bd2211154..d059e257b976a 100644
52 +--- a/Makefile
53 ++++ b/Makefile
54 +@@ -1,7 +1,7 @@
55 + # SPDX-License-Identifier: GPL-2.0
56 + VERSION = 4
57 + PATCHLEVEL = 14
58 +-SUBLEVEL = 212
59 ++SUBLEVEL = 213
60 + EXTRAVERSION =
61 + NAME = Petit Gorille
62 +
63 +diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c
64 +index b007c06efbea9..35d418cde03b5 100644
65 +--- a/arch/arc/kernel/stacktrace.c
66 ++++ b/arch/arc/kernel/stacktrace.c
67 +@@ -41,15 +41,15 @@
68 +
69 + #ifdef CONFIG_ARC_DW2_UNWIND
70 +
71 +-static void seed_unwind_frame_info(struct task_struct *tsk,
72 +- struct pt_regs *regs,
73 +- struct unwind_frame_info *frame_info)
74 ++static int
75 ++seed_unwind_frame_info(struct task_struct *tsk, struct pt_regs *regs,
76 ++ struct unwind_frame_info *frame_info)
77 + {
78 + /*
79 + * synchronous unwinding (e.g. dump_stack)
80 + * - uses current values of SP and friends
81 + */
82 +- if (tsk == NULL && regs == NULL) {
83 ++ if (regs == NULL && (tsk == NULL || tsk == current)) {
84 + unsigned long fp, sp, blink, ret;
85 + frame_info->task = current;
86 +
87 +@@ -68,11 +68,15 @@ static void seed_unwind_frame_info(struct task_struct *tsk,
88 + frame_info->call_frame = 0;
89 + } else if (regs == NULL) {
90 + /*
91 +- * Asynchronous unwinding of sleeping task
92 +- * - Gets SP etc from task's pt_regs (saved bottom of kernel
93 +- * mode stack of task)
94 ++ * Asynchronous unwinding of a likely sleeping task
95 ++ * - first ensure it is actually sleeping
96 ++ * - if so, it will be in __switch_to, kernel mode SP of task
97 ++ * is safe-kept and BLINK at a well known location in there
98 + */
99 +
100 ++ if (tsk->state == TASK_RUNNING)
101 ++ return -1;
102 ++
103 + frame_info->task = tsk;
104 +
105 + frame_info->regs.r27 = TSK_K_FP(tsk);
106 +@@ -106,6 +110,8 @@ static void seed_unwind_frame_info(struct task_struct *tsk,
107 + frame_info->regs.r63 = regs->ret;
108 + frame_info->call_frame = 0;
109 + }
110 ++
111 ++ return 0;
112 + }
113 +
114 + #endif
115 +@@ -119,7 +125,8 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
116 + unsigned int address;
117 + struct unwind_frame_info frame_info;
118 +
119 +- seed_unwind_frame_info(tsk, regs, &frame_info);
120 ++ if (seed_unwind_frame_info(tsk, regs, &frame_info))
121 ++ return 0;
122 +
123 + while (1) {
124 + address = UNW_PC(&frame_info);
125 +diff --git a/arch/arm/boot/dts/armada-xp-98dx3236.dtsi b/arch/arm/boot/dts/armada-xp-98dx3236.dtsi
126 +index bdd4c7a45fbf4..8d1356311e3f0 100644
127 +--- a/arch/arm/boot/dts/armada-xp-98dx3236.dtsi
128 ++++ b/arch/arm/boot/dts/armada-xp-98dx3236.dtsi
129 +@@ -303,11 +303,6 @@
130 + reg = <0x11000 0x100>;
131 + };
132 +
133 +-&i2c1 {
134 +- compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
135 +- reg = <0x11100 0x100>;
136 +-};
137 +-
138 + &mpic {
139 + reg = <0x20a00 0x2d0>, <0x21070 0x58>;
140 + };
141 +diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
142 +index 3af088d2cba79..ce059f9eaa7d9 100644
143 +--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
144 ++++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
145 +@@ -231,6 +231,11 @@
146 + atmel,pins =
147 + <AT91_PIOE 9 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PE9, conflicts with A9 */
148 + };
149 ++ pinctrl_usb_default: usb_default {
150 ++ atmel,pins =
151 ++ <AT91_PIOE 3 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
152 ++ AT91_PIOE 4 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
153 ++ };
154 + };
155 + };
156 + };
157 +@@ -248,6 +253,8 @@
158 + &pioE 3 GPIO_ACTIVE_LOW
159 + &pioE 4 GPIO_ACTIVE_LOW
160 + >;
161 ++ pinctrl-names = "default";
162 ++ pinctrl-0 = <&pinctrl_usb_default>;
163 + status = "okay";
164 + };
165 +
166 +diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
167 +index 10f2fb9e0ea61..c271ca960caee 100644
168 +--- a/arch/arm/boot/dts/at91-sama5d4_xplained.dts
169 ++++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
170 +@@ -158,6 +158,11 @@
171 + atmel,pins =
172 + <AT91_PIOE 31 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>;
173 + };
174 ++ pinctrl_usb_default: usb_default {
175 ++ atmel,pins =
176 ++ <AT91_PIOE 11 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
177 ++ AT91_PIOE 14 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
178 ++ };
179 + pinctrl_key_gpio: key_gpio_0 {
180 + atmel,pins =
181 + <AT91_PIOE 8 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
182 +@@ -183,6 +188,8 @@
183 + &pioE 11 GPIO_ACTIVE_HIGH
184 + &pioE 14 GPIO_ACTIVE_HIGH
185 + >;
186 ++ pinctrl-names = "default";
187 ++ pinctrl-0 = <&pinctrl_usb_default>;
188 + status = "okay";
189 + };
190 +
191 +diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi b/arch/arm/boot/dts/at91sam9rl.dtsi
192 +index 7768342a66385..64273f9439926 100644
193 +--- a/arch/arm/boot/dts/at91sam9rl.dtsi
194 ++++ b/arch/arm/boot/dts/at91sam9rl.dtsi
195 +@@ -274,23 +274,26 @@
196 + atmel,adc-use-res = "highres";
197 +
198 + trigger0 {
199 +- trigger-name = "timer-counter-0";
200 ++ trigger-name = "external-rising";
201 + trigger-value = <0x1>;
202 ++ trigger-external;
203 + };
204 ++
205 + trigger1 {
206 +- trigger-name = "timer-counter-1";
207 +- trigger-value = <0x3>;
208 ++ trigger-name = "external-falling";
209 ++ trigger-value = <0x2>;
210 ++ trigger-external;
211 + };
212 +
213 + trigger2 {
214 +- trigger-name = "timer-counter-2";
215 +- trigger-value = <0x5>;
216 ++ trigger-name = "external-any";
217 ++ trigger-value = <0x3>;
218 ++ trigger-external;
219 + };
220 +
221 + trigger3 {
222 +- trigger-name = "external";
223 +- trigger-value = <0x13>;
224 +- trigger-external;
225 ++ trigger-name = "continuous";
226 ++ trigger-value = <0x6>;
227 + };
228 + };
229 +
230 +diff --git a/arch/arm/boot/dts/exynos5410-odroidxu.dts b/arch/arm/boot/dts/exynos5410-odroidxu.dts
231 +index c4de1353e5dfe..ba135b255b688 100644
232 +--- a/arch/arm/boot/dts/exynos5410-odroidxu.dts
233 ++++ b/arch/arm/boot/dts/exynos5410-odroidxu.dts
234 +@@ -327,6 +327,8 @@
235 + regulator-name = "vddq_lcd";
236 + regulator-min-microvolt = <1800000>;
237 + regulator-max-microvolt = <1800000>;
238 ++ /* Supplies also GPK and GPJ */
239 ++ regulator-always-on;
240 + };
241 +
242 + ldo8_reg: LDO8 {
243 +@@ -629,11 +631,11 @@
244 + };
245 +
246 + &usbdrd_dwc3_0 {
247 +- dr_mode = "host";
248 ++ dr_mode = "peripheral";
249 + };
250 +
251 + &usbdrd_dwc3_1 {
252 +- dr_mode = "peripheral";
253 ++ dr_mode = "host";
254 + };
255 +
256 + &usbdrd3_0 {
257 +diff --git a/arch/arm/boot/dts/exynos5410-pinctrl.dtsi b/arch/arm/boot/dts/exynos5410-pinctrl.dtsi
258 +index ff46a1c271828..c11fd125d8ae4 100644
259 +--- a/arch/arm/boot/dts/exynos5410-pinctrl.dtsi
260 ++++ b/arch/arm/boot/dts/exynos5410-pinctrl.dtsi
261 +@@ -563,6 +563,34 @@
262 + interrupt-controller;
263 + #interrupt-cells = <2>;
264 + };
265 ++
266 ++ usb3_1_oc: usb3-1-oc {
267 ++ samsung,pins = "gpk2-4", "gpk2-5";
268 ++ samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
269 ++ samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
270 ++ samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
271 ++ };
272 ++
273 ++ usb3_1_vbusctrl: usb3-1-vbusctrl {
274 ++ samsung,pins = "gpk2-6", "gpk2-7";
275 ++ samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
276 ++ samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
277 ++ samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
278 ++ };
279 ++
280 ++ usb3_0_oc: usb3-0-oc {
281 ++ samsung,pins = "gpk3-0", "gpk3-1";
282 ++ samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
283 ++ samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
284 ++ samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
285 ++ };
286 ++
287 ++ usb3_0_vbusctrl: usb3-0-vbusctrl {
288 ++ samsung,pins = "gpk3-2", "gpk3-3";
289 ++ samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
290 ++ samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
291 ++ samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
292 ++ };
293 + };
294 +
295 + &pinctrl_2 {
296 +diff --git a/arch/arm/boot/dts/exynos5410.dtsi b/arch/arm/boot/dts/exynos5410.dtsi
297 +index 7628bbb023248..4e1aced47eb07 100644
298 +--- a/arch/arm/boot/dts/exynos5410.dtsi
299 ++++ b/arch/arm/boot/dts/exynos5410.dtsi
300 +@@ -381,6 +381,8 @@
301 + &usbdrd3_0 {
302 + clocks = <&clock CLK_USBD300>;
303 + clock-names = "usbdrd30";
304 ++ pinctrl-names = "default";
305 ++ pinctrl-0 = <&usb3_0_oc>, <&usb3_0_vbusctrl>;
306 + };
307 +
308 + &usbdrd_phy0 {
309 +@@ -392,6 +394,8 @@
310 + &usbdrd3_1 {
311 + clocks = <&clock CLK_USBD301>;
312 + clock-names = "usbdrd30";
313 ++ pinctrl-names = "default";
314 ++ pinctrl-0 = <&usb3_1_oc>, <&usb3_1_vbusctrl>;
315 + };
316 +
317 + &usbdrd_dwc3_1 {
318 +diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
319 +index a8e4b89097d9c..d6e3f975323dc 100644
320 +--- a/arch/arm/boot/dts/sama5d2.dtsi
321 ++++ b/arch/arm/boot/dts/sama5d2.dtsi
322 +@@ -1243,6 +1243,7 @@
323 + clocks = <&securam_clk>;
324 + #address-cells = <1>;
325 + #size-cells = <1>;
326 ++ no-memory-wc;
327 + ranges = <0 0xf8044000 0x1420>;
328 + };
329 +
330 +@@ -1293,7 +1294,7 @@
331 +
332 + can0: can@f8054000 {
333 + compatible = "bosch,m_can";
334 +- reg = <0xf8054000 0x4000>, <0x210000 0x4000>;
335 ++ reg = <0xf8054000 0x4000>, <0x210000 0x1c00>;
336 + reg-names = "m_can", "message_ram";
337 + interrupts = <56 IRQ_TYPE_LEVEL_HIGH 7>,
338 + <64 IRQ_TYPE_LEVEL_HIGH 7>;
339 +@@ -1484,7 +1485,7 @@
340 +
341 + can1: can@fc050000 {
342 + compatible = "bosch,m_can";
343 +- reg = <0xfc050000 0x4000>, <0x210000 0x4000>;
344 ++ reg = <0xfc050000 0x4000>, <0x210000 0x3800>;
345 + reg-names = "m_can", "message_ram";
346 + interrupts = <57 IRQ_TYPE_LEVEL_HIGH 7>,
347 + <65 IRQ_TYPE_LEVEL_HIGH 7>;
348 +@@ -1494,7 +1495,7 @@
349 + assigned-clocks = <&can1_gclk>;
350 + assigned-clock-parents = <&utmi>;
351 + assigned-clock-rates = <40000000>;
352 +- bosch,mram-cfg = <0x1100 0 0 64 0 0 32 32>;
353 ++ bosch,mram-cfg = <0x1c00 0 0 64 0 0 32 32>;
354 + status = "disabled";
355 + };
356 +
357 +diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
358 +index da5823c6fa3e6..e31804e448da2 100644
359 +--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
360 ++++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
361 +@@ -419,7 +419,7 @@
362 + gic: interrupt-controller@01c81000 {
363 + compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
364 + reg = <0x01c81000 0x1000>,
365 +- <0x01c82000 0x1000>,
366 ++ <0x01c82000 0x2000>,
367 + <0x01c84000 0x2000>,
368 + <0x01c86000 0x2000>;
369 + interrupt-controller;
370 +diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
371 +index 6b1148cafffdb..90add5ded3f1f 100644
372 +--- a/arch/arm/kernel/head.S
373 ++++ b/arch/arm/kernel/head.S
374 +@@ -674,12 +674,8 @@ ARM_BE8(rev16 ip, ip)
375 + ldrcc r7, [r4], #4 @ use branch for delay slot
376 + bcc 1b
377 + bx lr
378 +-#else
379 +-#ifdef CONFIG_CPU_ENDIAN_BE8
380 +- moveq r0, #0x00004000 @ set bit 22, mov to mvn instruction
381 + #else
382 + moveq r0, #0x400000 @ set bit 22, mov to mvn instruction
383 +-#endif
384 + b 2f
385 + 1: ldr ip, [r7, r3]
386 + #ifdef CONFIG_CPU_ENDIAN_BE8
387 +@@ -688,7 +684,7 @@ ARM_BE8(rev16 ip, ip)
388 + tst ip, #0x000f0000 @ check the rotation field
389 + orrne ip, ip, r6, lsl #24 @ mask in offset bits 31-24
390 + biceq ip, ip, #0x00004000 @ clear bit 22
391 +- orreq ip, ip, r0 @ mask in offset bits 7-0
392 ++ orreq ip, ip, r0, ror #8 @ mask in offset bits 7-0
393 + #else
394 + bic ip, ip, #0x000000ff
395 + tst ip, #0xf00 @ check the rotation field
396 +diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
397 +index 3a4ed4c33a68e..e312f676a0fdf 100644
398 +--- a/arch/arm/mach-shmobile/pm-rmobile.c
399 ++++ b/arch/arm/mach-shmobile/pm-rmobile.c
400 +@@ -336,6 +336,7 @@ static int __init rmobile_init_pm_domains(void)
401 +
402 + pmd = of_get_child_by_name(np, "pm-domains");
403 + if (!pmd) {
404 ++ iounmap(base);
405 + pr_warn("%pOF lacks pm-domains node\n", np);
406 + continue;
407 + }
408 +diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi
409 +index 9a3fbed1765af..875297a470dab 100644
410 +--- a/arch/arm64/boot/dts/exynos/exynos7.dtsi
411 ++++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi
412 +@@ -65,8 +65,10 @@
413 + };
414 +
415 + psci {
416 +- compatible = "arm,psci-0.2";
417 ++ compatible = "arm,psci";
418 + method = "smc";
419 ++ cpu_off = <0x84000002>;
420 ++ cpu_on = <0xC4000003>;
421 + };
422 +
423 + soc: soc {
424 +diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
425 +index c34daae3c37c2..6c3684885fac0 100644
426 +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
427 ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
428 +@@ -1062,8 +1062,8 @@
429 +
430 + uart0 {
431 + uart0_xfer: uart0-xfer {
432 +- rockchip,pins = <1 RK_PB1 1 &pcfg_pull_up>,
433 +- <1 RK_PB0 1 &pcfg_pull_none>;
434 ++ rockchip,pins = <1 RK_PB1 1 &pcfg_pull_none>,
435 ++ <1 RK_PB0 1 &pcfg_pull_up>;
436 + };
437 +
438 + uart0_cts: uart0-cts {
439 +@@ -1081,8 +1081,8 @@
440 +
441 + uart1 {
442 + uart1_xfer: uart1-xfer {
443 +- rockchip,pins = <3 RK_PA4 4 &pcfg_pull_up>,
444 +- <3 RK_PA6 4 &pcfg_pull_none>;
445 ++ rockchip,pins = <3 RK_PA4 4 &pcfg_pull_none>,
446 ++ <3 RK_PA6 4 &pcfg_pull_up>;
447 + };
448 +
449 + uart1_cts: uart1-cts {
450 +@@ -1100,15 +1100,15 @@
451 +
452 + uart2-0 {
453 + uart2m0_xfer: uart2m0-xfer {
454 +- rockchip,pins = <1 RK_PA0 2 &pcfg_pull_up>,
455 +- <1 RK_PA1 2 &pcfg_pull_none>;
456 ++ rockchip,pins = <1 RK_PA0 2 &pcfg_pull_none>,
457 ++ <1 RK_PA1 2 &pcfg_pull_up>;
458 + };
459 + };
460 +
461 + uart2-1 {
462 + uart2m1_xfer: uart2m1-xfer {
463 +- rockchip,pins = <2 RK_PA0 1 &pcfg_pull_up>,
464 +- <2 RK_PA1 1 &pcfg_pull_none>;
465 ++ rockchip,pins = <2 RK_PA0 1 &pcfg_pull_none>,
466 ++ <2 RK_PA1 1 &pcfg_pull_up>;
467 + };
468 + };
469 +
470 +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
471 +index b63d9653ff559..82747048381fa 100644
472 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
473 ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
474 +@@ -66,6 +66,9 @@
475 + i2c6 = &i2c6;
476 + i2c7 = &i2c7;
477 + i2c8 = &i2c8;
478 ++ mmc0 = &sdio0;
479 ++ mmc1 = &sdmmc;
480 ++ mmc2 = &sdhci;
481 + serial0 = &uart0;
482 + serial1 = &uart1;
483 + serial2 = &uart2;
484 +diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
485 +index 02d34caa7bffc..8d94404829f0f 100644
486 +--- a/arch/arm64/include/asm/kvm_host.h
487 ++++ b/arch/arm64/include/asm/kvm_host.h
488 +@@ -158,6 +158,7 @@ enum vcpu_sysreg {
489 + #define c2_TTBR1 (TTBR1_EL1 * 2) /* Translation Table Base Register 1 */
490 + #define c2_TTBR1_high (c2_TTBR1 + 1) /* TTBR1 top 32 bits */
491 + #define c2_TTBCR (TCR_EL1 * 2) /* Translation Table Base Control R. */
492 ++#define c2_TTBCR2 (c2_TTBCR + 1) /* Translation Table Base Control R. 2 */
493 + #define c3_DACR (DACR32_EL2 * 2)/* Domain Access Control Register */
494 + #define c5_DFSR (ESR_EL1 * 2) /* Data Fault Status Register */
495 + #define c5_IFSR (IFSR32_EL2 * 2)/* Instruction Fault Status Register */
496 +diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
497 +index 1ee4d9216841e..c553f9883194f 100644
498 +--- a/arch/arm64/kvm/sys_regs.c
499 ++++ b/arch/arm64/kvm/sys_regs.c
500 +@@ -1286,6 +1286,7 @@ static const struct sys_reg_desc cp15_regs[] = {
501 + { Op1( 0), CRn( 2), CRm( 0), Op2( 0), access_vm_reg, NULL, c2_TTBR0 },
502 + { Op1( 0), CRn( 2), CRm( 0), Op2( 1), access_vm_reg, NULL, c2_TTBR1 },
503 + { Op1( 0), CRn( 2), CRm( 0), Op2( 2), access_vm_reg, NULL, c2_TTBCR },
504 ++ { Op1( 0), CRn( 2), CRm( 0), Op2( 3), access_vm_reg, NULL, c2_TTBCR2 },
505 + { Op1( 0), CRn( 3), CRm( 0), Op2( 0), access_vm_reg, NULL, c3_DACR },
506 + { Op1( 0), CRn( 5), CRm( 0), Op2( 0), access_vm_reg, NULL, c5_DFSR },
507 + { Op1( 0), CRn( 5), CRm( 0), Op2( 1), access_vm_reg, NULL, c5_IFSR },
508 +diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig
509 +index 29471038d817e..c6b99845fb377 100644
510 +--- a/arch/mips/bcm47xx/Kconfig
511 ++++ b/arch/mips/bcm47xx/Kconfig
512 +@@ -27,6 +27,7 @@ config BCM47XX_BCMA
513 + select BCMA
514 + select BCMA_HOST_SOC
515 + select BCMA_DRIVER_MIPS
516 ++ select BCMA_DRIVER_PCI if PCI
517 + select BCMA_DRIVER_PCI_HOSTMODE if PCI
518 + select BCMA_DRIVER_GPIO
519 + default y
520 +diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
521 +index e4451b30d7e32..89a5cdf46ad7f 100644
522 +--- a/arch/powerpc/include/asm/cputable.h
523 ++++ b/arch/powerpc/include/asm/cputable.h
524 +@@ -423,7 +423,6 @@ enum {
525 + CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
526 + CPU_FTR_DEBUG_LVL_EXC | CPU_FTR_EMB_HV | CPU_FTR_ALTIVEC_COMP | \
527 + CPU_FTR_CELL_TB_BUG | CPU_FTR_SMT)
528 +-#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
529 +
530 + /* 64-bit CPUs */
531 + #define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
532 +@@ -515,8 +514,6 @@ enum {
533 + CPU_FTRS_7447 | CPU_FTRS_7447A | CPU_FTRS_82XX |
534 + CPU_FTRS_G2_LE | CPU_FTRS_E300 | CPU_FTRS_E300C2 |
535 + CPU_FTRS_CLASSIC32 |
536 +-#else
537 +- CPU_FTRS_GENERIC_32 |
538 + #endif
539 + #ifdef CONFIG_PPC_8xx
540 + CPU_FTRS_8XX |
541 +@@ -567,8 +564,6 @@ enum {
542 + CPU_FTRS_7447 & CPU_FTRS_7447A & CPU_FTRS_82XX &
543 + CPU_FTRS_G2_LE & CPU_FTRS_E300 & CPU_FTRS_E300C2 &
544 + CPU_FTRS_CLASSIC32 &
545 +-#else
546 +- CPU_FTRS_GENERIC_32 &
547 + #endif
548 + #ifdef CONFIG_PPC_8xx
549 + CPU_FTRS_8XX &
550 +diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
551 +index 96e5a3bd23e86..55b266d7afe17 100644
552 +--- a/arch/powerpc/kernel/rtas.c
553 ++++ b/arch/powerpc/kernel/rtas.c
554 +@@ -1094,7 +1094,7 @@ static struct rtas_filter rtas_filters[] __ro_after_init = {
555 + { "ibm,display-message", -1, 0, -1, -1, -1 },
556 + { "ibm,errinjct", -1, 2, -1, -1, -1, 1024 },
557 + { "ibm,close-errinjct", -1, -1, -1, -1, -1 },
558 +- { "ibm,open-errinct", -1, -1, -1, -1, -1 },
559 ++ { "ibm,open-errinjct", -1, -1, -1, -1, -1 },
560 + { "ibm,get-config-addr-info2", -1, -1, -1, -1, -1 },
561 + { "ibm,get-dynamic-sensor-state", -1, 1, -1, -1, -1 },
562 + { "ibm,get-indices", -1, 2, 3, -1, -1 },
563 +diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
564 +index 78f75e48dfe7f..56f16c8035904 100644
565 +--- a/arch/powerpc/perf/core-book3s.c
566 ++++ b/arch/powerpc/perf/core-book3s.c
567 +@@ -2067,6 +2067,16 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
568 + local64_set(&event->hw.period_left, left);
569 + perf_event_update_userpage(event);
570 +
571 ++ /*
572 ++ * Due to hardware limitation, sometimes SIAR could sample a kernel
573 ++ * address even when freeze on supervisor state (kernel) is set in
574 ++ * MMCR2. Check attr.exclude_kernel and address to drop the sample in
575 ++ * these cases.
576 ++ */
577 ++ if (event->attr.exclude_kernel && record)
578 ++ if (is_kernel_addr(mfspr(SPRN_SIAR)))
579 ++ record = 0;
580 ++
581 + /*
582 + * Finally record data if requested.
583 + */
584 +diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
585 +index cfbd242c3e011..bff8e38a7e9a0 100644
586 +--- a/arch/powerpc/platforms/powernv/memtrace.c
587 ++++ b/arch/powerpc/platforms/powernv/memtrace.c
588 +@@ -99,6 +99,23 @@ static int change_memblock_state(struct memory_block *mem, void *arg)
589 + return 0;
590 + }
591 +
592 ++static void memtrace_clear_range(unsigned long start_pfn,
593 ++ unsigned long nr_pages)
594 ++{
595 ++ unsigned long pfn;
596 ++
597 ++ /*
598 ++ * As pages are offline, we cannot trust the memmap anymore. As HIGHMEM
599 ++ * does not apply, avoid passing around "struct page" and use
600 ++ * clear_page() instead directly.
601 ++ */
602 ++ for (pfn = start_pfn; pfn < start_pfn + nr_pages; pfn++) {
603 ++ if (IS_ALIGNED(pfn, PAGES_PER_SECTION))
604 ++ cond_resched();
605 ++ clear_page(__va(PFN_PHYS(pfn)));
606 ++ }
607 ++}
608 ++
609 + /* called with device_hotplug_lock held */
610 + static bool memtrace_offline_pages(u32 nid, u64 start_pfn, u64 nr_pages)
611 + {
612 +@@ -143,6 +160,11 @@ static u64 memtrace_alloc_node(u32 nid, u64 size)
613 + lock_device_hotplug();
614 + for (base_pfn = end_pfn; base_pfn > start_pfn; base_pfn -= nr_pages) {
615 + if (memtrace_offline_pages(nid, base_pfn, nr_pages) == true) {
616 ++ /*
617 ++ * Clear the range while we still have a linear
618 ++ * mapping.
619 ++ */
620 ++ memtrace_clear_range(base_pfn, nr_pages);
621 + /*
622 + * Remove memory in memory block size chunks so that
623 + * iomem resources are always split to the same size and
624 +diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
625 +index 89726f07d2492..b7cdad95584da 100644
626 +--- a/arch/powerpc/platforms/pseries/suspend.c
627 ++++ b/arch/powerpc/platforms/pseries/suspend.c
628 +@@ -26,7 +26,6 @@
629 + #include <asm/mmu.h>
630 + #include <asm/rtas.h>
631 + #include <asm/topology.h>
632 +-#include "../../kernel/cacheinfo.h"
633 +
634 + static u64 stream_id;
635 + static struct device suspend_dev;
636 +@@ -91,9 +90,7 @@ static void pseries_suspend_enable_irqs(void)
637 + * Update configuration which can be modified based on device tree
638 + * changes during resume.
639 + */
640 +- cacheinfo_cpu_offline(smp_processor_id());
641 + post_mobility_fixup();
642 +- cacheinfo_cpu_online(smp_processor_id());
643 + }
644 +
645 + /**
646 +@@ -224,7 +221,6 @@ static struct bus_type suspend_subsys = {
647 +
648 + static const struct platform_suspend_ops pseries_suspend_ops = {
649 + .valid = suspend_valid_only_mem,
650 +- .begin = pseries_suspend_begin,
651 + .prepare_late = pseries_prepare_late,
652 + .enter = pseries_suspend_enter,
653 + };
654 +diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c
655 +index d00123421e007..eefe1b94e0aad 100644
656 +--- a/arch/powerpc/xmon/nonstdio.c
657 ++++ b/arch/powerpc/xmon/nonstdio.c
658 +@@ -182,7 +182,7 @@ void xmon_printf(const char *format, ...)
659 +
660 + if (n && rc == 0) {
661 + /* No udbg hooks, fallback to printk() - dangerous */
662 +- printk("%s", xmon_outbuf);
663 ++ pr_cont("%s", xmon_outbuf);
664 + }
665 + }
666 +
667 +diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
668 +index 808f4fbe869e7..40946c8587a54 100644
669 +--- a/arch/s390/kernel/smp.c
670 ++++ b/arch/s390/kernel/smp.c
671 +@@ -864,24 +864,12 @@ static void smp_start_secondary(void *cpuvoid)
672 + /* Upping and downing of CPUs */
673 + int __cpu_up(unsigned int cpu, struct task_struct *tidle)
674 + {
675 +- struct pcpu *pcpu;
676 +- int base, i, rc;
677 ++ struct pcpu *pcpu = pcpu_devices + cpu;
678 ++ int rc;
679 +
680 +- pcpu = pcpu_devices + cpu;
681 + if (pcpu->state != CPU_STATE_CONFIGURED)
682 + return -EIO;
683 +- base = smp_get_base_cpu(cpu);
684 +- for (i = 0; i <= smp_cpu_mtid; i++) {
685 +- if (base + i < nr_cpu_ids)
686 +- if (cpu_online(base + i))
687 +- break;
688 +- }
689 +- /*
690 +- * If this is the first CPU of the core to get online
691 +- * do an initial CPU reset.
692 +- */
693 +- if (i > smp_cpu_mtid &&
694 +- pcpu_sigp_retry(pcpu_devices + base, SIGP_INITIAL_CPU_RESET, 0) !=
695 ++ if (pcpu_sigp_retry(pcpu, SIGP_INITIAL_CPU_RESET, 0) !=
696 + SIGP_CC_ORDER_CODE_ACCEPTED)
697 + return -EIO;
698 +
699 +diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
700 +index 20e30be44795b..e3b422ebce09f 100644
701 +--- a/arch/um/drivers/xterm.c
702 ++++ b/arch/um/drivers/xterm.c
703 +@@ -18,6 +18,7 @@
704 + struct xterm_chan {
705 + int pid;
706 + int helper_pid;
707 ++ int chan_fd;
708 + char *title;
709 + int device;
710 + int raw;
711 +@@ -33,6 +34,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts)
712 + return NULL;
713 + *data = ((struct xterm_chan) { .pid = -1,
714 + .helper_pid = -1,
715 ++ .chan_fd = -1,
716 + .device = device,
717 + .title = opts->xterm_title,
718 + .raw = opts->raw } );
719 +@@ -149,6 +151,7 @@ static int xterm_open(int input, int output, int primary, void *d,
720 + goto out_kill;
721 + }
722 +
723 ++ data->chan_fd = fd;
724 + new = xterm_fd(fd, &data->helper_pid);
725 + if (new < 0) {
726 + err = new;
727 +@@ -206,6 +209,8 @@ static void xterm_close(int fd, void *d)
728 + os_kill_process(data->helper_pid, 0);
729 + data->helper_pid = -1;
730 +
731 ++ if (data->chan_fd != -1)
732 ++ os_close_file(data->chan_fd);
733 + os_close_file(fd);
734 + }
735 +
736 +diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
737 +index e6c870c240657..7b0596b79d71d 100644
738 +--- a/arch/x86/include/asm/pgtable_types.h
739 ++++ b/arch/x86/include/asm/pgtable_types.h
740 +@@ -148,6 +148,7 @@ enum page_cache_mode {
741 + #endif
742 +
743 + #define _PAGE_CACHE_MASK (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)
744 ++#define _PAGE_LARGE_CACHE_MASK (_PAGE_PWT | _PAGE_PCD | _PAGE_PAT_LARGE)
745 + #define _PAGE_NOCACHE (cachemode2protval(_PAGE_CACHE_MODE_UC))
746 + #define _PAGE_CACHE_WP (cachemode2protval(_PAGE_CACHE_MODE_WP))
747 +
748 +diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
749 +index 02665ffef0506..700d434f5bda9 100644
750 +--- a/arch/x86/kernel/kprobes/core.c
751 ++++ b/arch/x86/kernel/kprobes/core.c
752 +@@ -1022,6 +1022,11 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
753 + * So clear it by resetting the current kprobe:
754 + */
755 + regs->flags &= ~X86_EFLAGS_TF;
756 ++ /*
757 ++ * Since the single step (trap) has been cancelled,
758 ++ * we need to restore BTF here.
759 ++ */
760 ++ restore_btf();
761 +
762 + /*
763 + * If the TF flag was set before the kprobe hit,
764 +diff --git a/arch/x86/mm/ident_map.c b/arch/x86/mm/ident_map.c
765 +index ab33a32df2a8e..407fa1df470e0 100644
766 +--- a/arch/x86/mm/ident_map.c
767 ++++ b/arch/x86/mm/ident_map.c
768 +@@ -62,6 +62,7 @@ static int ident_p4d_init(struct x86_mapping_info *info, p4d_t *p4d_page,
769 + unsigned long addr, unsigned long end)
770 + {
771 + unsigned long next;
772 ++ int result;
773 +
774 + for (; addr < end; addr = next) {
775 + p4d_t *p4d = p4d_page + p4d_index(addr);
776 +@@ -73,13 +74,20 @@ static int ident_p4d_init(struct x86_mapping_info *info, p4d_t *p4d_page,
777 +
778 + if (p4d_present(*p4d)) {
779 + pud = pud_offset(p4d, 0);
780 +- ident_pud_init(info, pud, addr, next);
781 ++ result = ident_pud_init(info, pud, addr, next);
782 ++ if (result)
783 ++ return result;
784 ++
785 + continue;
786 + }
787 + pud = (pud_t *)info->alloc_pgt_page(info->context);
788 + if (!pud)
789 + return -ENOMEM;
790 +- ident_pud_init(info, pud, addr, next);
791 ++
792 ++ result = ident_pud_init(info, pud, addr, next);
793 ++ if (result)
794 ++ return result;
795 ++
796 + set_p4d(p4d, __p4d(__pa(pud) | info->kernpg_flag));
797 + }
798 +
799 +diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c
800 +index 48c03c74c7f4b..f3ec45afce97b 100644
801 +--- a/arch/x86/mm/mem_encrypt.c
802 ++++ b/arch/x86/mm/mem_encrypt.c
803 +@@ -248,8 +248,8 @@ static void __init sme_clear_pgd(struct sme_populate_pgd_data *ppd)
804 + #define PMD_FLAGS_LARGE (__PAGE_KERNEL_LARGE_EXEC & ~_PAGE_GLOBAL)
805 +
806 + #define PMD_FLAGS_DEC PMD_FLAGS_LARGE
807 +-#define PMD_FLAGS_DEC_WP ((PMD_FLAGS_DEC & ~_PAGE_CACHE_MASK) | \
808 +- (_PAGE_PAT | _PAGE_PWT))
809 ++#define PMD_FLAGS_DEC_WP ((PMD_FLAGS_DEC & ~_PAGE_LARGE_CACHE_MASK) | \
810 ++ (_PAGE_PAT_LARGE | _PAGE_PWT))
811 +
812 + #define PMD_FLAGS_ENC (PMD_FLAGS_LARGE | _PAGE_ENC)
813 +
814 +diff --git a/crypto/af_alg.c b/crypto/af_alg.c
815 +index 3f3b57f80bdb9..da000a256e914 100644
816 +--- a/crypto/af_alg.c
817 ++++ b/crypto/af_alg.c
818 +@@ -151,7 +151,7 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
819 + const u32 allowed = CRYPTO_ALG_KERN_DRIVER_ONLY;
820 + struct sock *sk = sock->sk;
821 + struct alg_sock *ask = alg_sk(sk);
822 +- struct sockaddr_alg *sa = (void *)uaddr;
823 ++ struct sockaddr_alg_new *sa = (void *)uaddr;
824 + const struct af_alg_type *type;
825 + void *private;
826 + int err;
827 +@@ -159,7 +159,11 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
828 + if (sock->state == SS_CONNECTED)
829 + return -EINVAL;
830 +
831 +- if (addr_len < sizeof(*sa))
832 ++ BUILD_BUG_ON(offsetof(struct sockaddr_alg_new, salg_name) !=
833 ++ offsetof(struct sockaddr_alg, salg_name));
834 ++ BUILD_BUG_ON(offsetof(struct sockaddr_alg, salg_name) != sizeof(*sa));
835 ++
836 ++ if (addr_len < sizeof(*sa) + 1)
837 + return -EINVAL;
838 +
839 + /* If caller uses non-allowed flag, return error. */
840 +@@ -167,7 +171,7 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
841 + return -EINVAL;
842 +
843 + sa->salg_type[sizeof(sa->salg_type) - 1] = 0;
844 +- sa->salg_name[sizeof(sa->salg_name) + addr_len - sizeof(*sa) - 1] = 0;
845 ++ sa->salg_name[addr_len - sizeof(*sa) - 1] = 0;
846 +
847 + type = alg_get_type(sa->salg_type);
848 + if (IS_ERR(type) && PTR_ERR(type) == -ENOENT) {
849 +diff --git a/crypto/ecdh.c b/crypto/ecdh.c
850 +index 4271fc77d2616..3919b59ada250 100644
851 +--- a/crypto/ecdh.c
852 ++++ b/crypto/ecdh.c
853 +@@ -57,12 +57,13 @@ static int ecdh_set_secret(struct crypto_kpp *tfm, const void *buf,
854 + return ecc_gen_privkey(ctx->curve_id, ctx->ndigits,
855 + ctx->private_key);
856 +
857 +- if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits,
858 +- (const u64 *)params.key, params.key_size) < 0)
859 +- return -EINVAL;
860 +-
861 + memcpy(ctx->private_key, params.key, params.key_size);
862 +
863 ++ if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits,
864 ++ ctx->private_key, params.key_size) < 0) {
865 ++ memzero_explicit(ctx->private_key, params.key_size);
866 ++ return -EINVAL;
867 ++ }
868 + return 0;
869 + }
870 +
871 +diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
872 +index 67d97c0090a27..5d72baf60ac83 100644
873 +--- a/drivers/acpi/acpi_pnp.c
874 ++++ b/drivers/acpi/acpi_pnp.c
875 +@@ -320,6 +320,9 @@ static bool matching_id(const char *idstr, const char *list_id)
876 + {
877 + int i;
878 +
879 ++ if (strlen(idstr) != strlen(list_id))
880 ++ return false;
881 ++
882 + if (memcmp(idstr, list_id, 3))
883 + return false;
884 +
885 +diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
886 +index 6681174caf849..0b58ef76da12e 100644
887 +--- a/drivers/acpi/device_pm.c
888 ++++ b/drivers/acpi/device_pm.c
889 +@@ -694,7 +694,7 @@ static void acpi_pm_notify_work_func(struct acpi_device_wakeup_context *context)
890 + static DEFINE_MUTEX(acpi_wakeup_lock);
891 +
892 + static int __acpi_device_wakeup_enable(struct acpi_device *adev,
893 +- u32 target_state, int max_count)
894 ++ u32 target_state)
895 + {
896 + struct acpi_device_wakeup *wakeup = &adev->wakeup;
897 + acpi_status status;
898 +@@ -702,9 +702,10 @@ static int __acpi_device_wakeup_enable(struct acpi_device *adev,
899 +
900 + mutex_lock(&acpi_wakeup_lock);
901 +
902 +- if (wakeup->enable_count >= max_count)
903 ++ if (wakeup->enable_count >= INT_MAX) {
904 ++ acpi_handle_info(adev->handle, "Wakeup enable count out of bounds!\n");
905 + goto out;
906 +-
907 ++ }
908 + if (wakeup->enable_count > 0)
909 + goto inc;
910 +
911 +@@ -741,7 +742,7 @@ out:
912 + */
913 + static int acpi_device_wakeup_enable(struct acpi_device *adev, u32 target_state)
914 + {
915 +- return __acpi_device_wakeup_enable(adev, target_state, 1);
916 ++ return __acpi_device_wakeup_enable(adev, target_state);
917 + }
918 +
919 + /**
920 +@@ -771,8 +772,12 @@ out:
921 + mutex_unlock(&acpi_wakeup_lock);
922 + }
923 +
924 +-static int __acpi_pm_set_device_wakeup(struct device *dev, bool enable,
925 +- int max_count)
926 ++/**
927 ++ * acpi_pm_set_device_wakeup - Enable/disable remote wakeup for given device.
928 ++ * @dev: Device to enable/disable to generate wakeup events.
929 ++ * @enable: Whether to enable or disable the wakeup functionality.
930 ++ */
931 ++int acpi_pm_set_device_wakeup(struct device *dev, bool enable)
932 + {
933 + struct acpi_device *adev;
934 + int error;
935 +@@ -792,36 +797,14 @@ static int __acpi_pm_set_device_wakeup(struct device *dev, bool enable,
936 + return 0;
937 + }
938 +
939 +- error = __acpi_device_wakeup_enable(adev, acpi_target_system_state(),
940 +- max_count);
941 ++ error = __acpi_device_wakeup_enable(adev, acpi_target_system_state());
942 + if (!error)
943 + dev_dbg(dev, "Wakeup enabled by ACPI\n");
944 +
945 + return error;
946 + }
947 +-
948 +-/**
949 +- * acpi_pm_set_device_wakeup - Enable/disable remote wakeup for given device.
950 +- * @dev: Device to enable/disable to generate wakeup events.
951 +- * @enable: Whether to enable or disable the wakeup functionality.
952 +- */
953 +-int acpi_pm_set_device_wakeup(struct device *dev, bool enable)
954 +-{
955 +- return __acpi_pm_set_device_wakeup(dev, enable, 1);
956 +-}
957 + EXPORT_SYMBOL_GPL(acpi_pm_set_device_wakeup);
958 +
959 +-/**
960 +- * acpi_pm_set_bridge_wakeup - Enable/disable remote wakeup for given bridge.
961 +- * @dev: Bridge device to enable/disable to generate wakeup events.
962 +- * @enable: Whether to enable or disable the wakeup functionality.
963 +- */
964 +-int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable)
965 +-{
966 +- return __acpi_pm_set_device_wakeup(dev, enable, INT_MAX);
967 +-}
968 +-EXPORT_SYMBOL_GPL(acpi_pm_set_bridge_wakeup);
969 +-
970 + /**
971 + * acpi_dev_pm_low_power - Put ACPI device into a low-power state.
972 + * @dev: Device to put into a low-power state.
973 +diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
974 +index d85e010ee2cce..39ab333910dd4 100644
975 +--- a/drivers/acpi/resource.c
976 ++++ b/drivers/acpi/resource.c
977 +@@ -548,7 +548,7 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
978 + ret = c->preproc(ares, c->preproc_data);
979 + if (ret < 0) {
980 + c->error = ret;
981 +- return AE_CTRL_TERMINATE;
982 ++ return AE_ABORT_METHOD;
983 + } else if (ret > 0) {
984 + return AE_OK;
985 + }
986 +diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
987 +index d19adf1db1f1e..0dc642f13b0e8 100644
988 +--- a/drivers/block/xen-blkback/xenbus.c
989 ++++ b/drivers/block/xen-blkback/xenbus.c
990 +@@ -263,6 +263,7 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
991 +
992 + if (ring->xenblkd) {
993 + kthread_stop(ring->xenblkd);
994 ++ ring->xenblkd = NULL;
995 + wake_up(&ring->shutdown_wq);
996 + }
997 +
998 +@@ -650,7 +651,8 @@ static int xen_blkbk_probe(struct xenbus_device *dev,
999 + /* setup back pointer */
1000 + be->blkif->be = be;
1001 +
1002 +- err = xenbus_watch_pathfmt(dev, &be->backend_watch, backend_changed,
1003 ++ err = xenbus_watch_pathfmt(dev, &be->backend_watch, NULL,
1004 ++ backend_changed,
1005 + "%s/%s", dev->nodename, "physical-device");
1006 + if (err)
1007 + goto fail;
1008 +diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c
1009 +index 1b14256376d24..7c1da45be166e 100644
1010 +--- a/drivers/bus/mips_cdmm.c
1011 ++++ b/drivers/bus/mips_cdmm.c
1012 +@@ -544,10 +544,8 @@ static void mips_cdmm_bus_discover(struct mips_cdmm_bus *bus)
1013 + dev_set_name(&dev->dev, "cdmm%u-%u", cpu, id);
1014 + ++id;
1015 + ret = device_register(&dev->dev);
1016 +- if (ret) {
1017 ++ if (ret)
1018 + put_device(&dev->dev);
1019 +- kfree(dev);
1020 +- }
1021 + }
1022 + }
1023 +
1024 +diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
1025 +index f5d74e8db4327..1803af6230b27 100644
1026 +--- a/drivers/clk/clk-s2mps11.c
1027 ++++ b/drivers/clk/clk-s2mps11.c
1028 +@@ -211,6 +211,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
1029 + return ret;
1030 +
1031 + err_reg:
1032 ++ of_node_put(s2mps11_clks[0].clk_np);
1033 + while (--i >= 0)
1034 + clkdev_drop(s2mps11_clks[i].lookup);
1035 +
1036 +diff --git a/drivers/clk/mvebu/armada-37xx-xtal.c b/drivers/clk/mvebu/armada-37xx-xtal.c
1037 +index 612d65ede10a0..5370514959e15 100644
1038 +--- a/drivers/clk/mvebu/armada-37xx-xtal.c
1039 ++++ b/drivers/clk/mvebu/armada-37xx-xtal.c
1040 +@@ -15,8 +15,8 @@
1041 + #include <linux/platform_device.h>
1042 + #include <linux/regmap.h>
1043 +
1044 +-#define NB_GPIO1_LATCH 0xC
1045 +-#define XTAL_MODE BIT(31)
1046 ++#define NB_GPIO1_LATCH 0x8
1047 ++#define XTAL_MODE BIT(9)
1048 +
1049 + static int armada_3700_xtal_clock_probe(struct platform_device *pdev)
1050 + {
1051 +diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
1052 +index 183985c8c9bab..7e3cd0bd597dc 100644
1053 +--- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
1054 ++++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
1055 +@@ -381,6 +381,7 @@ static struct clk_div_table ths_div_table[] = {
1056 + { .val = 1, .div = 2 },
1057 + { .val = 2, .div = 4 },
1058 + { .val = 3, .div = 6 },
1059 ++ { /* Sentinel */ },
1060 + };
1061 + static const char * const ths_parents[] = { "osc24M" };
1062 + static struct ccu_div ths_clk = {
1063 +diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
1064 +index b09acda71abe9..aa44602896fac 100644
1065 +--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
1066 ++++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
1067 +@@ -315,6 +315,7 @@ static struct clk_div_table ths_div_table[] = {
1068 + { .val = 1, .div = 2 },
1069 + { .val = 2, .div = 4 },
1070 + { .val = 3, .div = 6 },
1071 ++ { /* Sentinel */ },
1072 + };
1073 + static SUNXI_CCU_DIV_TABLE_WITH_GATE(ths_clk, "ths", "osc24M",
1074 + 0x074, 0, 2, ths_div_table, BIT(31), 0);
1075 +diff --git a/drivers/clk/tegra/clk-id.h b/drivers/clk/tegra/clk-id.h
1076 +index 11ee5f9ce99e1..4374e4a6b5be5 100644
1077 +--- a/drivers/clk/tegra/clk-id.h
1078 ++++ b/drivers/clk/tegra/clk-id.h
1079 +@@ -234,6 +234,7 @@ enum clk_id {
1080 + tegra_clk_sdmmc4_8,
1081 + tegra_clk_sdmmc4_9,
1082 + tegra_clk_se,
1083 ++ tegra_clk_se_10,
1084 + tegra_clk_soc_therm,
1085 + tegra_clk_soc_therm_8,
1086 + tegra_clk_sor0,
1087 +diff --git a/drivers/clk/tegra/clk-tegra-periph.c b/drivers/clk/tegra/clk-tegra-periph.c
1088 +index d300a256fcacb..ca0735dc70ece 100644
1089 +--- a/drivers/clk/tegra/clk-tegra-periph.c
1090 ++++ b/drivers/clk/tegra/clk-tegra-periph.c
1091 +@@ -673,7 +673,7 @@ static struct tegra_periph_init_data periph_clks[] = {
1092 + INT8("host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_8),
1093 + INT8("host1x", mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_9),
1094 + INT8("se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se),
1095 +- INT8("se", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se),
1096 ++ INT8("se", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se_10),
1097 + INT8("2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, 0, tegra_clk_gr2d_8),
1098 + INT8("3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, 0, tegra_clk_gr3d_8),
1099 + INT8("vic03", mux_pllm_pllc_pllp_plla_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03),
1100 +diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c
1101 +index 071af44b1ba85..e33ce851837e4 100644
1102 +--- a/drivers/clk/ti/fapll.c
1103 ++++ b/drivers/clk/ti/fapll.c
1104 +@@ -497,6 +497,7 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd,
1105 + {
1106 + struct clk_init_data *init;
1107 + struct fapll_synth *synth;
1108 ++ struct clk *clk = ERR_PTR(-ENOMEM);
1109 +
1110 + init = kzalloc(sizeof(*init), GFP_KERNEL);
1111 + if (!init)
1112 +@@ -519,13 +520,19 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd,
1113 + synth->hw.init = init;
1114 + synth->clk_pll = pll_clk;
1115 +
1116 +- return clk_register(NULL, &synth->hw);
1117 ++ clk = clk_register(NULL, &synth->hw);
1118 ++ if (IS_ERR(clk)) {
1119 ++ pr_err("failed to register clock\n");
1120 ++ goto free;
1121 ++ }
1122 ++
1123 ++ return clk;
1124 +
1125 + free:
1126 + kfree(synth);
1127 + kfree(init);
1128 +
1129 +- return ERR_PTR(-ENOMEM);
1130 ++ return clk;
1131 + }
1132 +
1133 + static void __init ti_fapll_setup(struct device_node *node)
1134 +diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
1135 +index 14e2419063e93..2c5913057b87b 100644
1136 +--- a/drivers/clocksource/arm_arch_timer.c
1137 ++++ b/drivers/clocksource/arm_arch_timer.c
1138 +@@ -744,15 +744,24 @@ static void arch_timer_evtstrm_enable(int divider)
1139 +
1140 + static void arch_timer_configure_evtstream(void)
1141 + {
1142 +- int evt_stream_div, pos;
1143 ++ int evt_stream_div, lsb;
1144 ++
1145 ++ /*
1146 ++ * As the event stream can at most be generated at half the frequency
1147 ++ * of the counter, use half the frequency when computing the divider.
1148 ++ */
1149 ++ evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ / 2;
1150 ++
1151 ++ /*
1152 ++ * Find the closest power of two to the divisor. If the adjacent bit
1153 ++ * of lsb (last set bit, starts from 0) is set, then we use (lsb + 1).
1154 ++ */
1155 ++ lsb = fls(evt_stream_div) - 1;
1156 ++ if (lsb > 0 && (evt_stream_div & BIT(lsb - 1)))
1157 ++ lsb++;
1158 +
1159 +- /* Find the closest power of two to the divisor */
1160 +- evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ;
1161 +- pos = fls(evt_stream_div);
1162 +- if (pos > 1 && !(evt_stream_div & (1 << (pos - 2))))
1163 +- pos--;
1164 + /* enable event stream */
1165 +- arch_timer_evtstrm_enable(min(pos, 15));
1166 ++ arch_timer_evtstrm_enable(max(0, min(lsb, 15)));
1167 + }
1168 +
1169 + static void arch_counter_set_user_access(void)
1170 +diff --git a/drivers/clocksource/cadence_ttc_timer.c b/drivers/clocksource/cadence_ttc_timer.c
1171 +index 29d51755e18b2..a7eb858a84a0f 100644
1172 +--- a/drivers/clocksource/cadence_ttc_timer.c
1173 ++++ b/drivers/clocksource/cadence_ttc_timer.c
1174 +@@ -419,10 +419,8 @@ static int __init ttc_setup_clockevent(struct clk *clk,
1175 + ttcce->ttc.clk = clk;
1176 +
1177 + err = clk_prepare_enable(ttcce->ttc.clk);
1178 +- if (err) {
1179 +- kfree(ttcce);
1180 +- return err;
1181 +- }
1182 ++ if (err)
1183 ++ goto out_kfree;
1184 +
1185 + ttcce->ttc.clk_rate_change_nb.notifier_call =
1186 + ttc_rate_change_clockevent_cb;
1187 +@@ -432,7 +430,7 @@ static int __init ttc_setup_clockevent(struct clk *clk,
1188 + &ttcce->ttc.clk_rate_change_nb);
1189 + if (err) {
1190 + pr_warn("Unable to register clock notifier.\n");
1191 +- return err;
1192 ++ goto out_kfree;
1193 + }
1194 +
1195 + ttcce->ttc.freq = clk_get_rate(ttcce->ttc.clk);
1196 +@@ -461,15 +459,17 @@ static int __init ttc_setup_clockevent(struct clk *clk,
1197 +
1198 + err = request_irq(irq, ttc_clock_event_interrupt,
1199 + IRQF_TIMER, ttcce->ce.name, ttcce);
1200 +- if (err) {
1201 +- kfree(ttcce);
1202 +- return err;
1203 +- }
1204 ++ if (err)
1205 ++ goto out_kfree;
1206 +
1207 + clockevents_config_and_register(&ttcce->ce,
1208 + ttcce->ttc.freq / PRESCALE, 1, 0xfffe);
1209 +
1210 + return 0;
1211 ++
1212 ++out_kfree:
1213 ++ kfree(ttcce);
1214 ++ return err;
1215 + }
1216 +
1217 + /**
1218 +diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c
1219 +index 1608f7105c9f8..ad743f2f31e78 100644
1220 +--- a/drivers/cpufreq/highbank-cpufreq.c
1221 ++++ b/drivers/cpufreq/highbank-cpufreq.c
1222 +@@ -104,6 +104,13 @@ out_put_node:
1223 + }
1224 + module_init(hb_cpufreq_driver_init);
1225 +
1226 ++static const struct of_device_id __maybe_unused hb_cpufreq_of_match[] = {
1227 ++ { .compatible = "calxeda,highbank" },
1228 ++ { .compatible = "calxeda,ecx-2000" },
1229 ++ { },
1230 ++};
1231 ++MODULE_DEVICE_TABLE(of, hb_cpufreq_of_match);
1232 ++
1233 + MODULE_AUTHOR("Mark Langsdorf <mark.langsdorf@×××××××.com>");
1234 + MODULE_DESCRIPTION("Calxeda Highbank cpufreq driver");
1235 + MODULE_LICENSE("GPL");
1236 +diff --git a/drivers/cpufreq/loongson1-cpufreq.c b/drivers/cpufreq/loongson1-cpufreq.c
1237 +index be89416e2358f..9d902f67f8716 100644
1238 +--- a/drivers/cpufreq/loongson1-cpufreq.c
1239 ++++ b/drivers/cpufreq/loongson1-cpufreq.c
1240 +@@ -217,6 +217,7 @@ static struct platform_driver ls1x_cpufreq_platdrv = {
1241 +
1242 + module_platform_driver(ls1x_cpufreq_platdrv);
1243 +
1244 ++MODULE_ALIAS("platform:ls1x-cpufreq");
1245 + MODULE_AUTHOR("Kelvin Cheung <keguang.zhang@×××××.com>");
1246 + MODULE_DESCRIPTION("Loongson1 CPUFreq driver");
1247 + MODULE_LICENSE("GPL");
1248 +diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
1249 +index 18c4bd9a5c656..993cd461e34c1 100644
1250 +--- a/drivers/cpufreq/mediatek-cpufreq.c
1251 ++++ b/drivers/cpufreq/mediatek-cpufreq.c
1252 +@@ -582,6 +582,7 @@ static const struct of_device_id mtk_cpufreq_machines[] __initconst = {
1253 +
1254 + { }
1255 + };
1256 ++MODULE_DEVICE_TABLE(of, mtk_cpufreq_machines);
1257 +
1258 + static int __init mtk_cpufreq_driver_init(void)
1259 + {
1260 +diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c
1261 +index 8de2364b5995a..df6617b19de28 100644
1262 +--- a/drivers/cpufreq/scpi-cpufreq.c
1263 ++++ b/drivers/cpufreq/scpi-cpufreq.c
1264 +@@ -85,6 +85,7 @@ static struct platform_driver scpi_cpufreq_platdrv = {
1265 + };
1266 + module_platform_driver(scpi_cpufreq_platdrv);
1267 +
1268 ++MODULE_ALIAS("platform:scpi-cpufreq");
1269 + MODULE_AUTHOR("Sudeep Holla <sudeep.holla@×××.com>");
1270 + MODULE_DESCRIPTION("ARM SCPI CPUFreq interface driver");
1271 + MODULE_LICENSE("GPL v2");
1272 +diff --git a/drivers/cpufreq/sti-cpufreq.c b/drivers/cpufreq/sti-cpufreq.c
1273 +index 6b5d241c30b70..2d09960afa591 100644
1274 +--- a/drivers/cpufreq/sti-cpufreq.c
1275 ++++ b/drivers/cpufreq/sti-cpufreq.c
1276 +@@ -295,6 +295,13 @@ register_cpufreq_dt:
1277 + }
1278 + module_init(sti_cpufreq_init);
1279 +
1280 ++static const struct of_device_id __maybe_unused sti_cpufreq_of_match[] = {
1281 ++ { .compatible = "st,stih407" },
1282 ++ { .compatible = "st,stih410" },
1283 ++ { },
1284 ++};
1285 ++MODULE_DEVICE_TABLE(of, sti_cpufreq_of_match);
1286 ++
1287 + MODULE_DESCRIPTION("STMicroelectronics CPUFreq/OPP driver");
1288 + MODULE_AUTHOR("Ajitpal Singh <ajitpal.singh@××.com>");
1289 + MODULE_AUTHOR("Lee Jones <lee.jones@××××××.org>");
1290 +diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
1291 +index c376a3ee7c2c3..41c411ee0da5d 100644
1292 +--- a/drivers/crypto/omap-aes.c
1293 ++++ b/drivers/crypto/omap-aes.c
1294 +@@ -1071,7 +1071,7 @@ static int omap_aes_probe(struct platform_device *pdev)
1295 + if (err < 0) {
1296 + dev_err(dev, "%s: failed to get_sync(%d)\n",
1297 + __func__, err);
1298 +- goto err_res;
1299 ++ goto err_pm_disable;
1300 + }
1301 +
1302 + omap_aes_dma_stop(dd);
1303 +@@ -1180,6 +1180,7 @@ err_engine:
1304 + omap_aes_dma_cleanup(dd);
1305 + err_irq:
1306 + tasklet_kill(&dd->done_task);
1307 ++err_pm_disable:
1308 + pm_runtime_disable(dev);
1309 + err_res:
1310 + dd = NULL;
1311 +diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
1312 +index 6c8a03a1132f6..8028fbd5cda47 100644
1313 +--- a/drivers/crypto/talitos.c
1314 ++++ b/drivers/crypto/talitos.c
1315 +@@ -447,7 +447,7 @@ DEF_TALITOS2_DONE(ch1_3, TALITOS2_ISR_CH_1_3_DONE)
1316 + /*
1317 + * locate current (offending) descriptor
1318 + */
1319 +-static u32 current_desc_hdr(struct device *dev, int ch)
1320 ++static __be32 current_desc_hdr(struct device *dev, int ch)
1321 + {
1322 + struct talitos_private *priv = dev_get_drvdata(dev);
1323 + int tail, iter;
1324 +@@ -478,13 +478,13 @@ static u32 current_desc_hdr(struct device *dev, int ch)
1325 + /*
1326 + * user diagnostics; report root cause of error based on execution unit status
1327 + */
1328 +-static void report_eu_error(struct device *dev, int ch, u32 desc_hdr)
1329 ++static void report_eu_error(struct device *dev, int ch, __be32 desc_hdr)
1330 + {
1331 + struct talitos_private *priv = dev_get_drvdata(dev);
1332 + int i;
1333 +
1334 + if (!desc_hdr)
1335 +- desc_hdr = in_be32(priv->chan[ch].reg + TALITOS_DESCBUF);
1336 ++ desc_hdr = cpu_to_be32(in_be32(priv->chan[ch].reg + TALITOS_DESCBUF));
1337 +
1338 + switch (desc_hdr & DESC_HDR_SEL0_MASK) {
1339 + case DESC_HDR_SEL0_AFEU:
1340 +diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
1341 +index 21c5f95596be8..b757291f9dee9 100644
1342 +--- a/drivers/edac/amd64_edac.c
1343 ++++ b/drivers/edac/amd64_edac.c
1344 +@@ -18,6 +18,9 @@ static struct msr __percpu *msrs;
1345 + /* Per-node stuff */
1346 + static struct ecc_settings **ecc_stngs;
1347 +
1348 ++/* Device for the PCI component */
1349 ++static struct device *pci_ctl_dev;
1350 ++
1351 + /*
1352 + * Valid scrub rates for the K8 hardware memory scrubber. We map the scrubbing
1353 + * bandwidth to a valid bit pattern. The 'set' operation finds the 'matching-
1354 +@@ -2554,6 +2557,9 @@ reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2)
1355 + return -ENODEV;
1356 + }
1357 +
1358 ++ if (!pci_ctl_dev)
1359 ++ pci_ctl_dev = &pvt->F0->dev;
1360 ++
1361 + edac_dbg(1, "F0: %s\n", pci_name(pvt->F0));
1362 + edac_dbg(1, "F3: %s\n", pci_name(pvt->F3));
1363 + edac_dbg(1, "F6: %s\n", pci_name(pvt->F6));
1364 +@@ -2578,6 +2584,9 @@ reserve_mc_sibling_devs(struct amd64_pvt *pvt, u16 pci_id1, u16 pci_id2)
1365 + return -ENODEV;
1366 + }
1367 +
1368 ++ if (!pci_ctl_dev)
1369 ++ pci_ctl_dev = &pvt->F2->dev;
1370 ++
1371 + edac_dbg(1, "F1: %s\n", pci_name(pvt->F1));
1372 + edac_dbg(1, "F2: %s\n", pci_name(pvt->F2));
1373 + edac_dbg(1, "F3: %s\n", pci_name(pvt->F3));
1374 +@@ -3428,21 +3437,10 @@ static void remove_one_instance(unsigned int nid)
1375 +
1376 + static void setup_pci_device(void)
1377 + {
1378 +- struct mem_ctl_info *mci;
1379 +- struct amd64_pvt *pvt;
1380 +-
1381 + if (pci_ctl)
1382 + return;
1383 +
1384 +- mci = edac_mc_find(0);
1385 +- if (!mci)
1386 +- return;
1387 +-
1388 +- pvt = mci->pvt_info;
1389 +- if (pvt->umc)
1390 +- pci_ctl = edac_pci_create_generic_ctl(&pvt->F0->dev, EDAC_MOD_STR);
1391 +- else
1392 +- pci_ctl = edac_pci_create_generic_ctl(&pvt->F2->dev, EDAC_MOD_STR);
1393 ++ pci_ctl = edac_pci_create_generic_ctl(pci_ctl_dev, EDAC_MOD_STR);
1394 + if (!pci_ctl) {
1395 + pr_warn("%s(): Unable to create PCI control\n", __func__);
1396 + pr_warn("%s(): PCI error report via EDAC not set\n", __func__);
1397 +@@ -3517,6 +3515,8 @@ static int __init amd64_edac_init(void)
1398 + return 0;
1399 +
1400 + err_pci:
1401 ++ pci_ctl_dev = NULL;
1402 ++
1403 + msrs_free(msrs);
1404 + msrs = NULL;
1405 +
1406 +@@ -3548,6 +3548,8 @@ static void __exit amd64_edac_exit(void)
1407 + kfree(ecc_stngs);
1408 + ecc_stngs = NULL;
1409 +
1410 ++ pci_ctl_dev = NULL;
1411 ++
1412 + msrs_free(msrs);
1413 + msrs = NULL;
1414 + }
1415 +diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
1416 +index 7a58568090474..8ea33946b4b25 100644
1417 +--- a/drivers/extcon/extcon-max77693.c
1418 ++++ b/drivers/extcon/extcon-max77693.c
1419 +@@ -1275,4 +1275,4 @@ module_platform_driver(max77693_muic_driver);
1420 + MODULE_DESCRIPTION("Maxim MAX77693 Extcon driver");
1421 + MODULE_AUTHOR("Chanwoo Choi <cw00.choi@×××××××.com>");
1422 + MODULE_LICENSE("GPL");
1423 +-MODULE_ALIAS("platform:extcon-max77693");
1424 ++MODULE_ALIAS("platform:max77693-muic");
1425 +diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
1426 +index be85d4b39e997..fc762b4adcb22 100644
1427 +--- a/drivers/gpio/gpio-mvebu.c
1428 ++++ b/drivers/gpio/gpio-mvebu.c
1429 +@@ -1195,6 +1195,13 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
1430 +
1431 + devm_gpiochip_add_data(&pdev->dev, &mvchip->chip, mvchip);
1432 +
1433 ++ /* Some MVEBU SoCs have simple PWM support for GPIO lines */
1434 ++ if (IS_ENABLED(CONFIG_PWM)) {
1435 ++ err = mvebu_pwm_probe(pdev, mvchip, id);
1436 ++ if (err)
1437 ++ return err;
1438 ++ }
1439 ++
1440 + /* Some gpio controllers do not provide irq support */
1441 + if (!have_irqs)
1442 + return 0;
1443 +@@ -1204,7 +1211,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
1444 + if (!mvchip->domain) {
1445 + dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n",
1446 + mvchip->chip.label);
1447 +- return -ENODEV;
1448 ++ err = -ENODEV;
1449 ++ goto err_pwm;
1450 + }
1451 +
1452 + err = irq_alloc_domain_generic_chips(
1453 +@@ -1252,14 +1260,12 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
1454 + mvchip);
1455 + }
1456 +
1457 +- /* Some MVEBU SoCs have simple PWM support for GPIO lines */
1458 +- if (IS_ENABLED(CONFIG_PWM))
1459 +- return mvebu_pwm_probe(pdev, mvchip, id);
1460 +-
1461 + return 0;
1462 +
1463 + err_domain:
1464 + irq_domain_remove(mvchip->domain);
1465 ++err_pwm:
1466 ++ pwmchip_remove(&mvchip->mvpwm->chip);
1467 +
1468 + return err;
1469 + }
1470 +diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c b/drivers/gpu/drm/drm_dp_aux_dev.c
1471 +index d34e5096887a4..7bb32a890516f 100644
1472 +--- a/drivers/gpu/drm/drm_dp_aux_dev.c
1473 ++++ b/drivers/gpu/drm/drm_dp_aux_dev.c
1474 +@@ -60,7 +60,7 @@ static struct drm_dp_aux_dev *drm_dp_aux_dev_get_by_minor(unsigned index)
1475 +
1476 + mutex_lock(&aux_idr_mutex);
1477 + aux_dev = idr_find(&aux_idr, index);
1478 +- if (!kref_get_unless_zero(&aux_dev->refcount))
1479 ++ if (aux_dev && !kref_get_unless_zero(&aux_dev->refcount))
1480 + aux_dev = NULL;
1481 + mutex_unlock(&aux_idr_mutex);
1482 +
1483 +diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
1484 +index e52381c9d04ee..ceac9aaf4fe9c 100644
1485 +--- a/drivers/gpu/drm/drm_dp_mst_topology.c
1486 ++++ b/drivers/gpu/drm/drm_dp_mst_topology.c
1487 +@@ -2629,11 +2629,11 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr,
1488 + {
1489 + int ret;
1490 +
1491 +- port = drm_dp_get_validated_port_ref(mgr, port);
1492 +- if (!port)
1493 ++ if (slots < 0)
1494 + return false;
1495 +
1496 +- if (slots < 0)
1497 ++ port = drm_dp_get_validated_port_ref(mgr, port);
1498 ++ if (!port)
1499 + return false;
1500 +
1501 + if (port->vcpi.vcpi > 0) {
1502 +@@ -2648,6 +2648,7 @@ bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr,
1503 + if (ret) {
1504 + DRM_DEBUG_KMS("failed to init vcpi slots=%d max=63 ret=%d\n",
1505 + DIV_ROUND_UP(pbn, mgr->pbn_div), ret);
1506 ++ drm_dp_put_port(port);
1507 + goto out;
1508 + }
1509 + DRM_DEBUG_KMS("initing vcpi for pbn=%d slots=%d\n",
1510 +diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
1511 +index 7ec4e3fbafd8c..ec6ea202cf5de 100644
1512 +--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
1513 ++++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
1514 +@@ -2126,7 +2126,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
1515 + DRM_INFO("failed to retrieve link info, disabling eDP\n");
1516 + cdv_intel_dp_encoder_destroy(encoder);
1517 + cdv_intel_dp_destroy(connector);
1518 +- goto err_priv;
1519 ++ goto err_connector;
1520 + } else {
1521 + DRM_DEBUG_KMS("DPCD: Rev=%x LN_Rate=%x LN_CNT=%x LN_DOWNSP=%x\n",
1522 + intel_dp->dpcd[0], intel_dp->dpcd[1],
1523 +diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
1524 +index 32901c6fe3dfc..6d0c0405e736d 100644
1525 +--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
1526 ++++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
1527 +@@ -751,6 +751,7 @@ static int omap_dmm_probe(struct platform_device *dev)
1528 + &omap_dmm->refill_pa, GFP_KERNEL);
1529 + if (!omap_dmm->refill_va) {
1530 + dev_err(&dev->dev, "could not allocate refill memory\n");
1531 ++ ret = -ENOMEM;
1532 + goto fail;
1533 + }
1534 +
1535 +diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
1536 +index 7ab1d1dc7cd73..352ae52be3418 100644
1537 +--- a/drivers/gpu/drm/tegra/sor.c
1538 ++++ b/drivers/gpu/drm/tegra/sor.c
1539 +@@ -2378,17 +2378,23 @@ static int tegra_sor_init(struct host1x_client *client)
1540 + if (err < 0) {
1541 + dev_err(sor->dev, "failed to deassert SOR reset: %d\n",
1542 + err);
1543 ++ clk_disable_unprepare(sor->clk);
1544 + return err;
1545 + }
1546 + }
1547 +
1548 + err = clk_prepare_enable(sor->clk_safe);
1549 +- if (err < 0)
1550 ++ if (err < 0) {
1551 ++ clk_disable_unprepare(sor->clk);
1552 + return err;
1553 ++ }
1554 +
1555 + err = clk_prepare_enable(sor->clk_dp);
1556 +- if (err < 0)
1557 ++ if (err < 0) {
1558 ++ clk_disable_unprepare(sor->clk_safe);
1559 ++ clk_disable_unprepare(sor->clk);
1560 + return err;
1561 ++ }
1562 +
1563 + return 0;
1564 + }
1565 +diff --git a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
1566 +index f98c1e1b1dbdc..58a753ef27175 100644
1567 +--- a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
1568 ++++ b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
1569 +@@ -397,6 +397,14 @@ static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = {
1570 + },
1571 + .driver_data = (void *)&sipodev_desc
1572 + },
1573 ++ {
1574 ++ .ident = "Vero K147",
1575 ++ .matches = {
1576 ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VERO"),
1577 ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "K147"),
1578 ++ },
1579 ++ .driver_data = (void *)&sipodev_desc
1580 ++ },
1581 + { } /* Terminate list */
1582 + };
1583 +
1584 +diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
1585 +index 88e48b3469164..3554443a609cb 100644
1586 +--- a/drivers/hsi/controllers/omap_ssi_core.c
1587 ++++ b/drivers/hsi/controllers/omap_ssi_core.c
1588 +@@ -389,7 +389,7 @@ static int ssi_add_controller(struct hsi_controller *ssi,
1589 +
1590 + err = ida_simple_get(&platform_omap_ssi_ida, 0, 0, GFP_KERNEL);
1591 + if (err < 0)
1592 +- goto out_err;
1593 ++ return err;
1594 + ssi->id = err;
1595 +
1596 + ssi->owner = THIS_MODULE;
1597 +diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
1598 +index 5f612d694b331..671ddbc97e790 100644
1599 +--- a/drivers/iio/adc/rockchip_saradc.c
1600 ++++ b/drivers/iio/adc/rockchip_saradc.c
1601 +@@ -384,7 +384,7 @@ static int rockchip_saradc_resume(struct device *dev)
1602 +
1603 + ret = clk_prepare_enable(info->clk);
1604 + if (ret)
1605 +- return ret;
1606 ++ clk_disable_unprepare(info->pclk);
1607 +
1608 + return ret;
1609 + }
1610 +diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
1611 +index cfd225ed1c8da..01fcd715485c5 100644
1612 +--- a/drivers/iio/imu/bmi160/bmi160_core.c
1613 ++++ b/drivers/iio/imu/bmi160/bmi160_core.c
1614 +@@ -385,8 +385,8 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
1615 + struct iio_poll_func *pf = p;
1616 + struct iio_dev *indio_dev = pf->indio_dev;
1617 + struct bmi160_data *data = iio_priv(indio_dev);
1618 +- __le16 buf[16];
1619 +- /* 3 sens x 3 axis x __le16 + 3 x __le16 pad + 4 x __le16 tstamp */
1620 ++ __le16 buf[12];
1621 ++ /* 2 sens x 3 axis x __le16 + 2 x __le16 pad + 4 x __le16 tstamp */
1622 + int i, ret, j = 0, base = BMI160_REG_DATA_MAGN_XOUT_L;
1623 + __le16 sample;
1624 +
1625 +diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
1626 +index c3badf6343782..623fc4850af67 100644
1627 +--- a/drivers/iio/industrialio-buffer.c
1628 ++++ b/drivers/iio/industrialio-buffer.c
1629 +@@ -850,12 +850,12 @@ static int iio_buffer_update_demux(struct iio_dev *indio_dev,
1630 + indio_dev->masklength,
1631 + in_ind + 1);
1632 + while (in_ind != out_ind) {
1633 +- in_ind = find_next_bit(indio_dev->active_scan_mask,
1634 +- indio_dev->masklength,
1635 +- in_ind + 1);
1636 + length = iio_storage_bytes_for_si(indio_dev, in_ind);
1637 + /* Make sure we are aligned */
1638 + in_loc = roundup(in_loc, length) + length;
1639 ++ in_ind = find_next_bit(indio_dev->active_scan_mask,
1640 ++ indio_dev->masklength,
1641 ++ in_ind + 1);
1642 + }
1643 + length = iio_storage_bytes_for_si(indio_dev, in_ind);
1644 + out_loc = roundup(out_loc, length);
1645 +diff --git a/drivers/iio/light/rpr0521.c b/drivers/iio/light/rpr0521.c
1646 +index a6efa12613a26..f635c607b3091 100644
1647 +--- a/drivers/iio/light/rpr0521.c
1648 ++++ b/drivers/iio/light/rpr0521.c
1649 +@@ -197,6 +197,17 @@ struct rpr0521_data {
1650 + bool pxs_need_dis;
1651 +
1652 + struct regmap *regmap;
1653 ++
1654 ++ /*
1655 ++ * Ensure correct naturally aligned timestamp.
1656 ++ * Note that the read will put garbage data into
1657 ++ * the padding but this should not be a problem
1658 ++ */
1659 ++ struct {
1660 ++ __le16 channels[3];
1661 ++ u8 garbage;
1662 ++ s64 ts __aligned(8);
1663 ++ } scan;
1664 + };
1665 +
1666 + static IIO_CONST_ATTR(in_intensity_scale_available, RPR0521_ALS_SCALE_AVAIL);
1667 +@@ -452,8 +463,6 @@ static irqreturn_t rpr0521_trigger_consumer_handler(int irq, void *p)
1668 + struct rpr0521_data *data = iio_priv(indio_dev);
1669 + int err;
1670 +
1671 +- u8 buffer[16]; /* 3 16-bit channels + padding + ts */
1672 +-
1673 + /* Use irq timestamp when reasonable. */
1674 + if (iio_trigger_using_own(indio_dev) && data->irq_timestamp) {
1675 + pf->timestamp = data->irq_timestamp;
1676 +@@ -464,11 +473,11 @@ static irqreturn_t rpr0521_trigger_consumer_handler(int irq, void *p)
1677 + pf->timestamp = iio_get_time_ns(indio_dev);
1678 +
1679 + err = regmap_bulk_read(data->regmap, RPR0521_REG_PXS_DATA,
1680 +- &buffer,
1681 ++ data->scan.channels,
1682 + (3 * 2) + 1); /* 3 * 16-bit + (discarded) int clear reg. */
1683 + if (!err)
1684 + iio_push_to_buffers_with_timestamp(indio_dev,
1685 +- buffer, pf->timestamp);
1686 ++ &data->scan, pf->timestamp);
1687 + else
1688 + dev_err(&data->client->dev,
1689 + "Trigger consumer can't read from sensor.\n");
1690 +diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c
1691 +index 619b963714c73..1799eebe4ecdb 100644
1692 +--- a/drivers/iio/pressure/mpl3115.c
1693 ++++ b/drivers/iio/pressure/mpl3115.c
1694 +@@ -147,7 +147,14 @@ static irqreturn_t mpl3115_trigger_handler(int irq, void *p)
1695 + struct iio_poll_func *pf = p;
1696 + struct iio_dev *indio_dev = pf->indio_dev;
1697 + struct mpl3115_data *data = iio_priv(indio_dev);
1698 +- u8 buffer[16]; /* 32-bit channel + 16-bit channel + padding + ts */
1699 ++ /*
1700 ++ * 32-bit channel + 16-bit channel + padding + ts
1701 ++ * Note that it is possible for only one of the first 2
1702 ++ * channels to be enabled. If that happens, the first element
1703 ++ * of the buffer may be either 16 or 32-bits. As such we cannot
1704 ++ * use a simple structure definition to express this data layout.
1705 ++ */
1706 ++ u8 buffer[16] __aligned(8);
1707 + int ret, pos = 0;
1708 +
1709 + mutex_lock(&data->lock);
1710 +diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
1711 +index 80a8eb7e5d6ec..3ddc556df809c 100644
1712 +--- a/drivers/infiniband/core/cm.c
1713 ++++ b/drivers/infiniband/core/cm.c
1714 +@@ -1349,6 +1349,7 @@ int ib_send_cm_req(struct ib_cm_id *cm_id,
1715 + id.local_id);
1716 + if (IS_ERR(cm_id_priv->timewait_info)) {
1717 + ret = PTR_ERR(cm_id_priv->timewait_info);
1718 ++ cm_id_priv->timewait_info = NULL;
1719 + goto out;
1720 + }
1721 +
1722 +@@ -1836,6 +1837,7 @@ static int cm_req_handler(struct cm_work *work)
1723 + id.local_id);
1724 + if (IS_ERR(cm_id_priv->timewait_info)) {
1725 + ret = PTR_ERR(cm_id_priv->timewait_info);
1726 ++ cm_id_priv->timewait_info = NULL;
1727 + goto destroy;
1728 + }
1729 + cm_id_priv->timewait_info->work.remote_id = req_msg->local_comm_id;
1730 +diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
1731 +index ef9135aa392c1..ab218767bf05f 100644
1732 +--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
1733 ++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
1734 +@@ -1590,6 +1590,7 @@ int bnxt_re_query_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
1735 + goto out;
1736 + }
1737 + qp_attr->qp_state = __to_ib_qp_state(qplib_qp->state);
1738 ++ qp_attr->cur_qp_state = __to_ib_qp_state(qplib_qp->cur_qp_state);
1739 + qp_attr->en_sqd_async_notify = qplib_qp->en_sqd_async_notify ? 1 : 0;
1740 + qp_attr->qp_access_flags = __to_ib_access_flags(qplib_qp->access);
1741 + qp_attr->pkey_index = qplib_qp->pkey_index;
1742 +diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
1743 +index 6b15508ce17e7..24d4c9d9a4eeb 100644
1744 +--- a/drivers/infiniband/hw/cxgb4/cq.c
1745 ++++ b/drivers/infiniband/hw/cxgb4/cq.c
1746 +@@ -906,6 +906,9 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev,
1747 +
1748 + rhp = to_c4iw_dev(ibdev);
1749 +
1750 ++ if (entries < 1 || entries > ibdev->attrs.max_cqe)
1751 ++ return ERR_PTR(-EINVAL);
1752 ++
1753 + if (vector >= rhp->rdev.lldi.nciq)
1754 + return ERR_PTR(-EINVAL);
1755 +
1756 +diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
1757 +index a5694dec3f2ee..098653b8157ed 100644
1758 +--- a/drivers/infiniband/hw/mthca/mthca_cq.c
1759 ++++ b/drivers/infiniband/hw/mthca/mthca_cq.c
1760 +@@ -609,7 +609,7 @@ static inline int mthca_poll_one(struct mthca_dev *dev,
1761 + entry->byte_len = MTHCA_ATOMIC_BYTE_LEN;
1762 + break;
1763 + default:
1764 +- entry->opcode = MTHCA_OPCODE_INVALID;
1765 ++ entry->opcode = 0xFF;
1766 + break;
1767 + }
1768 + } else {
1769 +diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
1770 +index 5508afbf1c677..b487e1339c7fb 100644
1771 +--- a/drivers/infiniband/hw/mthca/mthca_dev.h
1772 ++++ b/drivers/infiniband/hw/mthca/mthca_dev.h
1773 +@@ -105,7 +105,6 @@ enum {
1774 + MTHCA_OPCODE_ATOMIC_CS = 0x11,
1775 + MTHCA_OPCODE_ATOMIC_FA = 0x12,
1776 + MTHCA_OPCODE_BIND_MW = 0x18,
1777 +- MTHCA_OPCODE_INVALID = 0xff
1778 + };
1779 +
1780 + enum {
1781 +diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
1782 +index e6785b1ea85fc..693884160f001 100644
1783 +--- a/drivers/infiniband/sw/rxe/rxe_req.c
1784 ++++ b/drivers/infiniband/sw/rxe/rxe_req.c
1785 +@@ -664,7 +664,8 @@ next_wqe:
1786 + }
1787 +
1788 + if (unlikely(qp_type(qp) == IB_QPT_RC &&
1789 +- qp->req.psn > (qp->comp.psn + RXE_MAX_UNACKED_PSNS))) {
1790 ++ psn_compare(qp->req.psn, (qp->comp.psn +
1791 ++ RXE_MAX_UNACKED_PSNS)) > 0)) {
1792 + qp->req.wait_psn = 1;
1793 + goto exit;
1794 + }
1795 +diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
1796 +index 0993b3f12df6a..149f4045f0f15 100644
1797 +--- a/drivers/input/keyboard/cros_ec_keyb.c
1798 ++++ b/drivers/input/keyboard/cros_ec_keyb.c
1799 +@@ -196,6 +196,7 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
1800 + "changed: [r%d c%d]: byte %02x\n",
1801 + row, col, new_state);
1802 +
1803 ++ input_event(idev, EV_MSC, MSC_SCAN, pos);
1804 + input_report_key(idev, keycodes[pos],
1805 + new_state);
1806 + }
1807 +diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
1808 +index 5480f1a5658ee..a42a75a53a113 100644
1809 +--- a/drivers/input/keyboard/omap4-keypad.c
1810 ++++ b/drivers/input/keyboard/omap4-keypad.c
1811 +@@ -199,12 +199,8 @@ static int omap4_keypad_open(struct input_dev *input)
1812 + return 0;
1813 + }
1814 +
1815 +-static void omap4_keypad_close(struct input_dev *input)
1816 ++static void omap4_keypad_stop(struct omap4_keypad *keypad_data)
1817 + {
1818 +- struct omap4_keypad *keypad_data = input_get_drvdata(input);
1819 +-
1820 +- disable_irq(keypad_data->irq);
1821 +-
1822 + /* Disable interrupts and wake-up events */
1823 + kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
1824 + OMAP4_VAL_IRQDISABLE);
1825 +@@ -213,7 +209,15 @@ static void omap4_keypad_close(struct input_dev *input)
1826 + /* clear pending interrupts */
1827 + kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,
1828 + kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS));
1829 ++}
1830 ++
1831 ++static void omap4_keypad_close(struct input_dev *input)
1832 ++{
1833 ++ struct omap4_keypad *keypad_data;
1834 +
1835 ++ keypad_data = input_get_drvdata(input);
1836 ++ disable_irq(keypad_data->irq);
1837 ++ omap4_keypad_stop(keypad_data);
1838 + enable_irq(keypad_data->irq);
1839 +
1840 + pm_runtime_put_sync(input->dev.parent);
1841 +@@ -236,13 +240,37 @@ static int omap4_keypad_parse_dt(struct device *dev,
1842 + return 0;
1843 + }
1844 +
1845 ++static int omap4_keypad_check_revision(struct device *dev,
1846 ++ struct omap4_keypad *keypad_data)
1847 ++{
1848 ++ unsigned int rev;
1849 ++
1850 ++ rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION);
1851 ++ rev &= 0x03 << 30;
1852 ++ rev >>= 30;
1853 ++ switch (rev) {
1854 ++ case KBD_REVISION_OMAP4:
1855 ++ keypad_data->reg_offset = 0x00;
1856 ++ keypad_data->irqreg_offset = 0x00;
1857 ++ break;
1858 ++ case KBD_REVISION_OMAP5:
1859 ++ keypad_data->reg_offset = 0x10;
1860 ++ keypad_data->irqreg_offset = 0x0c;
1861 ++ break;
1862 ++ default:
1863 ++ dev_err(dev, "Keypad reports unsupported revision %d", rev);
1864 ++ return -EINVAL;
1865 ++ }
1866 ++
1867 ++ return 0;
1868 ++}
1869 ++
1870 + static int omap4_keypad_probe(struct platform_device *pdev)
1871 + {
1872 + struct omap4_keypad *keypad_data;
1873 + struct input_dev *input_dev;
1874 + struct resource *res;
1875 + unsigned int max_keys;
1876 +- int rev;
1877 + int irq;
1878 + int error;
1879 +
1880 +@@ -282,41 +310,33 @@ static int omap4_keypad_probe(struct platform_device *pdev)
1881 + goto err_release_mem;
1882 + }
1883 +
1884 ++ pm_runtime_enable(&pdev->dev);
1885 +
1886 + /*
1887 + * Enable clocks for the keypad module so that we can read
1888 + * revision register.
1889 + */
1890 +- pm_runtime_enable(&pdev->dev);
1891 + error = pm_runtime_get_sync(&pdev->dev);
1892 + if (error) {
1893 + dev_err(&pdev->dev, "pm_runtime_get_sync() failed\n");
1894 +- goto err_unmap;
1895 +- }
1896 +- rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION);
1897 +- rev &= 0x03 << 30;
1898 +- rev >>= 30;
1899 +- switch (rev) {
1900 +- case KBD_REVISION_OMAP4:
1901 +- keypad_data->reg_offset = 0x00;
1902 +- keypad_data->irqreg_offset = 0x00;
1903 +- break;
1904 +- case KBD_REVISION_OMAP5:
1905 +- keypad_data->reg_offset = 0x10;
1906 +- keypad_data->irqreg_offset = 0x0c;
1907 +- break;
1908 +- default:
1909 +- dev_err(&pdev->dev,
1910 +- "Keypad reports unsupported revision %d", rev);
1911 +- error = -EINVAL;
1912 +- goto err_pm_put_sync;
1913 ++ pm_runtime_put_noidle(&pdev->dev);
1914 ++ } else {
1915 ++ error = omap4_keypad_check_revision(&pdev->dev,
1916 ++ keypad_data);
1917 ++ if (!error) {
1918 ++ /* Ensure device does not raise interrupts */
1919 ++ omap4_keypad_stop(keypad_data);
1920 ++ }
1921 ++ pm_runtime_put_sync(&pdev->dev);
1922 + }
1923 ++ if (error)
1924 ++ goto err_pm_disable;
1925 +
1926 + /* input device allocation */
1927 + keypad_data->input = input_dev = input_allocate_device();
1928 + if (!input_dev) {
1929 + error = -ENOMEM;
1930 +- goto err_pm_put_sync;
1931 ++ goto err_pm_disable;
1932 + }
1933 +
1934 + input_dev->name = pdev->name;
1935 +@@ -361,28 +381,25 @@ static int omap4_keypad_probe(struct platform_device *pdev)
1936 + goto err_free_keymap;
1937 + }
1938 +
1939 +- device_init_wakeup(&pdev->dev, true);
1940 +- pm_runtime_put_sync(&pdev->dev);
1941 +-
1942 + error = input_register_device(keypad_data->input);
1943 + if (error < 0) {
1944 + dev_err(&pdev->dev, "failed to register input device\n");
1945 +- goto err_pm_disable;
1946 ++ goto err_free_irq;
1947 + }
1948 +
1949 ++ device_init_wakeup(&pdev->dev, true);
1950 + platform_set_drvdata(pdev, keypad_data);
1951 ++
1952 + return 0;
1953 +
1954 +-err_pm_disable:
1955 +- pm_runtime_disable(&pdev->dev);
1956 ++err_free_irq:
1957 + free_irq(keypad_data->irq, keypad_data);
1958 + err_free_keymap:
1959 + kfree(keypad_data->keymap);
1960 + err_free_input:
1961 + input_free_device(input_dev);
1962 +-err_pm_put_sync:
1963 +- pm_runtime_put_sync(&pdev->dev);
1964 +-err_unmap:
1965 ++err_pm_disable:
1966 ++ pm_runtime_disable(&pdev->dev);
1967 + iounmap(keypad_data->base);
1968 + err_release_mem:
1969 + release_mem_region(res->start, resource_size(res));
1970 +diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
1971 +index 23c191a2a0715..cf4d507efaf6d 100644
1972 +--- a/drivers/input/misc/cm109.c
1973 ++++ b/drivers/input/misc/cm109.c
1974 +@@ -571,12 +571,15 @@ static int cm109_input_open(struct input_dev *idev)
1975 + dev->ctl_data->byte[HID_OR2] = dev->keybit;
1976 + dev->ctl_data->byte[HID_OR3] = 0x00;
1977 +
1978 ++ dev->ctl_urb_pending = 1;
1979 + error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL);
1980 +- if (error)
1981 ++ if (error) {
1982 ++ dev->ctl_urb_pending = 0;
1983 + dev_err(&dev->intf->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n",
1984 + __func__, error);
1985 +- else
1986 ++ } else {
1987 + dev->open = 1;
1988 ++ }
1989 +
1990 + mutex_unlock(&dev->pm_mutex);
1991 +
1992 +diff --git a/drivers/input/mouse/cyapa_gen6.c b/drivers/input/mouse/cyapa_gen6.c
1993 +index 016397850b1b0..9c1f10491ab1a 100644
1994 +--- a/drivers/input/mouse/cyapa_gen6.c
1995 ++++ b/drivers/input/mouse/cyapa_gen6.c
1996 +@@ -573,7 +573,7 @@ static int cyapa_pip_retrieve_data_structure(struct cyapa *cyapa,
1997 +
1998 + memset(&cmd, 0, sizeof(cmd));
1999 + put_unaligned_le16(PIP_OUTPUT_REPORT_ADDR, &cmd.head.addr);
2000 +- put_unaligned_le16(sizeof(cmd), &cmd.head.length - 2);
2001 ++ put_unaligned_le16(sizeof(cmd) - 2, &cmd.head.length);
2002 + cmd.head.report_id = PIP_APP_CMD_REPORT_ID;
2003 + cmd.head.cmd_code = PIP_RETRIEVE_DATA_STRUCTURE;
2004 + put_unaligned_le16(read_offset, &cmd.read_offset);
2005 +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
2006 +index adb8b23a63934..b256e3006a6fb 100644
2007 +--- a/drivers/input/serio/i8042-x86ia64io.h
2008 ++++ b/drivers/input/serio/i8042-x86ia64io.h
2009 +@@ -615,6 +615,48 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
2010 + DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
2011 + },
2012 + },
2013 ++ {
2014 ++ .matches = {
2015 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
2016 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A114-31"),
2017 ++ },
2018 ++ },
2019 ++ {
2020 ++ .matches = {
2021 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
2022 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A314-31"),
2023 ++ },
2024 ++ },
2025 ++ {
2026 ++ .matches = {
2027 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
2028 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A315-31"),
2029 ++ },
2030 ++ },
2031 ++ {
2032 ++ .matches = {
2033 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
2034 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-132"),
2035 ++ },
2036 ++ },
2037 ++ {
2038 ++ .matches = {
2039 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
2040 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-332"),
2041 ++ },
2042 ++ },
2043 ++ {
2044 ++ .matches = {
2045 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
2046 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-432"),
2047 ++ },
2048 ++ },
2049 ++ {
2050 ++ .matches = {
2051 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
2052 ++ DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate Spin B118-RN"),
2053 ++ },
2054 ++ },
2055 + {
2056 + /* Advent 4211 */
2057 + .matches = {
2058 +diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
2059 +index a2f45aefce08a..b536768234b7c 100644
2060 +--- a/drivers/input/touchscreen/ads7846.c
2061 ++++ b/drivers/input/touchscreen/ads7846.c
2062 +@@ -35,6 +35,7 @@
2063 + #include <linux/regulator/consumer.h>
2064 + #include <linux/module.h>
2065 + #include <asm/irq.h>
2066 ++#include <asm/unaligned.h>
2067 +
2068 + /*
2069 + * This code has been heavily tested on a Nokia 770, and lightly
2070 +@@ -199,6 +200,26 @@ struct ads7846 {
2071 + #define REF_ON (READ_12BIT_DFR(x, 1, 1))
2072 + #define REF_OFF (READ_12BIT_DFR(y, 0, 0))
2073 +
2074 ++static int get_pendown_state(struct ads7846 *ts)
2075 ++{
2076 ++ if (ts->get_pendown_state)
2077 ++ return ts->get_pendown_state();
2078 ++
2079 ++ return !gpio_get_value(ts->gpio_pendown);
2080 ++}
2081 ++
2082 ++static void ads7846_report_pen_up(struct ads7846 *ts)
2083 ++{
2084 ++ struct input_dev *input = ts->input;
2085 ++
2086 ++ input_report_key(input, BTN_TOUCH, 0);
2087 ++ input_report_abs(input, ABS_PRESSURE, 0);
2088 ++ input_sync(input);
2089 ++
2090 ++ ts->pendown = false;
2091 ++ dev_vdbg(&ts->spi->dev, "UP\n");
2092 ++}
2093 ++
2094 + /* Must be called with ts->lock held */
2095 + static void ads7846_stop(struct ads7846 *ts)
2096 + {
2097 +@@ -215,6 +236,10 @@ static void ads7846_stop(struct ads7846 *ts)
2098 + static void ads7846_restart(struct ads7846 *ts)
2099 + {
2100 + if (!ts->disabled && !ts->suspended) {
2101 ++ /* Check if pen was released since last stop */
2102 ++ if (ts->pendown && !get_pendown_state(ts))
2103 ++ ads7846_report_pen_up(ts);
2104 ++
2105 + /* Tell IRQ thread that it may poll the device. */
2106 + ts->stopped = false;
2107 + mb();
2108 +@@ -410,7 +435,7 @@ static int ads7845_read12_ser(struct device *dev, unsigned command)
2109 +
2110 + if (status == 0) {
2111 + /* BE12 value, then padding */
2112 +- status = be16_to_cpu(*((u16 *)&req->sample[1]));
2113 ++ status = get_unaligned_be16(&req->sample[1]);
2114 + status = status >> 3;
2115 + status &= 0x0fff;
2116 + }
2117 +@@ -605,14 +630,6 @@ static const struct attribute_group ads784x_attr_group = {
2118 +
2119 + /*--------------------------------------------------------------------------*/
2120 +
2121 +-static int get_pendown_state(struct ads7846 *ts)
2122 +-{
2123 +- if (ts->get_pendown_state)
2124 +- return ts->get_pendown_state();
2125 +-
2126 +- return !gpio_get_value(ts->gpio_pendown);
2127 +-}
2128 +-
2129 + static void null_wait_for_sync(void)
2130 + {
2131 + }
2132 +@@ -785,10 +802,11 @@ static void ads7846_report_state(struct ads7846 *ts)
2133 + /* compute touch pressure resistance using equation #2 */
2134 + Rt = z2;
2135 + Rt -= z1;
2136 +- Rt *= x;
2137 + Rt *= ts->x_plate_ohms;
2138 ++ Rt = DIV_ROUND_CLOSEST(Rt, 16);
2139 ++ Rt *= x;
2140 + Rt /= z1;
2141 +- Rt = (Rt + 2047) >> 12;
2142 ++ Rt = DIV_ROUND_CLOSEST(Rt, 256);
2143 + } else {
2144 + Rt = 0;
2145 + }
2146 +@@ -871,16 +889,8 @@ static irqreturn_t ads7846_irq(int irq, void *handle)
2147 + msecs_to_jiffies(TS_POLL_PERIOD));
2148 + }
2149 +
2150 +- if (ts->pendown && !ts->stopped) {
2151 +- struct input_dev *input = ts->input;
2152 +-
2153 +- input_report_key(input, BTN_TOUCH, 0);
2154 +- input_report_abs(input, ABS_PRESSURE, 0);
2155 +- input_sync(input);
2156 +-
2157 +- ts->pendown = false;
2158 +- dev_vdbg(&ts->spi->dev, "UP\n");
2159 +- }
2160 ++ if (ts->pendown && !ts->stopped)
2161 ++ ads7846_report_pen_up(ts);
2162 +
2163 + return IRQ_HANDLED;
2164 + }
2165 +diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
2166 +index 777dd5b159d39..87f5722a67829 100644
2167 +--- a/drivers/input/touchscreen/goodix.c
2168 ++++ b/drivers/input/touchscreen/goodix.c
2169 +@@ -101,6 +101,18 @@ static const struct dmi_system_id rotated_screen[] = {
2170 + DMI_MATCH(DMI_BIOS_DATE, "12/19/2014"),
2171 + },
2172 + },
2173 ++ {
2174 ++ .ident = "Teclast X98 Pro",
2175 ++ .matches = {
2176 ++ /*
2177 ++ * Only match BIOS date, because the manufacturers
2178 ++ * BIOS does not report the board name at all
2179 ++ * (sometimes)...
2180 ++ */
2181 ++ DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"),
2182 ++ DMI_MATCH(DMI_BIOS_DATE, "10/28/2015"),
2183 ++ },
2184 ++ },
2185 + {
2186 + .ident = "WinBook TW100",
2187 + .matches = {
2188 +diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-alpine-msi.c
2189 +index 63d980995d17d..ac431697ebe1c 100644
2190 +--- a/drivers/irqchip/irq-alpine-msi.c
2191 ++++ b/drivers/irqchip/irq-alpine-msi.c
2192 +@@ -165,8 +165,7 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain,
2193 + return 0;
2194 +
2195 + err_sgi:
2196 +- while (--i >= 0)
2197 +- irq_domain_free_irqs_parent(domain, virq, i);
2198 ++ irq_domain_free_irqs_parent(domain, virq, i - 1);
2199 + alpine_msix_free_sgi(priv, sgi, nr_irqs);
2200 + return err;
2201 + }
2202 +diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
2203 +index ca948155191ac..469453e106d14 100644
2204 +--- a/drivers/md/dm-ioctl.c
2205 ++++ b/drivers/md/dm-ioctl.c
2206 +@@ -1574,6 +1574,7 @@ static int target_message(struct file *filp, struct dm_ioctl *param, size_t para
2207 +
2208 + if (!argc) {
2209 + DMWARN("Empty message received.");
2210 ++ r = -EINVAL;
2211 + goto out_argv;
2212 + }
2213 +
2214 +diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
2215 +index 777343cff5f1e..78d4e7347e2f3 100644
2216 +--- a/drivers/md/dm-table.c
2217 ++++ b/drivers/md/dm-table.c
2218 +@@ -1295,12 +1295,6 @@ void dm_table_event_callback(struct dm_table *t,
2219 +
2220 + void dm_table_event(struct dm_table *t)
2221 + {
2222 +- /*
2223 +- * You can no longer call dm_table_event() from interrupt
2224 +- * context, use a bottom half instead.
2225 +- */
2226 +- BUG_ON(in_interrupt());
2227 +-
2228 + mutex_lock(&_event_lock);
2229 + if (t->event_fn)
2230 + t->event_fn(t->event_context);
2231 +diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
2232 +index 035d5ec8e677f..71a196acdac15 100644
2233 +--- a/drivers/md/md-cluster.c
2234 ++++ b/drivers/md/md-cluster.c
2235 +@@ -659,9 +659,27 @@ out:
2236 + * Takes the lock on the TOKEN lock resource so no other
2237 + * node can communicate while the operation is underway.
2238 + */
2239 +-static int lock_token(struct md_cluster_info *cinfo, bool mddev_locked)
2240 ++static int lock_token(struct md_cluster_info *cinfo)
2241 + {
2242 +- int error, set_bit = 0;
2243 ++ int error;
2244 ++
2245 ++ error = dlm_lock_sync(cinfo->token_lockres, DLM_LOCK_EX);
2246 ++ if (error) {
2247 ++ pr_err("md-cluster(%s:%d): failed to get EX on TOKEN (%d)\n",
2248 ++ __func__, __LINE__, error);
2249 ++ } else {
2250 ++ /* Lock the receive sequence */
2251 ++ mutex_lock(&cinfo->recv_mutex);
2252 ++ }
2253 ++ return error;
2254 ++}
2255 ++
2256 ++/* lock_comm()
2257 ++ * Sets the MD_CLUSTER_SEND_LOCK bit to lock the send channel.
2258 ++ */
2259 ++static int lock_comm(struct md_cluster_info *cinfo, bool mddev_locked)
2260 ++{
2261 ++ int rv, set_bit = 0;
2262 + struct mddev *mddev = cinfo->mddev;
2263 +
2264 + /*
2265 +@@ -672,34 +690,19 @@ static int lock_token(struct md_cluster_info *cinfo, bool mddev_locked)
2266 + */
2267 + if (mddev_locked && !test_bit(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD,
2268 + &cinfo->state)) {
2269 +- error = test_and_set_bit_lock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD,
2270 ++ rv = test_and_set_bit_lock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD,
2271 + &cinfo->state);
2272 +- WARN_ON_ONCE(error);
2273 ++ WARN_ON_ONCE(rv);
2274 + md_wakeup_thread(mddev->thread);
2275 + set_bit = 1;
2276 + }
2277 +- error = dlm_lock_sync(cinfo->token_lockres, DLM_LOCK_EX);
2278 +- if (set_bit)
2279 +- clear_bit_unlock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state);
2280 +
2281 +- if (error)
2282 +- pr_err("md-cluster(%s:%d): failed to get EX on TOKEN (%d)\n",
2283 +- __func__, __LINE__, error);
2284 +-
2285 +- /* Lock the receive sequence */
2286 +- mutex_lock(&cinfo->recv_mutex);
2287 +- return error;
2288 +-}
2289 +-
2290 +-/* lock_comm()
2291 +- * Sets the MD_CLUSTER_SEND_LOCK bit to lock the send channel.
2292 +- */
2293 +-static int lock_comm(struct md_cluster_info *cinfo, bool mddev_locked)
2294 +-{
2295 + wait_event(cinfo->wait,
2296 + !test_and_set_bit(MD_CLUSTER_SEND_LOCK, &cinfo->state));
2297 +-
2298 +- return lock_token(cinfo, mddev_locked);
2299 ++ rv = lock_token(cinfo);
2300 ++ if (set_bit)
2301 ++ clear_bit_unlock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state);
2302 ++ return rv;
2303 + }
2304 +
2305 + static void unlock_comm(struct md_cluster_info *cinfo)
2306 +@@ -779,9 +782,11 @@ static int sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg,
2307 + {
2308 + int ret;
2309 +
2310 +- lock_comm(cinfo, mddev_locked);
2311 +- ret = __sendmsg(cinfo, cmsg);
2312 +- unlock_comm(cinfo);
2313 ++ ret = lock_comm(cinfo, mddev_locked);
2314 ++ if (!ret) {
2315 ++ ret = __sendmsg(cinfo, cmsg);
2316 ++ unlock_comm(cinfo);
2317 ++ }
2318 + return ret;
2319 + }
2320 +
2321 +@@ -1053,7 +1058,7 @@ static int metadata_update_start(struct mddev *mddev)
2322 + return 0;
2323 + }
2324 +
2325 +- ret = lock_token(cinfo, 1);
2326 ++ ret = lock_token(cinfo);
2327 + clear_bit_unlock(MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD, &cinfo->state);
2328 + return ret;
2329 + }
2330 +@@ -1171,7 +1176,10 @@ static void update_size(struct mddev *mddev, sector_t old_dev_sectors)
2331 + int raid_slot = -1;
2332 +
2333 + md_update_sb(mddev, 1);
2334 +- lock_comm(cinfo, 1);
2335 ++ if (lock_comm(cinfo, 1)) {
2336 ++ pr_err("%s: lock_comm failed\n", __func__);
2337 ++ return;
2338 ++ }
2339 +
2340 + memset(&cmsg, 0, sizeof(cmsg));
2341 + cmsg.type = cpu_to_le32(METADATA_UPDATED);
2342 +@@ -1310,7 +1318,8 @@ static int add_new_disk(struct mddev *mddev, struct md_rdev *rdev)
2343 + cmsg.type = cpu_to_le32(NEWDISK);
2344 + memcpy(cmsg.uuid, uuid, 16);
2345 + cmsg.raid_slot = cpu_to_le32(rdev->desc_nr);
2346 +- lock_comm(cinfo, 1);
2347 ++ if (lock_comm(cinfo, 1))
2348 ++ return -EAGAIN;
2349 + ret = __sendmsg(cinfo, &cmsg);
2350 + if (ret) {
2351 + unlock_comm(cinfo);
2352 +diff --git a/drivers/md/md.c b/drivers/md/md.c
2353 +index 702a7d2c7e1ef..bda2dba8433a3 100644
2354 +--- a/drivers/md/md.c
2355 ++++ b/drivers/md/md.c
2356 +@@ -6537,8 +6537,10 @@ static int hot_remove_disk(struct mddev *mddev, dev_t dev)
2357 + goto busy;
2358 +
2359 + kick_rdev:
2360 +- if (mddev_is_clustered(mddev))
2361 +- md_cluster_ops->remove_disk(mddev, rdev);
2362 ++ if (mddev_is_clustered(mddev)) {
2363 ++ if (md_cluster_ops->remove_disk(mddev, rdev))
2364 ++ goto busy;
2365 ++ }
2366 +
2367 + md_kick_rdev_from_array(rdev);
2368 + set_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags);
2369 +@@ -7187,8 +7189,11 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
2370 + err = -EBUSY;
2371 + goto out;
2372 + }
2373 +- WARN_ON_ONCE(test_bit(MD_CLOSING, &mddev->flags));
2374 +- set_bit(MD_CLOSING, &mddev->flags);
2375 ++ if (test_and_set_bit(MD_CLOSING, &mddev->flags)) {
2376 ++ mutex_unlock(&mddev->open_mutex);
2377 ++ err = -EBUSY;
2378 ++ goto out;
2379 ++ }
2380 + did_set_md_closing = true;
2381 + mutex_unlock(&mddev->open_mutex);
2382 + sync_blockdev(bdev);
2383 +diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c
2384 +index affde1426b7a2..15e895c9f2e0b 100644
2385 +--- a/drivers/media/common/siano/smsdvb-main.c
2386 ++++ b/drivers/media/common/siano/smsdvb-main.c
2387 +@@ -1180,12 +1180,15 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
2388 + rc = dvb_create_media_graph(&client->adapter, true);
2389 + if (rc < 0) {
2390 + pr_err("dvb_create_media_graph failed %d\n", rc);
2391 +- goto client_error;
2392 ++ goto media_graph_error;
2393 + }
2394 +
2395 + pr_info("DVB interface registered.\n");
2396 + return 0;
2397 +
2398 ++media_graph_error:
2399 ++ smsdvb_debugfs_release(client);
2400 ++
2401 + client_error:
2402 + dvb_unregister_frontend(&client->frontend);
2403 +
2404 +diff --git a/drivers/media/i2c/max2175.c b/drivers/media/i2c/max2175.c
2405 +index bf0e821a2b933..5cd09501ca7df 100644
2406 +--- a/drivers/media/i2c/max2175.c
2407 ++++ b/drivers/media/i2c/max2175.c
2408 +@@ -511,7 +511,7 @@ static void max2175_set_bbfilter(struct max2175 *ctx)
2409 + }
2410 + }
2411 +
2412 +-static bool max2175_set_csm_mode(struct max2175 *ctx,
2413 ++static int max2175_set_csm_mode(struct max2175 *ctx,
2414 + enum max2175_csm_mode new_mode)
2415 + {
2416 + int ret = max2175_poll_csm_ready(ctx);
2417 +diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
2418 +index f33c0de3e8490..019bbc18cede6 100644
2419 +--- a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
2420 ++++ b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
2421 +@@ -184,7 +184,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
2422 + struct spi_master *master;
2423 + struct netup_spi *nspi;
2424 +
2425 +- master = spi_alloc_master(&ndev->pci_dev->dev,
2426 ++ master = devm_spi_alloc_master(&ndev->pci_dev->dev,
2427 + sizeof(struct netup_spi));
2428 + if (!master) {
2429 + dev_err(&ndev->pci_dev->dev,
2430 +@@ -217,6 +217,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
2431 + ndev->pci_slot,
2432 + ndev->pci_func);
2433 + if (!spi_new_device(master, &netup_spi_board)) {
2434 ++ spi_unregister_master(master);
2435 + ndev->spi = NULL;
2436 + dev_err(&ndev->pci_dev->dev,
2437 + "%s(): unable to create SPI device\n", __func__);
2438 +@@ -235,13 +236,13 @@ void netup_spi_release(struct netup_unidvb_dev *ndev)
2439 + if (!spi)
2440 + return;
2441 +
2442 ++ spi_unregister_master(spi->master);
2443 + spin_lock_irqsave(&spi->lock, flags);
2444 + reg = readw(&spi->regs->control_stat);
2445 + writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat);
2446 + reg = readw(&spi->regs->control_stat);
2447 + writew(reg & ~NETUP_SPI_CTRL_IMASK, &spi->regs->control_stat);
2448 + spin_unlock_irqrestore(&spi->lock, flags);
2449 +- spi_unregister_master(spi->master);
2450 + ndev->spi = NULL;
2451 + }
2452 +
2453 +diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c
2454 +index 930218cc2de19..2e7bd82282caa 100644
2455 +--- a/drivers/media/pci/saa7146/mxb.c
2456 ++++ b/drivers/media/pci/saa7146/mxb.c
2457 +@@ -652,16 +652,17 @@ static int vidioc_s_audio(struct file *file, void *fh, const struct v4l2_audio *
2458 + struct mxb *mxb = (struct mxb *)dev->ext_priv;
2459 +
2460 + DEB_D("VIDIOC_S_AUDIO %d\n", a->index);
2461 +- if (mxb_inputs[mxb->cur_input].audioset & (1 << a->index)) {
2462 +- if (mxb->cur_audinput != a->index) {
2463 +- mxb->cur_audinput = a->index;
2464 +- tea6420_route(mxb, a->index);
2465 +- if (mxb->cur_audinput == 0)
2466 +- mxb_update_audmode(mxb);
2467 +- }
2468 +- return 0;
2469 ++ if (a->index >= 32 ||
2470 ++ !(mxb_inputs[mxb->cur_input].audioset & (1 << a->index)))
2471 ++ return -EINVAL;
2472 ++
2473 ++ if (mxb->cur_audinput != a->index) {
2474 ++ mxb->cur_audinput = a->index;
2475 ++ tea6420_route(mxb, a->index);
2476 ++ if (mxb->cur_audinput == 0)
2477 ++ mxb_update_audmode(mxb);
2478 + }
2479 +- return -EINVAL;
2480 ++ return 0;
2481 + }
2482 +
2483 + #ifdef CONFIG_VIDEO_ADV_DEBUG
2484 +diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c
2485 +index 81be1b8df7584..0cbb3ee96e1e8 100644
2486 +--- a/drivers/media/pci/solo6x10/solo6x10-g723.c
2487 ++++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
2488 +@@ -401,7 +401,7 @@ int solo_g723_init(struct solo_dev *solo_dev)
2489 +
2490 + ret = snd_ctl_add(card, snd_ctl_new1(&kctl, solo_dev));
2491 + if (ret < 0)
2492 +- return ret;
2493 ++ goto snd_error;
2494 +
2495 + ret = solo_snd_pcm_init(solo_dev);
2496 + if (ret < 0)
2497 +diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
2498 +index 79ca03ac449c3..3f64119e8c082 100644
2499 +--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
2500 ++++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
2501 +@@ -103,6 +103,7 @@ int mtk_vcodec_init_dec_pm(struct mtk_vcodec_dev *mtkdev)
2502 + void mtk_vcodec_release_dec_pm(struct mtk_vcodec_dev *dev)
2503 + {
2504 + pm_runtime_disable(dev->pm.dev);
2505 ++ put_device(dev->pm.larbvdec);
2506 + }
2507 +
2508 + void mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm)
2509 +diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c
2510 +index 97f367b446c41..bc026a7116ece 100644
2511 +--- a/drivers/media/rc/sunxi-cir.c
2512 ++++ b/drivers/media/rc/sunxi-cir.c
2513 +@@ -132,6 +132,8 @@ static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id)
2514 + } else if (status & REG_RXINT_RPEI_EN) {
2515 + ir_raw_event_set_idle(ir->rc, true);
2516 + ir_raw_event_handle(ir->rc);
2517 ++ } else {
2518 ++ ir_raw_event_handle(ir->rc);
2519 + }
2520 +
2521 + spin_unlock(&ir->ir_lock);
2522 +diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
2523 +index 87582be4a39d2..66543518938b6 100644
2524 +--- a/drivers/media/usb/gspca/gspca.c
2525 ++++ b/drivers/media/usb/gspca/gspca.c
2526 +@@ -2140,6 +2140,7 @@ out:
2527 + input_unregister_device(gspca_dev->input_dev);
2528 + #endif
2529 + v4l2_ctrl_handler_free(gspca_dev->vdev.ctrl_handler);
2530 ++ v4l2_device_unregister(&gspca_dev->v4l2_dev);
2531 + kfree(gspca_dev->usb_buf);
2532 + kfree(gspca_dev);
2533 + return ret;
2534 +diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c
2535 +index a097d3dbc141f..9ca5e0c101b67 100644
2536 +--- a/drivers/media/usb/msi2500/msi2500.c
2537 ++++ b/drivers/media/usb/msi2500/msi2500.c
2538 +@@ -1250,7 +1250,7 @@ static int msi2500_probe(struct usb_interface *intf,
2539 + }
2540 +
2541 + dev->master = master;
2542 +- master->bus_num = 0;
2543 ++ master->bus_num = -1;
2544 + master->num_chipselect = 1;
2545 + master->transfer_one_message = msi2500_transfer_one_message;
2546 + spi_master_set_devdata(master, dev);
2547 +diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
2548 +index b1564cacd19e1..20ae8652adf44 100644
2549 +--- a/drivers/memstick/core/memstick.c
2550 ++++ b/drivers/memstick/core/memstick.c
2551 +@@ -469,7 +469,6 @@ static void memstick_check(struct work_struct *work)
2552 + host->card = card;
2553 + if (device_register(&card->dev)) {
2554 + put_device(&card->dev);
2555 +- kfree(host->card);
2556 + host->card = NULL;
2557 + }
2558 + } else
2559 +diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c
2560 +index d5cfb503b9d69..2539984c1db1c 100644
2561 +--- a/drivers/memstick/host/r592.c
2562 ++++ b/drivers/memstick/host/r592.c
2563 +@@ -762,8 +762,10 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2564 + goto error3;
2565 +
2566 + dev->mmio = pci_ioremap_bar(pdev, 0);
2567 +- if (!dev->mmio)
2568 ++ if (!dev->mmio) {
2569 ++ error = -ENOMEM;
2570 + goto error4;
2571 ++ }
2572 +
2573 + dev->irq = pdev->irq;
2574 + spin_lock_init(&dev->irq_lock);
2575 +@@ -790,12 +792,14 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2576 + &dev->dummy_dma_page_physical_address, GFP_KERNEL);
2577 + r592_stop_dma(dev , 0);
2578 +
2579 +- if (request_irq(dev->irq, &r592_irq, IRQF_SHARED,
2580 +- DRV_NAME, dev))
2581 ++ error = request_irq(dev->irq, &r592_irq, IRQF_SHARED,
2582 ++ DRV_NAME, dev);
2583 ++ if (error)
2584 + goto error6;
2585 +
2586 + r592_update_card_detect(dev);
2587 +- if (memstick_add_host(host))
2588 ++ error = memstick_add_host(host);
2589 ++ if (error)
2590 + goto error7;
2591 +
2592 + message("driver successfully loaded");
2593 +diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
2594 +index 04fd845de05fb..67b71c476c5b4 100644
2595 +--- a/drivers/mtd/cmdlinepart.c
2596 ++++ b/drivers/mtd/cmdlinepart.c
2597 +@@ -228,7 +228,7 @@ static int mtdpart_setup_real(char *s)
2598 + struct cmdline_mtd_partition *this_mtd;
2599 + struct mtd_partition *parts;
2600 + int mtd_id_len, num_parts;
2601 +- char *p, *mtd_id, *semicol;
2602 ++ char *p, *mtd_id, *semicol, *open_parenth;
2603 +
2604 + /*
2605 + * Replace the first ';' by a NULL char so strrchr can work
2606 +@@ -238,6 +238,14 @@ static int mtdpart_setup_real(char *s)
2607 + if (semicol)
2608 + *semicol = '\0';
2609 +
2610 ++ /*
2611 ++ * make sure that part-names with ":" will not be handled as
2612 ++ * part of the mtd-id with an ":"
2613 ++ */
2614 ++ open_parenth = strchr(s, '(');
2615 ++ if (open_parenth)
2616 ++ *open_parenth = '\0';
2617 ++
2618 + mtd_id = s;
2619 +
2620 + /*
2621 +@@ -247,6 +255,10 @@ static int mtdpart_setup_real(char *s)
2622 + */
2623 + p = strrchr(s, ':');
2624 +
2625 ++ /* Restore the '(' now. */
2626 ++ if (open_parenth)
2627 ++ *open_parenth = '(';
2628 ++
2629 + /* Restore the ';' now. */
2630 + if (semicol)
2631 + *semicol = ';';
2632 +diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
2633 +index 5f64deec9f6c1..26b3072daabd6 100644
2634 +--- a/drivers/net/can/softing/softing_main.c
2635 ++++ b/drivers/net/can/softing/softing_main.c
2636 +@@ -393,8 +393,13 @@ static int softing_netdev_open(struct net_device *ndev)
2637 +
2638 + /* check or determine and set bittime */
2639 + ret = open_candev(ndev);
2640 +- if (!ret)
2641 +- ret = softing_startstop(ndev, 1);
2642 ++ if (ret)
2643 ++ return ret;
2644 ++
2645 ++ ret = softing_startstop(ndev, 1);
2646 ++ if (ret < 0)
2647 ++ close_candev(ndev);
2648 ++
2649 + return ret;
2650 + }
2651 +
2652 +diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
2653 +index c458b81ba63af..d249a4309da2f 100644
2654 +--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
2655 ++++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
2656 +@@ -847,13 +847,13 @@ static int emac_probe(struct platform_device *pdev)
2657 + db->clk = devm_clk_get(&pdev->dev, NULL);
2658 + if (IS_ERR(db->clk)) {
2659 + ret = PTR_ERR(db->clk);
2660 +- goto out_iounmap;
2661 ++ goto out_dispose_mapping;
2662 + }
2663 +
2664 + ret = clk_prepare_enable(db->clk);
2665 + if (ret) {
2666 + dev_err(&pdev->dev, "Error couldn't enable clock (%d)\n", ret);
2667 +- goto out_iounmap;
2668 ++ goto out_dispose_mapping;
2669 + }
2670 +
2671 + ret = sunxi_sram_claim(&pdev->dev);
2672 +@@ -910,6 +910,8 @@ out_release_sram:
2673 + sunxi_sram_release(&pdev->dev);
2674 + out_clk_disable_unprepare:
2675 + clk_disable_unprepare(db->clk);
2676 ++out_dispose_mapping:
2677 ++ irq_dispose_mapping(ndev->irq);
2678 + out_iounmap:
2679 + iounmap(db->membase);
2680 + out:
2681 +@@ -928,6 +930,7 @@ static int emac_remove(struct platform_device *pdev)
2682 + unregister_netdev(ndev);
2683 + sunxi_sram_release(&pdev->dev);
2684 + clk_disable_unprepare(db->clk);
2685 ++ irq_dispose_mapping(ndev->irq);
2686 + iounmap(db->membase);
2687 + free_netdev(ndev);
2688 +
2689 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
2690 +index 8bfa2523e2533..5855ffec49528 100644
2691 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
2692 ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
2693 +@@ -3593,8 +3593,10 @@ static int bcmgenet_probe(struct platform_device *pdev)
2694 + clk_disable_unprepare(priv->clk);
2695 +
2696 + err = register_netdev(dev);
2697 +- if (err)
2698 ++ if (err) {
2699 ++ bcmgenet_mii_exit(dev);
2700 + goto err;
2701 ++ }
2702 +
2703 + return err;
2704 +
2705 +diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
2706 +index 1eccdbaa9a515..ec1c14e3eace6 100644
2707 +--- a/drivers/net/ethernet/korina.c
2708 ++++ b/drivers/net/ethernet/korina.c
2709 +@@ -216,7 +216,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
2710 + dev_kfree_skb_any(skb);
2711 + spin_unlock_irqrestore(&lp->lock, flags);
2712 +
2713 +- return NETDEV_TX_BUSY;
2714 ++ return NETDEV_TX_OK;
2715 + }
2716 + }
2717 +
2718 +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
2719 +index 0fb85d71c11b5..b8eb622743ce0 100644
2720 +--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
2721 ++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
2722 +@@ -1389,8 +1389,10 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
2723 + }
2724 +
2725 + priv->port_stats.tx_timeout++;
2726 +- en_dbg(DRV, priv, "Scheduling watchdog\n");
2727 +- queue_work(mdev->workqueue, &priv->watchdog_task);
2728 ++ if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state)) {
2729 ++ en_dbg(DRV, priv, "Scheduling port restart\n");
2730 ++ queue_work(mdev->workqueue, &priv->restart_task);
2731 ++ }
2732 + }
2733 +
2734 +
2735 +@@ -1744,6 +1746,7 @@ int mlx4_en_start_port(struct net_device *dev)
2736 + mlx4_en_deactivate_cq(priv, cq);
2737 + goto tx_err;
2738 + }
2739 ++ clear_bit(MLX4_EN_TX_RING_STATE_RECOVERING, &tx_ring->state);
2740 + if (t != TX_XDP) {
2741 + tx_ring->tx_queue = netdev_get_tx_queue(dev, i);
2742 + tx_ring->recycle_ring = NULL;
2743 +@@ -1839,6 +1842,7 @@ int mlx4_en_start_port(struct net_device *dev)
2744 + local_bh_enable();
2745 + }
2746 +
2747 ++ clear_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state);
2748 + netif_tx_start_all_queues(dev);
2749 + netif_device_attach(dev);
2750 +
2751 +@@ -2009,7 +2013,7 @@ void mlx4_en_stop_port(struct net_device *dev, int detach)
2752 + static void mlx4_en_restart(struct work_struct *work)
2753 + {
2754 + struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
2755 +- watchdog_task);
2756 ++ restart_task);
2757 + struct mlx4_en_dev *mdev = priv->mdev;
2758 + struct net_device *dev = priv->dev;
2759 +
2760 +@@ -2388,7 +2392,7 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
2761 + if (netif_running(dev)) {
2762 + mutex_lock(&mdev->state_lock);
2763 + if (!mdev->device_up) {
2764 +- /* NIC is probably restarting - let watchdog task reset
2765 ++ /* NIC is probably restarting - let restart task reset
2766 + * the port */
2767 + en_dbg(DRV, priv, "Change MTU called with card down!?\n");
2768 + } else {
2769 +@@ -2397,7 +2401,9 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
2770 + if (err) {
2771 + en_err(priv, "Failed restarting port:%d\n",
2772 + priv->port);
2773 +- queue_work(mdev->workqueue, &priv->watchdog_task);
2774 ++ if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING,
2775 ++ &priv->state))
2776 ++ queue_work(mdev->workqueue, &priv->restart_task);
2777 + }
2778 + }
2779 + mutex_unlock(&mdev->state_lock);
2780 +@@ -2883,7 +2889,8 @@ static int mlx4_xdp_set(struct net_device *dev, struct bpf_prog *prog)
2781 + if (err) {
2782 + en_err(priv, "Failed starting port %d for XDP change\n",
2783 + priv->port);
2784 +- queue_work(mdev->workqueue, &priv->watchdog_task);
2785 ++ if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state))
2786 ++ queue_work(mdev->workqueue, &priv->restart_task);
2787 + }
2788 + }
2789 +
2790 +@@ -3284,7 +3291,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
2791 + priv->counter_index = MLX4_SINK_COUNTER_INDEX(mdev->dev);
2792 + spin_lock_init(&priv->stats_lock);
2793 + INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode);
2794 +- INIT_WORK(&priv->watchdog_task, mlx4_en_restart);
2795 ++ INIT_WORK(&priv->restart_task, mlx4_en_restart);
2796 + INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate);
2797 + INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats);
2798 + INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task);
2799 +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
2800 +index 777e22d42c0f0..9a561d6947842 100644
2801 +--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
2802 ++++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
2803 +@@ -385,6 +385,35 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring)
2804 + return cnt;
2805 + }
2806 +
2807 ++static void mlx4_en_handle_err_cqe(struct mlx4_en_priv *priv, struct mlx4_err_cqe *err_cqe,
2808 ++ u16 cqe_index, struct mlx4_en_tx_ring *ring)
2809 ++{
2810 ++ struct mlx4_en_dev *mdev = priv->mdev;
2811 ++ struct mlx4_en_tx_info *tx_info;
2812 ++ struct mlx4_en_tx_desc *tx_desc;
2813 ++ u16 wqe_index;
2814 ++ int desc_size;
2815 ++
2816 ++ en_err(priv, "CQE error - cqn 0x%x, ci 0x%x, vendor syndrome: 0x%x syndrome: 0x%x\n",
2817 ++ ring->sp_cqn, cqe_index, err_cqe->vendor_err_syndrome, err_cqe->syndrome);
2818 ++ print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, err_cqe, sizeof(*err_cqe),
2819 ++ false);
2820 ++
2821 ++ wqe_index = be16_to_cpu(err_cqe->wqe_index) & ring->size_mask;
2822 ++ tx_info = &ring->tx_info[wqe_index];
2823 ++ desc_size = tx_info->nr_txbb << LOG_TXBB_SIZE;
2824 ++ en_err(priv, "Related WQE - qpn 0x%x, wqe index 0x%x, wqe size 0x%x\n", ring->qpn,
2825 ++ wqe_index, desc_size);
2826 ++ tx_desc = ring->buf + (wqe_index << LOG_TXBB_SIZE);
2827 ++ print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, tx_desc, desc_size, false);
2828 ++
2829 ++ if (test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state))
2830 ++ return;
2831 ++
2832 ++ en_err(priv, "Scheduling port restart\n");
2833 ++ queue_work(mdev->workqueue, &priv->restart_task);
2834 ++}
2835 ++
2836 + bool mlx4_en_process_tx_cq(struct net_device *dev,
2837 + struct mlx4_en_cq *cq, int napi_budget)
2838 + {
2839 +@@ -431,13 +460,10 @@ bool mlx4_en_process_tx_cq(struct net_device *dev,
2840 + dma_rmb();
2841 +
2842 + if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) ==
2843 +- MLX4_CQE_OPCODE_ERROR)) {
2844 +- struct mlx4_err_cqe *cqe_err = (struct mlx4_err_cqe *)cqe;
2845 +-
2846 +- en_err(priv, "CQE error - vendor syndrome: 0x%x syndrome: 0x%x\n",
2847 +- cqe_err->vendor_err_syndrome,
2848 +- cqe_err->syndrome);
2849 +- }
2850 ++ MLX4_CQE_OPCODE_ERROR))
2851 ++ if (!test_and_set_bit(MLX4_EN_TX_RING_STATE_RECOVERING, &ring->state))
2852 ++ mlx4_en_handle_err_cqe(priv, (struct mlx4_err_cqe *)cqe, index,
2853 ++ ring);
2854 +
2855 + /* Skip over last polled CQE */
2856 + new_index = be16_to_cpu(cqe->wqe_index) & size_mask;
2857 +diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
2858 +index bdd87438a354f..da0cab487da49 100644
2859 +--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
2860 ++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
2861 +@@ -267,6 +267,10 @@ struct mlx4_en_page_cache {
2862 + } buf[MLX4_EN_CACHE_SIZE];
2863 + };
2864 +
2865 ++enum {
2866 ++ MLX4_EN_TX_RING_STATE_RECOVERING,
2867 ++};
2868 ++
2869 + struct mlx4_en_priv;
2870 +
2871 + struct mlx4_en_tx_ring {
2872 +@@ -313,6 +317,7 @@ struct mlx4_en_tx_ring {
2873 + * Only queue_stopped might be used if BQL is not properly working.
2874 + */
2875 + unsigned long queue_stopped;
2876 ++ unsigned long state;
2877 + struct mlx4_hwq_resources sp_wqres;
2878 + struct mlx4_qp sp_qp;
2879 + struct mlx4_qp_context sp_context;
2880 +@@ -525,6 +530,10 @@ struct mlx4_en_stats_bitmap {
2881 + struct mutex mutex; /* for mutual access to stats bitmap */
2882 + };
2883 +
2884 ++enum {
2885 ++ MLX4_EN_STATE_FLAG_RESTARTING,
2886 ++};
2887 ++
2888 + struct mlx4_en_priv {
2889 + struct mlx4_en_dev *mdev;
2890 + struct mlx4_en_port_profile *prof;
2891 +@@ -590,7 +599,7 @@ struct mlx4_en_priv {
2892 + struct mlx4_en_cq *rx_cq[MAX_RX_RINGS];
2893 + struct mlx4_qp drop_qp;
2894 + struct work_struct rx_mode_task;
2895 +- struct work_struct watchdog_task;
2896 ++ struct work_struct restart_task;
2897 + struct work_struct linkstate_task;
2898 + struct delayed_work stats_task;
2899 + struct delayed_work service_task;
2900 +@@ -637,6 +646,7 @@ struct mlx4_en_priv {
2901 + u32 pflags;
2902 + u8 rss_key[MLX4_EN_RSS_KEY_SIZE];
2903 + u8 rss_hash_fn;
2904 ++ unsigned long state;
2905 + };
2906 +
2907 + enum mlx4_en_wol {
2908 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
2909 +index 1ac0e173da12c..049d9d19c66d9 100644
2910 +--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
2911 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
2912 +@@ -51,6 +51,7 @@
2913 + #ifdef CONFIG_RFS_ACCEL
2914 + #include <linux/cpu_rmap.h>
2915 + #endif
2916 ++#include <linux/version.h>
2917 + #include <net/devlink.h>
2918 + #include "mlx5_core.h"
2919 + #include "fs_core.h"
2920 +@@ -204,7 +205,10 @@ static void mlx5_set_driver_version(struct mlx5_core_dev *dev)
2921 + strncat(string, ",", remaining_size);
2922 +
2923 + remaining_size = max_t(int, 0, driver_ver_sz - strlen(string));
2924 +- strncat(string, DRIVER_VERSION, remaining_size);
2925 ++
2926 ++ snprintf(string + strlen(string), remaining_size, "%u.%u.%u",
2927 ++ (u8)((LINUX_VERSION_CODE >> 16) & 0xff), (u8)((LINUX_VERSION_CODE >> 8) & 0xff),
2928 ++ (u16)(LINUX_VERSION_CODE & 0xffff));
2929 +
2930 + /*Send the command*/
2931 + MLX5_SET(set_driver_version_in, in, opcode,
2932 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
2933 +index 1b5f7d57b6f8f..6684a4cb8b88b 100644
2934 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
2935 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
2936 +@@ -2511,6 +2511,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2937 + qlcnic_sriov_vf_register_map(ahw);
2938 + break;
2939 + default:
2940 ++ err = -EINVAL;
2941 + goto err_out_free_hw_res;
2942 + }
2943 +
2944 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
2945 +index d71d3c1c85eed..7521ef5383f16 100644
2946 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
2947 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
2948 +@@ -30,7 +30,6 @@
2949 + #define PRG_ETH0_RGMII_MODE BIT(0)
2950 +
2951 + /* mux to choose between fclk_div2 (bit unset) and mpll2 (bit set) */
2952 +-#define PRG_ETH0_CLK_M250_SEL_SHIFT 4
2953 + #define PRG_ETH0_CLK_M250_SEL_MASK GENMASK(4, 4)
2954 +
2955 + #define PRG_ETH0_TXDLY_SHIFT 5
2956 +@@ -121,8 +120,9 @@ static int meson8b_init_clk(struct meson8b_dwmac *dwmac)
2957 + init.num_parents = MUX_CLK_NUM_PARENTS;
2958 +
2959 + dwmac->m250_mux.reg = dwmac->regs + PRG_ETH0;
2960 +- dwmac->m250_mux.shift = PRG_ETH0_CLK_M250_SEL_SHIFT;
2961 +- dwmac->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK;
2962 ++ dwmac->m250_mux.shift = __ffs(PRG_ETH0_CLK_M250_SEL_MASK);
2963 ++ dwmac->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK >>
2964 ++ dwmac->m250_mux.shift;
2965 + dwmac->m250_mux.flags = 0;
2966 + dwmac->m250_mux.table = NULL;
2967 + dwmac->m250_mux.hw.init = &init;
2968 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
2969 +index b4c8e673fe256..d5ebaf62d12fe 100644
2970 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
2971 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
2972 +@@ -1428,6 +1428,19 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv, u32 queue)
2973 + stmmac_free_tx_buffer(priv, queue, i);
2974 + }
2975 +
2976 ++/**
2977 ++ * stmmac_free_tx_skbufs - free TX skb buffers
2978 ++ * @priv: private structure
2979 ++ */
2980 ++static void stmmac_free_tx_skbufs(struct stmmac_priv *priv)
2981 ++{
2982 ++ u32 tx_queue_cnt = priv->plat->tx_queues_to_use;
2983 ++ u32 queue;
2984 ++
2985 ++ for (queue = 0; queue < tx_queue_cnt; queue++)
2986 ++ dma_free_tx_skbufs(priv, queue);
2987 ++}
2988 ++
2989 + /**
2990 + * free_dma_rx_desc_resources - free RX dma desc resources
2991 + * @priv: private structure
2992 +@@ -2692,9 +2705,6 @@ static int stmmac_release(struct net_device *dev)
2993 + {
2994 + struct stmmac_priv *priv = netdev_priv(dev);
2995 +
2996 +- if (priv->eee_enabled)
2997 +- del_timer_sync(&priv->eee_ctrl_timer);
2998 +-
2999 + /* Stop and disconnect the PHY */
3000 + if (dev->phydev) {
3001 + phy_stop(dev->phydev);
3002 +@@ -2714,6 +2724,11 @@ static int stmmac_release(struct net_device *dev)
3003 + if (priv->lpi_irq > 0)
3004 + free_irq(priv->lpi_irq, dev);
3005 +
3006 ++ if (priv->eee_enabled) {
3007 ++ priv->tx_path_in_lpi_mode = false;
3008 ++ del_timer_sync(&priv->eee_ctrl_timer);
3009 ++ }
3010 ++
3011 + /* Stop TX/RX DMA and clear the descriptors */
3012 + stmmac_stop_all_dma(priv);
3013 +
3014 +@@ -4405,6 +4420,11 @@ int stmmac_suspend(struct device *dev)
3015 +
3016 + stmmac_disable_all_queues(priv);
3017 +
3018 ++ if (priv->eee_enabled) {
3019 ++ priv->tx_path_in_lpi_mode = false;
3020 ++ del_timer_sync(&priv->eee_ctrl_timer);
3021 ++ }
3022 ++
3023 + /* Stop TX/RX DMA */
3024 + stmmac_stop_all_dma(priv);
3025 +
3026 +@@ -4503,6 +4523,7 @@ int stmmac_resume(struct device *dev)
3027 + */
3028 + priv->mss = 0;
3029 +
3030 ++ stmmac_free_tx_skbufs(priv);
3031 + stmmac_clear_descriptors(priv);
3032 +
3033 + stmmac_hw_setup(ndev, false);
3034 +diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
3035 +index 82efa5bbf568b..94a9add2fc878 100644
3036 +--- a/drivers/net/vxlan.c
3037 ++++ b/drivers/net/vxlan.c
3038 +@@ -3184,6 +3184,9 @@ static void vxlan_config_apply(struct net_device *dev,
3039 + dev->gso_max_segs = lowerdev->gso_max_segs;
3040 +
3041 + needed_headroom = lowerdev->hard_header_len;
3042 ++ needed_headroom += lowerdev->needed_headroom;
3043 ++
3044 ++ dev->needed_tailroom = lowerdev->needed_tailroom;
3045 +
3046 + max_mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM :
3047 + VXLAN_HEADROOM);
3048 +diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c
3049 +index c64a03f164c0f..16d5fe6d1e2e4 100644
3050 +--- a/drivers/net/wireless/ath/ath10k/usb.c
3051 ++++ b/drivers/net/wireless/ath/ath10k/usb.c
3052 +@@ -1019,6 +1019,8 @@ static int ath10k_usb_probe(struct usb_interface *interface,
3053 +
3054 + ar_usb = ath10k_usb_priv(ar);
3055 + ret = ath10k_usb_create(ar, interface);
3056 ++ if (ret)
3057 ++ goto err;
3058 + ar_usb->ar = ar;
3059 +
3060 + ar->dev_id = product_id;
3061 +@@ -1030,7 +1032,7 @@ static int ath10k_usb_probe(struct usb_interface *interface,
3062 + ret = ath10k_core_register(ar, chip_id);
3063 + if (ret) {
3064 + ath10k_warn(ar, "failed to register driver core: %d\n", ret);
3065 +- goto err;
3066 ++ goto err_usb_destroy;
3067 + }
3068 +
3069 + /* TODO: remove this once USB support is fully implemented */
3070 +@@ -1038,6 +1040,9 @@ static int ath10k_usb_probe(struct usb_interface *interface,
3071 +
3072 + return 0;
3073 +
3074 ++err_usb_destroy:
3075 ++ ath10k_usb_destroy(ar);
3076 ++
3077 + err:
3078 + ath10k_core_destroy(ar);
3079 +
3080 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
3081 +index ec2ecdd1cc4ec..9aab9a0269548 100644
3082 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
3083 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
3084 +@@ -2654,7 +2654,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
3085 +
3086 + /* this would be a mac80211 bug ... but don't crash */
3087 + if (WARN_ON_ONCE(!mvmvif->phy_ctxt))
3088 +- return -EINVAL;
3089 ++ return test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status) ? 0 : -EINVAL;
3090 +
3091 + /*
3092 + * If we are in a STA removal flow and in DQA mode:
3093 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
3094 +index 8a074a516fb26..910edd034fe3a 100644
3095 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
3096 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
3097 +@@ -1927,18 +1927,36 @@ static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr,
3098 + void *buf, int dwords)
3099 + {
3100 + unsigned long flags;
3101 +- int offs, ret = 0;
3102 ++ int offs = 0;
3103 + u32 *vals = buf;
3104 +
3105 +- if (iwl_trans_grab_nic_access(trans, &flags)) {
3106 +- iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr);
3107 +- for (offs = 0; offs < dwords; offs++)
3108 +- vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT);
3109 +- iwl_trans_release_nic_access(trans, &flags);
3110 +- } else {
3111 +- ret = -EBUSY;
3112 ++ while (offs < dwords) {
3113 ++ /* limit the time we spin here under lock to 1/2s */
3114 ++ ktime_t timeout = ktime_add_us(ktime_get(), 500 * USEC_PER_MSEC);
3115 ++
3116 ++ if (iwl_trans_grab_nic_access(trans, &flags)) {
3117 ++ iwl_write32(trans, HBUS_TARG_MEM_RADDR,
3118 ++ addr + 4 * offs);
3119 ++
3120 ++ while (offs < dwords) {
3121 ++ vals[offs] = iwl_read32(trans,
3122 ++ HBUS_TARG_MEM_RDAT);
3123 ++ offs++;
3124 ++
3125 ++ /* calling ktime_get is expensive so
3126 ++ * do it once in 128 reads
3127 ++ */
3128 ++ if (offs % 128 == 0 && ktime_after(ktime_get(),
3129 ++ timeout))
3130 ++ break;
3131 ++ }
3132 ++ iwl_trans_release_nic_access(trans, &flags);
3133 ++ } else {
3134 ++ return -EBUSY;
3135 ++ }
3136 + }
3137 +- return ret;
3138 ++
3139 ++ return 0;
3140 + }
3141 +
3142 + static int iwl_trans_pcie_write_mem(struct iwl_trans *trans, u32 addr,
3143 +diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
3144 +index 5a64674a5c8da..74a313e6d98f2 100644
3145 +--- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
3146 ++++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
3147 +@@ -1237,13 +1237,6 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
3148 + if (skb->len < ETH_HLEN)
3149 + goto drop;
3150 +
3151 +- ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0);
3152 +- if (!ctx)
3153 +- goto busy;
3154 +-
3155 +- memset(ctx->buf, 0, BULK_BUF_SIZE);
3156 +- buf = ctx->buf->data;
3157 +-
3158 + tx_control = 0;
3159 +
3160 + err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control,
3161 +@@ -1251,6 +1244,13 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
3162 + if (err)
3163 + goto drop;
3164 +
3165 ++ ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0);
3166 ++ if (!ctx)
3167 ++ goto drop;
3168 ++
3169 ++ memset(ctx->buf, 0, BULK_BUF_SIZE);
3170 ++ buf = ctx->buf->data;
3171 ++
3172 + {
3173 + __le16 *tx_cntl = (__le16 *)buf;
3174 + *tx_cntl = cpu_to_le16(tx_control);
3175 +diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
3176 +index ee40b739b2897..cd668e5427d07 100644
3177 +--- a/drivers/net/wireless/marvell/mwifiex/main.c
3178 ++++ b/drivers/net/wireless/marvell/mwifiex/main.c
3179 +@@ -1447,6 +1447,8 @@ int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter)
3180 + priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
3181 + mwifiex_deauthenticate(priv, NULL);
3182 +
3183 ++ mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
3184 ++
3185 + mwifiex_uninit_sw(adapter);
3186 +
3187 + if (adapter->if_ops.down_dev)
3188 +diff --git a/drivers/net/wireless/st/cw1200/main.c b/drivers/net/wireless/st/cw1200/main.c
3189 +index 84624c812a15f..f4338bce78f4a 100644
3190 +--- a/drivers/net/wireless/st/cw1200/main.c
3191 ++++ b/drivers/net/wireless/st/cw1200/main.c
3192 +@@ -385,6 +385,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,
3193 + CW1200_LINK_ID_MAX,
3194 + cw1200_skb_dtor,
3195 + priv)) {
3196 ++ destroy_workqueue(priv->workqueue);
3197 + ieee80211_free_hw(hw);
3198 + return NULL;
3199 + }
3200 +@@ -396,6 +397,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,
3201 + for (; i > 0; i--)
3202 + cw1200_queue_deinit(&priv->tx_queue[i - 1]);
3203 + cw1200_queue_stats_deinit(&priv->tx_queue_stats);
3204 ++ destroy_workqueue(priv->workqueue);
3205 + ieee80211_free_hw(hw);
3206 + return NULL;
3207 + }
3208 +diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
3209 +index a56d3eab35dd6..910322b442bd6 100644
3210 +--- a/drivers/net/xen-netback/xenbus.c
3211 ++++ b/drivers/net/xen-netback/xenbus.c
3212 +@@ -777,12 +777,14 @@ static int xen_register_credit_watch(struct xenbus_device *dev,
3213 + return -ENOMEM;
3214 + snprintf(node, maxlen, "%s/rate", dev->nodename);
3215 + vif->credit_watch.node = node;
3216 ++ vif->credit_watch.will_handle = NULL;
3217 + vif->credit_watch.callback = xen_net_rate_changed;
3218 + err = register_xenbus_watch(&vif->credit_watch);
3219 + if (err) {
3220 + pr_err("Failed to set watcher %s\n", vif->credit_watch.node);
3221 + kfree(node);
3222 + vif->credit_watch.node = NULL;
3223 ++ vif->credit_watch.will_handle = NULL;
3224 + vif->credit_watch.callback = NULL;
3225 + }
3226 + return err;
3227 +@@ -829,6 +831,7 @@ static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev,
3228 + snprintf(node, maxlen, "%s/request-multicast-control",
3229 + dev->otherend);
3230 + vif->mcast_ctrl_watch.node = node;
3231 ++ vif->mcast_ctrl_watch.will_handle = NULL;
3232 + vif->mcast_ctrl_watch.callback = xen_mcast_ctrl_changed;
3233 + err = register_xenbus_watch(&vif->mcast_ctrl_watch);
3234 + if (err) {
3235 +@@ -836,6 +839,7 @@ static int xen_register_mcast_ctrl_watch(struct xenbus_device *dev,
3236 + vif->mcast_ctrl_watch.node);
3237 + kfree(node);
3238 + vif->mcast_ctrl_watch.node = NULL;
3239 ++ vif->mcast_ctrl_watch.will_handle = NULL;
3240 + vif->mcast_ctrl_watch.callback = NULL;
3241 + }
3242 + return err;
3243 +@@ -1039,7 +1043,7 @@ static void connect(struct backend_info *be)
3244 + xenvif_carrier_on(be->vif);
3245 +
3246 + unregister_hotplug_status_watch(be);
3247 +- err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch,
3248 ++ err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL,
3249 + hotplug_status_changed,
3250 + "%s/%s", dev->nodename, "hotplug-status");
3251 + if (!err)
3252 +diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c
3253 +index 38548bd970cd2..43c801e725b6f 100644
3254 +--- a/drivers/nfc/s3fwrn5/firmware.c
3255 ++++ b/drivers/nfc/s3fwrn5/firmware.c
3256 +@@ -304,8 +304,10 @@ static int s3fwrn5_fw_request_firmware(struct s3fwrn5_fw_info *fw_info)
3257 + if (ret < 0)
3258 + return ret;
3259 +
3260 +- if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE)
3261 ++ if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE) {
3262 ++ release_firmware(fw->fw);
3263 + return -EINVAL;
3264 ++ }
3265 +
3266 + memcpy(fw->date, fw->fw->data + 0x00, 12);
3267 + fw->date[12] = '\0';
3268 +diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
3269 +index 1fb3a24911314..84eb510456fdd 100644
3270 +--- a/drivers/nvdimm/label.c
3271 ++++ b/drivers/nvdimm/label.c
3272 +@@ -852,6 +852,15 @@ static int __blk_label_update(struct nd_region *nd_region,
3273 + }
3274 + }
3275 +
3276 ++ /* release slots associated with any invalidated UUIDs */
3277 ++ mutex_lock(&nd_mapping->lock);
3278 ++ list_for_each_entry_safe(label_ent, e, &nd_mapping->labels, list)
3279 ++ if (test_and_clear_bit(ND_LABEL_REAP, &label_ent->flags)) {
3280 ++ reap_victim(nd_mapping, label_ent);
3281 ++ list_move(&label_ent->list, &list);
3282 ++ }
3283 ++ mutex_unlock(&nd_mapping->lock);
3284 ++
3285 + /*
3286 + * Find the resource associated with the first label in the set
3287 + * per the v1.2 namespace specification.
3288 +diff --git a/drivers/pci/dwc/pcie-qcom.c b/drivers/pci/dwc/pcie-qcom.c
3289 +index ce7ba5b7552ac..b84603f52dc18 100644
3290 +--- a/drivers/pci/dwc/pcie-qcom.c
3291 ++++ b/drivers/pci/dwc/pcie-qcom.c
3292 +@@ -96,6 +96,7 @@ struct qcom_pcie_resources_2_1_0 {
3293 + struct reset_control *ahb_reset;
3294 + struct reset_control *por_reset;
3295 + struct reset_control *phy_reset;
3296 ++ struct reset_control *ext_reset;
3297 + struct regulator *vdda;
3298 + struct regulator *vdda_phy;
3299 + struct regulator *vdda_refclk;
3300 +@@ -265,6 +266,10 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie)
3301 + if (IS_ERR(res->por_reset))
3302 + return PTR_ERR(res->por_reset);
3303 +
3304 ++ res->ext_reset = devm_reset_control_get_optional_exclusive(dev, "ext");
3305 ++ if (IS_ERR(res->ext_reset))
3306 ++ return PTR_ERR(res->ext_reset);
3307 ++
3308 + res->phy_reset = devm_reset_control_get_exclusive(dev, "phy");
3309 + return PTR_ERR_OR_ZERO(res->phy_reset);
3310 + }
3311 +@@ -277,6 +282,7 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie)
3312 + reset_control_assert(res->axi_reset);
3313 + reset_control_assert(res->ahb_reset);
3314 + reset_control_assert(res->por_reset);
3315 ++ reset_control_assert(res->ext_reset);
3316 + reset_control_assert(res->pci_reset);
3317 + clk_disable_unprepare(res->iface_clk);
3318 + clk_disable_unprepare(res->core_clk);
3319 +@@ -342,6 +348,12 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
3320 + goto err_deassert_ahb;
3321 + }
3322 +
3323 ++ ret = reset_control_deassert(res->ext_reset);
3324 ++ if (ret) {
3325 ++ dev_err(dev, "cannot deassert ext reset\n");
3326 ++ goto err_deassert_ahb;
3327 ++ }
3328 ++
3329 + /* enable PCIe clocks and resets */
3330 + val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL);
3331 + val &= ~BIT(0);
3332 +diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
3333 +index 8f8dac0155d63..2565abbe1a910 100644
3334 +--- a/drivers/pci/host/pcie-iproc.c
3335 ++++ b/drivers/pci/host/pcie-iproc.c
3336 +@@ -306,7 +306,7 @@ enum iproc_pcie_reg {
3337 + };
3338 +
3339 + /* iProc PCIe PAXB BCMA registers */
3340 +-static const u16 iproc_pcie_reg_paxb_bcma[] = {
3341 ++static const u16 iproc_pcie_reg_paxb_bcma[IPROC_PCIE_MAX_NUM_REG] = {
3342 + [IPROC_PCIE_CLK_CTRL] = 0x000,
3343 + [IPROC_PCIE_CFG_IND_ADDR] = 0x120,
3344 + [IPROC_PCIE_CFG_IND_DATA] = 0x124,
3345 +@@ -317,7 +317,7 @@ static const u16 iproc_pcie_reg_paxb_bcma[] = {
3346 + };
3347 +
3348 + /* iProc PCIe PAXB registers */
3349 +-static const u16 iproc_pcie_reg_paxb[] = {
3350 ++static const u16 iproc_pcie_reg_paxb[IPROC_PCIE_MAX_NUM_REG] = {
3351 + [IPROC_PCIE_CLK_CTRL] = 0x000,
3352 + [IPROC_PCIE_CFG_IND_ADDR] = 0x120,
3353 + [IPROC_PCIE_CFG_IND_DATA] = 0x124,
3354 +@@ -333,7 +333,7 @@ static const u16 iproc_pcie_reg_paxb[] = {
3355 + };
3356 +
3357 + /* iProc PCIe PAXB v2 registers */
3358 +-static const u16 iproc_pcie_reg_paxb_v2[] = {
3359 ++static const u16 iproc_pcie_reg_paxb_v2[IPROC_PCIE_MAX_NUM_REG] = {
3360 + [IPROC_PCIE_CLK_CTRL] = 0x000,
3361 + [IPROC_PCIE_CFG_IND_ADDR] = 0x120,
3362 + [IPROC_PCIE_CFG_IND_DATA] = 0x124,
3363 +@@ -361,7 +361,7 @@ static const u16 iproc_pcie_reg_paxb_v2[] = {
3364 + };
3365 +
3366 + /* iProc PCIe PAXC v1 registers */
3367 +-static const u16 iproc_pcie_reg_paxc[] = {
3368 ++static const u16 iproc_pcie_reg_paxc[IPROC_PCIE_MAX_NUM_REG] = {
3369 + [IPROC_PCIE_CLK_CTRL] = 0x000,
3370 + [IPROC_PCIE_CFG_IND_ADDR] = 0x1f0,
3371 + [IPROC_PCIE_CFG_IND_DATA] = 0x1f4,
3372 +@@ -370,7 +370,7 @@ static const u16 iproc_pcie_reg_paxc[] = {
3373 + };
3374 +
3375 + /* iProc PCIe PAXC v2 registers */
3376 +-static const u16 iproc_pcie_reg_paxc_v2[] = {
3377 ++static const u16 iproc_pcie_reg_paxc_v2[IPROC_PCIE_MAX_NUM_REG] = {
3378 + [IPROC_PCIE_MSI_GIC_MODE] = 0x050,
3379 + [IPROC_PCIE_MSI_BASE_ADDR] = 0x074,
3380 + [IPROC_PCIE_MSI_WINDOW_SIZE] = 0x078,
3381 +diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
3382 +index a3cedf8de8630..fa44e1506357e 100644
3383 +--- a/drivers/pci/pci-acpi.c
3384 ++++ b/drivers/pci/pci-acpi.c
3385 +@@ -573,7 +573,7 @@ static int acpi_pci_propagate_wakeup(struct pci_bus *bus, bool enable)
3386 + {
3387 + while (bus->parent) {
3388 + if (acpi_pm_device_can_wakeup(&bus->self->dev))
3389 +- return acpi_pm_set_bridge_wakeup(&bus->self->dev, enable);
3390 ++ return acpi_pm_set_device_wakeup(&bus->self->dev, enable);
3391 +
3392 + bus = bus->parent;
3393 + }
3394 +@@ -581,7 +581,7 @@ static int acpi_pci_propagate_wakeup(struct pci_bus *bus, bool enable)
3395 + /* We have reached the root bus. */
3396 + if (bus->bridge) {
3397 + if (acpi_pm_device_can_wakeup(bus->bridge))
3398 +- return acpi_pm_set_bridge_wakeup(bus->bridge, enable);
3399 ++ return acpi_pm_set_device_wakeup(bus->bridge, enable);
3400 + }
3401 + return 0;
3402 + }
3403 +diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
3404 +index 379925fc49d4e..e5c3a27eaea26 100644
3405 +--- a/drivers/pci/slot.c
3406 ++++ b/drivers/pci/slot.c
3407 +@@ -307,6 +307,9 @@ placeholder:
3408 + goto err;
3409 + }
3410 +
3411 ++ INIT_LIST_HEAD(&slot->list);
3412 ++ list_add(&slot->list, &parent->slots);
3413 ++
3414 + err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL,
3415 + "%s", slot_name);
3416 + if (err) {
3417 +@@ -314,9 +317,6 @@ placeholder:
3418 + goto err;
3419 + }
3420 +
3421 +- INIT_LIST_HEAD(&slot->list);
3422 +- list_add(&slot->list, &parent->slots);
3423 +-
3424 + down_read(&pci_bus_sem);
3425 + list_for_each_entry(dev, &parent->devices, bus_list)
3426 + if (PCI_SLOT(dev->devfn) == slot_nr)
3427 +diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
3428 +index 62eac76be9f66..519758d4297ee 100644
3429 +--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
3430 ++++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
3431 +@@ -1266,7 +1266,6 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
3432 + break;
3433 + case PIN_CONFIG_INPUT_DEBOUNCE:
3434 + debounce = readl(db_reg);
3435 +- debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
3436 +
3437 + if (arg)
3438 + conf |= BYT_DEBOUNCE_EN;
3439 +@@ -1275,24 +1274,31 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
3440 +
3441 + switch (arg) {
3442 + case 375:
3443 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
3444 + debounce |= BYT_DEBOUNCE_PULSE_375US;
3445 + break;
3446 + case 750:
3447 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
3448 + debounce |= BYT_DEBOUNCE_PULSE_750US;
3449 + break;
3450 + case 1500:
3451 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
3452 + debounce |= BYT_DEBOUNCE_PULSE_1500US;
3453 + break;
3454 + case 3000:
3455 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
3456 + debounce |= BYT_DEBOUNCE_PULSE_3MS;
3457 + break;
3458 + case 6000:
3459 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
3460 + debounce |= BYT_DEBOUNCE_PULSE_6MS;
3461 + break;
3462 + case 12000:
3463 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
3464 + debounce |= BYT_DEBOUNCE_PULSE_12MS;
3465 + break;
3466 + case 24000:
3467 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
3468 + debounce |= BYT_DEBOUNCE_PULSE_24MS;
3469 + break;
3470 + default:
3471 +diff --git a/drivers/pinctrl/intel/pinctrl-merrifield.c b/drivers/pinctrl/intel/pinctrl-merrifield.c
3472 +index 86c4b3fab7b0e..5aa6d1dbc70ae 100644
3473 +--- a/drivers/pinctrl/intel/pinctrl-merrifield.c
3474 ++++ b/drivers/pinctrl/intel/pinctrl-merrifield.c
3475 +@@ -731,6 +731,10 @@ static int mrfld_config_set_pin(struct mrfld_pinctrl *mp, unsigned int pin,
3476 + mask |= BUFCFG_Px_EN_MASK | BUFCFG_PUPD_VAL_MASK;
3477 + bits |= BUFCFG_PU_EN;
3478 +
3479 ++ /* Set default strength value in case none is given */
3480 ++ if (arg == 1)
3481 ++ arg = 20000;
3482 ++
3483 + switch (arg) {
3484 + case 50000:
3485 + bits |= BUFCFG_PUPD_VAL_50K << BUFCFG_PUPD_VAL_SHIFT;
3486 +@@ -751,6 +755,10 @@ static int mrfld_config_set_pin(struct mrfld_pinctrl *mp, unsigned int pin,
3487 + mask |= BUFCFG_Px_EN_MASK | BUFCFG_PUPD_VAL_MASK;
3488 + bits |= BUFCFG_PD_EN;
3489 +
3490 ++ /* Set default strength value in case none is given */
3491 ++ if (arg == 1)
3492 ++ arg = 20000;
3493 ++
3494 + switch (arg) {
3495 + case 50000:
3496 + bits |= BUFCFG_PUPD_VAL_50K << BUFCFG_PUPD_VAL_SHIFT;
3497 +diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
3498 +index d4cd24ad077c4..cfa4a833304a2 100644
3499 +--- a/drivers/pinctrl/pinctrl-amd.c
3500 ++++ b/drivers/pinctrl/pinctrl-amd.c
3501 +@@ -426,7 +426,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
3502 + pin_reg &= ~BIT(LEVEL_TRIG_OFF);
3503 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
3504 + pin_reg |= ACTIVE_HIGH << ACTIVE_LEVEL_OFF;
3505 +- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF;
3506 + irq_set_handler_locked(d, handle_edge_irq);
3507 + break;
3508 +
3509 +@@ -434,7 +433,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
3510 + pin_reg &= ~BIT(LEVEL_TRIG_OFF);
3511 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
3512 + pin_reg |= ACTIVE_LOW << ACTIVE_LEVEL_OFF;
3513 +- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF;
3514 + irq_set_handler_locked(d, handle_edge_irq);
3515 + break;
3516 +
3517 +@@ -442,7 +440,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
3518 + pin_reg &= ~BIT(LEVEL_TRIG_OFF);
3519 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
3520 + pin_reg |= BOTH_EADGE << ACTIVE_LEVEL_OFF;
3521 +- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF;
3522 + irq_set_handler_locked(d, handle_edge_irq);
3523 + break;
3524 +
3525 +@@ -450,8 +447,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
3526 + pin_reg |= LEVEL_TRIGGER << LEVEL_TRIG_OFF;
3527 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
3528 + pin_reg |= ACTIVE_HIGH << ACTIVE_LEVEL_OFF;
3529 +- pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF);
3530 +- pin_reg |= DB_TYPE_PRESERVE_LOW_GLITCH << DB_CNTRL_OFF;
3531 + irq_set_handler_locked(d, handle_level_irq);
3532 + break;
3533 +
3534 +@@ -459,8 +454,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
3535 + pin_reg |= LEVEL_TRIGGER << LEVEL_TRIG_OFF;
3536 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
3537 + pin_reg |= ACTIVE_LOW << ACTIVE_LEVEL_OFF;
3538 +- pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF);
3539 +- pin_reg |= DB_TYPE_PRESERVE_HIGH_GLITCH << DB_CNTRL_OFF;
3540 + irq_set_handler_locked(d, handle_level_irq);
3541 + break;
3542 +
3543 +diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c
3544 +index fb73dcbb5ef37..68dcf53aaac34 100644
3545 +--- a/drivers/pinctrl/pinctrl-falcon.c
3546 ++++ b/drivers/pinctrl/pinctrl-falcon.c
3547 +@@ -438,24 +438,28 @@ static int pinctrl_falcon_probe(struct platform_device *pdev)
3548 +
3549 + /* load and remap the pad resources of the different banks */
3550 + for_each_compatible_node(np, NULL, "lantiq,pad-falcon") {
3551 +- struct platform_device *ppdev = of_find_device_by_node(np);
3552 + const __be32 *bank = of_get_property(np, "lantiq,bank", NULL);
3553 + struct resource res;
3554 ++ struct platform_device *ppdev;
3555 + u32 avail;
3556 + int pins;
3557 +
3558 + if (!of_device_is_available(np))
3559 + continue;
3560 +
3561 +- if (!ppdev) {
3562 +- dev_err(&pdev->dev, "failed to find pad pdev\n");
3563 +- continue;
3564 +- }
3565 + if (!bank || *bank >= PORTS)
3566 + continue;
3567 + if (of_address_to_resource(np, 0, &res))
3568 + continue;
3569 ++
3570 ++ ppdev = of_find_device_by_node(np);
3571 ++ if (!ppdev) {
3572 ++ dev_err(&pdev->dev, "failed to find pad pdev\n");
3573 ++ continue;
3574 ++ }
3575 ++
3576 + falcon_info.clk[*bank] = clk_get(&ppdev->dev, NULL);
3577 ++ put_device(&ppdev->dev);
3578 + if (IS_ERR(falcon_info.clk[*bank])) {
3579 + dev_err(&ppdev->dev, "failed to get clock\n");
3580 + return PTR_ERR(falcon_info.clk[*bank]);
3581 +diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
3582 +index 1be71f956d5c2..29f6f2bbb5fff 100644
3583 +--- a/drivers/platform/x86/acer-wmi.c
3584 ++++ b/drivers/platform/x86/acer-wmi.c
3585 +@@ -124,6 +124,7 @@ static const struct key_entry acer_wmi_keymap[] __initconst = {
3586 + {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */
3587 + {KE_IGNORE, 0x81, {KEY_SLEEP} },
3588 + {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad Toggle */
3589 ++ {KE_IGNORE, 0x84, {KEY_KBDILLUMTOGGLE} }, /* Automatic Keyboard background light toggle */
3590 + {KE_KEY, KEY_TOUCHPAD_ON, {KEY_TOUCHPAD_ON} },
3591 + {KE_KEY, KEY_TOUCHPAD_OFF, {KEY_TOUCHPAD_OFF} },
3592 + {KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} },
3593 +diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
3594 +index 35ff406aca483..0906f6b562bc4 100644
3595 +--- a/drivers/power/supply/bq24190_charger.c
3596 ++++ b/drivers/power/supply/bq24190_charger.c
3597 +@@ -450,8 +450,10 @@ static ssize_t bq24190_sysfs_show(struct device *dev,
3598 + return -EINVAL;
3599 +
3600 + ret = pm_runtime_get_sync(bdi->dev);
3601 +- if (ret < 0)
3602 ++ if (ret < 0) {
3603 ++ pm_runtime_put_noidle(bdi->dev);
3604 + return ret;
3605 ++ }
3606 +
3607 + ret = bq24190_read_mask(bdi, info->reg, info->mask, info->shift, &v);
3608 + if (ret)
3609 +@@ -1086,8 +1088,10 @@ static int bq24190_charger_get_property(struct power_supply *psy,
3610 + dev_dbg(bdi->dev, "prop: %d\n", psp);
3611 +
3612 + ret = pm_runtime_get_sync(bdi->dev);
3613 +- if (ret < 0)
3614 ++ if (ret < 0) {
3615 ++ pm_runtime_put_noidle(bdi->dev);
3616 + return ret;
3617 ++ }
3618 +
3619 + switch (psp) {
3620 + case POWER_SUPPLY_PROP_CHARGE_TYPE:
3621 +@@ -1158,8 +1162,10 @@ static int bq24190_charger_set_property(struct power_supply *psy,
3622 + dev_dbg(bdi->dev, "prop: %d\n", psp);
3623 +
3624 + ret = pm_runtime_get_sync(bdi->dev);
3625 +- if (ret < 0)
3626 ++ if (ret < 0) {
3627 ++ pm_runtime_put_noidle(bdi->dev);
3628 + return ret;
3629 ++ }
3630 +
3631 + switch (psp) {
3632 + case POWER_SUPPLY_PROP_ONLINE:
3633 +@@ -1424,8 +1430,10 @@ static int bq24190_battery_get_property(struct power_supply *psy,
3634 + dev_dbg(bdi->dev, "prop: %d\n", psp);
3635 +
3636 + ret = pm_runtime_get_sync(bdi->dev);
3637 +- if (ret < 0)
3638 ++ if (ret < 0) {
3639 ++ pm_runtime_put_noidle(bdi->dev);
3640 + return ret;
3641 ++ }
3642 +
3643 + switch (psp) {
3644 + case POWER_SUPPLY_PROP_STATUS:
3645 +@@ -1470,8 +1478,10 @@ static int bq24190_battery_set_property(struct power_supply *psy,
3646 + dev_dbg(bdi->dev, "prop: %d\n", psp);
3647 +
3648 + ret = pm_runtime_get_sync(bdi->dev);
3649 +- if (ret < 0)
3650 ++ if (ret < 0) {
3651 ++ pm_runtime_put_noidle(bdi->dev);
3652 + return ret;
3653 ++ }
3654 +
3655 + switch (psp) {
3656 + case POWER_SUPPLY_PROP_ONLINE:
3657 +diff --git a/drivers/ps3/ps3stor_lib.c b/drivers/ps3/ps3stor_lib.c
3658 +index 8c3f5adf1bc65..2d76183756626 100644
3659 +--- a/drivers/ps3/ps3stor_lib.c
3660 ++++ b/drivers/ps3/ps3stor_lib.c
3661 +@@ -201,7 +201,7 @@ int ps3stor_setup(struct ps3_storage_device *dev, irq_handler_t handler)
3662 + dev->bounce_lpar = ps3_mm_phys_to_lpar(__pa(dev->bounce_buf));
3663 + dev->bounce_dma = dma_map_single(&dev->sbd.core, dev->bounce_buf,
3664 + dev->bounce_size, DMA_BIDIRECTIONAL);
3665 +- if (!dev->bounce_dma) {
3666 ++ if (dma_mapping_error(&dev->sbd.core, dev->bounce_dma)) {
3667 + dev_err(&dev->sbd.core, "%s:%u: map DMA region failed\n",
3668 + __func__, __LINE__);
3669 + error = -ENODEV;
3670 +diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c
3671 +index 52584e9962edd..fc446d5c19f93 100644
3672 +--- a/drivers/pwm/pwm-lp3943.c
3673 ++++ b/drivers/pwm/pwm-lp3943.c
3674 +@@ -278,6 +278,7 @@ static int lp3943_pwm_probe(struct platform_device *pdev)
3675 + lp3943_pwm->chip.dev = &pdev->dev;
3676 + lp3943_pwm->chip.ops = &lp3943_pwm_ops;
3677 + lp3943_pwm->chip.npwm = LP3943_NUM_PWMS;
3678 ++ lp3943_pwm->chip.base = -1;
3679 +
3680 + platform_set_drvdata(pdev, lp3943_pwm);
3681 +
3682 +diff --git a/drivers/pwm/pwm-zx.c b/drivers/pwm/pwm-zx.c
3683 +index 5d27c16edfb13..0d4112410b69d 100644
3684 +--- a/drivers/pwm/pwm-zx.c
3685 ++++ b/drivers/pwm/pwm-zx.c
3686 +@@ -241,6 +241,7 @@ static int zx_pwm_probe(struct platform_device *pdev)
3687 + ret = pwmchip_add(&zpc->chip);
3688 + if (ret < 0) {
3689 + dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret);
3690 ++ clk_disable_unprepare(zpc->pclk);
3691 + return ret;
3692 + }
3693 +
3694 +diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c
3695 +index fd1dff2bed21e..487b16ace0060 100644
3696 +--- a/drivers/s390/block/dasd_alias.c
3697 ++++ b/drivers/s390/block/dasd_alias.c
3698 +@@ -256,7 +256,6 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device)
3699 + return;
3700 + device->discipline->get_uid(device, &uid);
3701 + spin_lock_irqsave(&lcu->lock, flags);
3702 +- list_del_init(&device->alias_list);
3703 + /* make sure that the workers don't use this device */
3704 + if (device == lcu->suc_data.device) {
3705 + spin_unlock_irqrestore(&lcu->lock, flags);
3706 +@@ -283,6 +282,7 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device)
3707 +
3708 + spin_lock_irqsave(&aliastree.lock, flags);
3709 + spin_lock(&lcu->lock);
3710 ++ list_del_init(&device->alias_list);
3711 + if (list_empty(&lcu->grouplist) &&
3712 + list_empty(&lcu->active_devices) &&
3713 + list_empty(&lcu->inactive_devices)) {
3714 +@@ -503,6 +503,14 @@ static int _lcu_update(struct dasd_device *refdev, struct alias_lcu *lcu)
3715 + return rc;
3716 +
3717 + spin_lock_irqsave(&lcu->lock, flags);
3718 ++ /*
3719 ++ * there is another update needed skip the remaining handling
3720 ++ * the data might already be outdated
3721 ++ * but especially do not add the device to an LCU with pending
3722 ++ * update
3723 ++ */
3724 ++ if (lcu->flags & NEED_UAC_UPDATE)
3725 ++ goto out;
3726 + lcu->pav = NO_PAV;
3727 + for (i = 0; i < MAX_DEVICES_PER_LCU; ++i) {
3728 + switch (lcu->uac->unit[i].ua_type) {
3729 +@@ -521,6 +529,7 @@ static int _lcu_update(struct dasd_device *refdev, struct alias_lcu *lcu)
3730 + alias_list) {
3731 + _add_device_to_lcu(lcu, device, refdev);
3732 + }
3733 ++out:
3734 + spin_unlock_irqrestore(&lcu->lock, flags);
3735 + return 0;
3736 + }
3737 +@@ -625,6 +634,7 @@ int dasd_alias_add_device(struct dasd_device *device)
3738 + }
3739 + if (lcu->flags & UPDATE_PENDING) {
3740 + list_move(&device->alias_list, &lcu->active_devices);
3741 ++ private->pavgroup = NULL;
3742 + _schedule_lcu_update(lcu, device);
3743 + }
3744 + spin_unlock_irqrestore(&lcu->lock, flags);
3745 +diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
3746 +index 86e1eac3a4703..b4542e7e2ad5b 100644
3747 +--- a/drivers/scsi/be2iscsi/be_main.c
3748 ++++ b/drivers/scsi/be2iscsi/be_main.c
3749 +@@ -3013,7 +3013,6 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
3750 + goto create_eq_error;
3751 + }
3752 +
3753 +- mem->dma = paddr;
3754 + mem->va = eq_vaddress;
3755 + ret = be_fill_queue(eq, phba->params.num_eq_entries,
3756 + sizeof(struct be_eq_entry), eq_vaddress);
3757 +@@ -3023,6 +3022,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
3758 + goto create_eq_error;
3759 + }
3760 +
3761 ++ mem->dma = paddr;
3762 + ret = beiscsi_cmd_eq_create(&phba->ctrl, eq,
3763 + phwi_context->cur_eqd);
3764 + if (ret) {
3765 +@@ -3079,7 +3079,6 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
3766 + goto create_cq_error;
3767 + }
3768 +
3769 +- mem->dma = paddr;
3770 + ret = be_fill_queue(cq, phba->params.num_cq_entries,
3771 + sizeof(struct sol_cqe), cq_vaddress);
3772 + if (ret) {
3773 +@@ -3089,6 +3088,7 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
3774 + goto create_cq_error;
3775 + }
3776 +
3777 ++ mem->dma = paddr;
3778 + ret = beiscsi_cmd_cq_create(&phba->ctrl, cq, eq, false,
3779 + false, 0);
3780 + if (ret) {
3781 +diff --git a/drivers/scsi/bnx2i/Kconfig b/drivers/scsi/bnx2i/Kconfig
3782 +index ba30ff86d5818..b27a3738d940c 100644
3783 +--- a/drivers/scsi/bnx2i/Kconfig
3784 ++++ b/drivers/scsi/bnx2i/Kconfig
3785 +@@ -3,6 +3,7 @@ config SCSI_BNX2_ISCSI
3786 + depends on NET
3787 + depends on PCI
3788 + depends on (IPV6 || IPV6=n)
3789 ++ depends on MMU
3790 + select SCSI_ISCSI_ATTRS
3791 + select NETDEVICES
3792 + select ETHERNET
3793 +diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
3794 +index aacadbf20b695..878e486762729 100644
3795 +--- a/drivers/scsi/fnic/fnic_main.c
3796 ++++ b/drivers/scsi/fnic/fnic_main.c
3797 +@@ -746,6 +746,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3798 + for (i = 0; i < FNIC_IO_LOCKS; i++)
3799 + spin_lock_init(&fnic->io_req_lock[i]);
3800 +
3801 ++ err = -ENOMEM;
3802 + fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache);
3803 + if (!fnic->io_req_pool)
3804 + goto err_out_free_resources;
3805 +diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
3806 +index 556971c5f0b0e..20bf1fa7f2733 100644
3807 +--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
3808 ++++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
3809 +@@ -4575,7 +4575,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc)
3810 +
3811 + r = _base_handshake_req_reply_wait(ioc,
3812 + sizeof(Mpi2IOCInitRequest_t), (u32 *)&mpi_request,
3813 +- sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 10);
3814 ++ sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 30);
3815 +
3816 + if (r != 0) {
3817 + pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n",
3818 +diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
3819 +index 0e013f76b582e..30e49b4acaeaf 100644
3820 +--- a/drivers/scsi/pm8001/pm8001_init.c
3821 ++++ b/drivers/scsi/pm8001/pm8001_init.c
3822 +@@ -1054,7 +1054,8 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
3823 +
3824 + pm8001_init_sas_add(pm8001_ha);
3825 + /* phy setting support for motherboard controller */
3826 +- if (pm8001_configure_phy_settings(pm8001_ha))
3827 ++ rc = pm8001_configure_phy_settings(pm8001_ha);
3828 ++ if (rc)
3829 + goto err_out_shost;
3830 +
3831 + pm8001_post_sas_ha_init(shost, chip);
3832 +diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
3833 +index 24b945b555ba3..a742b88567762 100644
3834 +--- a/drivers/scsi/qedi/qedi_main.c
3835 ++++ b/drivers/scsi/qedi/qedi_main.c
3836 +@@ -2387,7 +2387,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
3837 + QEDI_ERR(&qedi->dbg_ctx,
3838 + "Unable to start offload thread!\n");
3839 + rc = -ENODEV;
3840 +- goto free_cid_que;
3841 ++ goto free_tmf_thread;
3842 + }
3843 +
3844 + /* F/w needs 1st task context memory entry for performance */
3845 +@@ -2407,6 +2407,8 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
3846 +
3847 + return 0;
3848 +
3849 ++free_tmf_thread:
3850 ++ destroy_workqueue(qedi->tmf_thread);
3851 + free_cid_que:
3852 + qedi_release_cid_que(qedi);
3853 + free_uio:
3854 +diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
3855 +index c36c84c8725a0..6e0981b09c58b 100644
3856 +--- a/drivers/scsi/scsi_lib.c
3857 ++++ b/drivers/scsi/scsi_lib.c
3858 +@@ -3326,6 +3326,78 @@ void sdev_enable_disk_events(struct scsi_device *sdev)
3859 + }
3860 + EXPORT_SYMBOL(sdev_enable_disk_events);
3861 +
3862 ++static unsigned char designator_prio(const unsigned char *d)
3863 ++{
3864 ++ if (d[1] & 0x30)
3865 ++ /* not associated with LUN */
3866 ++ return 0;
3867 ++
3868 ++ if (d[3] == 0)
3869 ++ /* invalid length */
3870 ++ return 0;
3871 ++
3872 ++ /*
3873 ++ * Order of preference for lun descriptor:
3874 ++ * - SCSI name string
3875 ++ * - NAA IEEE Registered Extended
3876 ++ * - EUI-64 based 16-byte
3877 ++ * - EUI-64 based 12-byte
3878 ++ * - NAA IEEE Registered
3879 ++ * - NAA IEEE Extended
3880 ++ * - EUI-64 based 8-byte
3881 ++ * - SCSI name string (truncated)
3882 ++ * - T10 Vendor ID
3883 ++ * as longer descriptors reduce the likelyhood
3884 ++ * of identification clashes.
3885 ++ */
3886 ++
3887 ++ switch (d[1] & 0xf) {
3888 ++ case 8:
3889 ++ /* SCSI name string, variable-length UTF-8 */
3890 ++ return 9;
3891 ++ case 3:
3892 ++ switch (d[4] >> 4) {
3893 ++ case 6:
3894 ++ /* NAA registered extended */
3895 ++ return 8;
3896 ++ case 5:
3897 ++ /* NAA registered */
3898 ++ return 5;
3899 ++ case 4:
3900 ++ /* NAA extended */
3901 ++ return 4;
3902 ++ case 3:
3903 ++ /* NAA locally assigned */
3904 ++ return 1;
3905 ++ default:
3906 ++ break;
3907 ++ }
3908 ++ break;
3909 ++ case 2:
3910 ++ switch (d[3]) {
3911 ++ case 16:
3912 ++ /* EUI64-based, 16 byte */
3913 ++ return 7;
3914 ++ case 12:
3915 ++ /* EUI64-based, 12 byte */
3916 ++ return 6;
3917 ++ case 8:
3918 ++ /* EUI64-based, 8 byte */
3919 ++ return 3;
3920 ++ default:
3921 ++ break;
3922 ++ }
3923 ++ break;
3924 ++ case 1:
3925 ++ /* T10 vendor ID */
3926 ++ return 1;
3927 ++ default:
3928 ++ break;
3929 ++ }
3930 ++
3931 ++ return 0;
3932 ++}
3933 ++
3934 + /**
3935 + * scsi_vpd_lun_id - return a unique device identification
3936 + * @sdev: SCSI device
3937 +@@ -3342,7 +3414,7 @@ EXPORT_SYMBOL(sdev_enable_disk_events);
3938 + */
3939 + int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
3940 + {
3941 +- u8 cur_id_type = 0xff;
3942 ++ u8 cur_id_prio = 0;
3943 + u8 cur_id_size = 0;
3944 + const unsigned char *d, *cur_id_str;
3945 + const struct scsi_vpd *vpd_pg83;
3946 +@@ -3355,20 +3427,6 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
3947 + return -ENXIO;
3948 + }
3949 +
3950 +- /*
3951 +- * Look for the correct descriptor.
3952 +- * Order of preference for lun descriptor:
3953 +- * - SCSI name string
3954 +- * - NAA IEEE Registered Extended
3955 +- * - EUI-64 based 16-byte
3956 +- * - EUI-64 based 12-byte
3957 +- * - NAA IEEE Registered
3958 +- * - NAA IEEE Extended
3959 +- * - T10 Vendor ID
3960 +- * as longer descriptors reduce the likelyhood
3961 +- * of identification clashes.
3962 +- */
3963 +-
3964 + /* The id string must be at least 20 bytes + terminating NULL byte */
3965 + if (id_len < 21) {
3966 + rcu_read_unlock();
3967 +@@ -3378,8 +3436,9 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
3968 + memset(id, 0, id_len);
3969 + d = vpd_pg83->data + 4;
3970 + while (d < vpd_pg83->data + vpd_pg83->len) {
3971 +- /* Skip designators not referring to the LUN */
3972 +- if ((d[1] & 0x30) != 0x00)
3973 ++ u8 prio = designator_prio(d);
3974 ++
3975 ++ if (prio == 0 || cur_id_prio > prio)
3976 + goto next_desig;
3977 +
3978 + switch (d[1] & 0xf) {
3979 +@@ -3387,28 +3446,19 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
3980 + /* T10 Vendor ID */
3981 + if (cur_id_size > d[3])
3982 + break;
3983 +- /* Prefer anything */
3984 +- if (cur_id_type > 0x01 && cur_id_type != 0xff)
3985 +- break;
3986 ++ cur_id_prio = prio;
3987 + cur_id_size = d[3];
3988 + if (cur_id_size + 4 > id_len)
3989 + cur_id_size = id_len - 4;
3990 + cur_id_str = d + 4;
3991 +- cur_id_type = d[1] & 0xf;
3992 + id_size = snprintf(id, id_len, "t10.%*pE",
3993 + cur_id_size, cur_id_str);
3994 + break;
3995 + case 0x2:
3996 + /* EUI-64 */
3997 +- if (cur_id_size > d[3])
3998 +- break;
3999 +- /* Prefer NAA IEEE Registered Extended */
4000 +- if (cur_id_type == 0x3 &&
4001 +- cur_id_size == d[3])
4002 +- break;
4003 ++ cur_id_prio = prio;
4004 + cur_id_size = d[3];
4005 + cur_id_str = d + 4;
4006 +- cur_id_type = d[1] & 0xf;
4007 + switch (cur_id_size) {
4008 + case 8:
4009 + id_size = snprintf(id, id_len,
4010 +@@ -3426,17 +3476,14 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
4011 + cur_id_str);
4012 + break;
4013 + default:
4014 +- cur_id_size = 0;
4015 + break;
4016 + }
4017 + break;
4018 + case 0x3:
4019 + /* NAA */
4020 +- if (cur_id_size > d[3])
4021 +- break;
4022 ++ cur_id_prio = prio;
4023 + cur_id_size = d[3];
4024 + cur_id_str = d + 4;
4025 +- cur_id_type = d[1] & 0xf;
4026 + switch (cur_id_size) {
4027 + case 8:
4028 + id_size = snprintf(id, id_len,
4029 +@@ -3449,26 +3496,25 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
4030 + cur_id_str);
4031 + break;
4032 + default:
4033 +- cur_id_size = 0;
4034 + break;
4035 + }
4036 + break;
4037 + case 0x8:
4038 + /* SCSI name string */
4039 +- if (cur_id_size + 4 > d[3])
4040 ++ if (cur_id_size > d[3])
4041 + break;
4042 + /* Prefer others for truncated descriptor */
4043 +- if (cur_id_size && d[3] > id_len)
4044 +- break;
4045 ++ if (d[3] > id_len) {
4046 ++ prio = 2;
4047 ++ if (cur_id_prio > prio)
4048 ++ break;
4049 ++ }
4050 ++ cur_id_prio = prio;
4051 + cur_id_size = id_size = d[3];
4052 + cur_id_str = d + 4;
4053 +- cur_id_type = d[1] & 0xf;
4054 + if (cur_id_size >= id_len)
4055 + cur_id_size = id_len - 1;
4056 + memcpy(id, cur_id_str, cur_id_size);
4057 +- /* Decrease priority for truncated descriptor */
4058 +- if (cur_id_size != id_size)
4059 +- cur_id_size = 6;
4060 + break;
4061 + default:
4062 + break;
4063 +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
4064 +index a3a3ee6e2a002..342e086e41991 100644
4065 +--- a/drivers/scsi/ufs/ufshcd.c
4066 ++++ b/drivers/scsi/ufs/ufshcd.c
4067 +@@ -1215,8 +1215,15 @@ static int ufshcd_devfreq_target(struct device *dev,
4068 + }
4069 + spin_unlock_irqrestore(hba->host->host_lock, irq_flags);
4070 +
4071 ++ pm_runtime_get_noresume(hba->dev);
4072 ++ if (!pm_runtime_active(hba->dev)) {
4073 ++ pm_runtime_put_noidle(hba->dev);
4074 ++ ret = -EAGAIN;
4075 ++ goto out;
4076 ++ }
4077 + start = ktime_get();
4078 + ret = ufshcd_devfreq_scale(hba, scale_up);
4079 ++ pm_runtime_put(hba->dev);
4080 +
4081 + trace_ufshcd_profile_clk_scaling(dev_name(hba->dev),
4082 + (scale_up ? "up" : "down"),
4083 +diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
4084 +index fb2a8b1e79791..d0b18cc7e61b5 100644
4085 +--- a/drivers/soc/mediatek/mtk-scpsys.c
4086 ++++ b/drivers/soc/mediatek/mtk-scpsys.c
4087 +@@ -481,6 +481,7 @@ static void mtk_register_power_domains(struct platform_device *pdev,
4088 + for (i = 0; i < num; i++) {
4089 + struct scp_domain *scpd = &scp->domains[i];
4090 + struct generic_pm_domain *genpd = &scpd->genpd;
4091 ++ bool on;
4092 +
4093 + /*
4094 + * Initially turn on all domains to make the domains usable
4095 +@@ -488,9 +489,9 @@ static void mtk_register_power_domains(struct platform_device *pdev,
4096 + * software. The unused domains will be switched off during
4097 + * late_init time.
4098 + */
4099 +- genpd->power_on(genpd);
4100 ++ on = !WARN_ON(genpd->power_on(genpd) < 0);
4101 +
4102 +- pm_genpd_init(genpd, NULL, false);
4103 ++ pm_genpd_init(genpd, NULL, !on);
4104 + }
4105 +
4106 + /*
4107 +diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c
4108 +index f51fb2ea72001..4c5767c73b7a8 100644
4109 +--- a/drivers/soc/qcom/smp2p.c
4110 ++++ b/drivers/soc/qcom/smp2p.c
4111 +@@ -314,15 +314,16 @@ static int qcom_smp2p_inbound_entry(struct qcom_smp2p *smp2p,
4112 + static int smp2p_update_bits(void *data, u32 mask, u32 value)
4113 + {
4114 + struct smp2p_entry *entry = data;
4115 ++ unsigned long flags;
4116 + u32 orig;
4117 + u32 val;
4118 +
4119 +- spin_lock(&entry->lock);
4120 ++ spin_lock_irqsave(&entry->lock, flags);
4121 + val = orig = readl(entry->value);
4122 + val &= ~mask;
4123 + val |= value;
4124 + writel(val, entry->value);
4125 +- spin_unlock(&entry->lock);
4126 ++ spin_unlock_irqrestore(&entry->lock, flags);
4127 +
4128 + if (val != orig)
4129 + qcom_smp2p_kick(entry->smp2p);
4130 +diff --git a/drivers/soc/tegra/fuse/speedo-tegra210.c b/drivers/soc/tegra/fuse/speedo-tegra210.c
4131 +index 5373f4c16b54c..4403b89561fd6 100644
4132 +--- a/drivers/soc/tegra/fuse/speedo-tegra210.c
4133 ++++ b/drivers/soc/tegra/fuse/speedo-tegra210.c
4134 +@@ -105,7 +105,7 @@ static int get_process_id(int value, const u32 *speedos, unsigned int num)
4135 + unsigned int i;
4136 +
4137 + for (i = 0; i < num; i++)
4138 +- if (value < speedos[num])
4139 ++ if (value < speedos[i])
4140 + return i;
4141 +
4142 + return -EINVAL;
4143 +diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c
4144 +index 026182d3b27c1..6d137b1f43ae5 100644
4145 +--- a/drivers/soc/ti/knav_dma.c
4146 ++++ b/drivers/soc/ti/knav_dma.c
4147 +@@ -752,8 +752,9 @@ static int knav_dma_probe(struct platform_device *pdev)
4148 + pm_runtime_enable(kdev->dev);
4149 + ret = pm_runtime_get_sync(kdev->dev);
4150 + if (ret < 0) {
4151 ++ pm_runtime_put_noidle(kdev->dev);
4152 + dev_err(kdev->dev, "unable to enable pktdma, err %d\n", ret);
4153 +- return ret;
4154 ++ goto err_pm_disable;
4155 + }
4156 +
4157 + /* Initialise all packet dmas */
4158 +@@ -767,13 +768,21 @@ static int knav_dma_probe(struct platform_device *pdev)
4159 +
4160 + if (list_empty(&kdev->list)) {
4161 + dev_err(dev, "no valid dma instance\n");
4162 +- return -ENODEV;
4163 ++ ret = -ENODEV;
4164 ++ goto err_put_sync;
4165 + }
4166 +
4167 + debugfs_create_file("knav_dma", S_IFREG | S_IRUGO, NULL, NULL,
4168 + &knav_dma_debug_ops);
4169 +
4170 + return ret;
4171 ++
4172 ++err_put_sync:
4173 ++ pm_runtime_put_sync(kdev->dev);
4174 ++err_pm_disable:
4175 ++ pm_runtime_disable(kdev->dev);
4176 ++
4177 ++ return ret;
4178 + }
4179 +
4180 + static int knav_dma_remove(struct platform_device *pdev)
4181 +diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
4182 +index 9879ca5f8c5f5..25baf13d6dfd2 100644
4183 +--- a/drivers/soc/ti/knav_qmss_queue.c
4184 ++++ b/drivers/soc/ti/knav_qmss_queue.c
4185 +@@ -1719,6 +1719,7 @@ static int knav_queue_probe(struct platform_device *pdev)
4186 + pm_runtime_enable(&pdev->dev);
4187 + ret = pm_runtime_get_sync(&pdev->dev);
4188 + if (ret < 0) {
4189 ++ pm_runtime_put_noidle(&pdev->dev);
4190 + dev_err(dev, "Failed to enable QMSS\n");
4191 + return ret;
4192 + }
4193 +@@ -1786,9 +1787,10 @@ static int knav_queue_probe(struct platform_device *pdev)
4194 + if (ret)
4195 + goto err;
4196 +
4197 +- regions = of_get_child_by_name(node, "descriptor-regions");
4198 ++ regions = of_get_child_by_name(node, "descriptor-regions");
4199 + if (!regions) {
4200 + dev_err(dev, "descriptor-regions not specified\n");
4201 ++ ret = -ENODEV;
4202 + goto err;
4203 + }
4204 + ret = knav_queue_setup_regions(kdev, regions);
4205 +diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c
4206 +index b7f78e6d9bec6..88772efda8304 100644
4207 +--- a/drivers/spi/spi-bcm2835aux.c
4208 ++++ b/drivers/spi/spi-bcm2835aux.c
4209 +@@ -407,7 +407,7 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
4210 + unsigned long clk_hz;
4211 + int err;
4212 +
4213 +- master = spi_alloc_master(&pdev->dev, sizeof(*bs));
4214 ++ master = devm_spi_alloc_master(&pdev->dev, sizeof(*bs));
4215 + if (!master) {
4216 + dev_err(&pdev->dev, "spi_alloc_master() failed\n");
4217 + return -ENOMEM;
4218 +@@ -439,30 +439,27 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
4219 + /* the main area */
4220 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
4221 + bs->regs = devm_ioremap_resource(&pdev->dev, res);
4222 +- if (IS_ERR(bs->regs)) {
4223 +- err = PTR_ERR(bs->regs);
4224 +- goto out_master_put;
4225 +- }
4226 ++ if (IS_ERR(bs->regs))
4227 ++ return PTR_ERR(bs->regs);
4228 +
4229 + bs->clk = devm_clk_get(&pdev->dev, NULL);
4230 + if ((!bs->clk) || (IS_ERR(bs->clk))) {
4231 + err = PTR_ERR(bs->clk);
4232 + dev_err(&pdev->dev, "could not get clk: %d\n", err);
4233 +- goto out_master_put;
4234 ++ return err;
4235 + }
4236 +
4237 + bs->irq = platform_get_irq(pdev, 0);
4238 + if (bs->irq <= 0) {
4239 + dev_err(&pdev->dev, "could not get IRQ: %d\n", bs->irq);
4240 +- err = bs->irq ? bs->irq : -ENODEV;
4241 +- goto out_master_put;
4242 ++ return bs->irq ? bs->irq : -ENODEV;
4243 + }
4244 +
4245 + /* this also enables the HW block */
4246 + err = clk_prepare_enable(bs->clk);
4247 + if (err) {
4248 + dev_err(&pdev->dev, "could not prepare clock: %d\n", err);
4249 +- goto out_master_put;
4250 ++ return err;
4251 + }
4252 +
4253 + /* just checking if the clock returns a sane value */
4254 +@@ -495,8 +492,6 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
4255 +
4256 + out_clk_disable:
4257 + clk_disable_unprepare(bs->clk);
4258 +-out_master_put:
4259 +- spi_master_put(master);
4260 + return err;
4261 + }
4262 +
4263 +diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
4264 +index c5bbe08771a4d..04e891cda1698 100644
4265 +--- a/drivers/spi/spi-davinci.c
4266 ++++ b/drivers/spi/spi-davinci.c
4267 +@@ -1085,13 +1085,13 @@ static int davinci_spi_remove(struct platform_device *pdev)
4268 + spi_bitbang_stop(&dspi->bitbang);
4269 +
4270 + clk_disable_unprepare(dspi->clk);
4271 +- spi_master_put(master);
4272 +
4273 + if (dspi->dma_rx) {
4274 + dma_release_channel(dspi->dma_rx);
4275 + dma_release_channel(dspi->dma_tx);
4276 + }
4277 +
4278 ++ spi_master_put(master);
4279 + return 0;
4280 + }
4281 +
4282 +diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
4283 +index 2e65b70c78792..2a340234c85c1 100644
4284 +--- a/drivers/spi/spi-img-spfi.c
4285 ++++ b/drivers/spi/spi-img-spfi.c
4286 +@@ -771,8 +771,10 @@ static int img_spfi_resume(struct device *dev)
4287 + int ret;
4288 +
4289 + ret = pm_runtime_get_sync(dev);
4290 +- if (ret)
4291 ++ if (ret) {
4292 ++ pm_runtime_put_noidle(dev);
4293 + return ret;
4294 ++ }
4295 + spfi_reset(spfi);
4296 + pm_runtime_put(dev);
4297 +
4298 +diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
4299 +index 288002f6c613e..661a40c653e90 100644
4300 +--- a/drivers/spi/spi-pic32.c
4301 ++++ b/drivers/spi/spi-pic32.c
4302 +@@ -839,6 +839,7 @@ static int pic32_spi_probe(struct platform_device *pdev)
4303 + return 0;
4304 +
4305 + err_bailout:
4306 ++ pic32_spi_dma_unprep(pic32s);
4307 + clk_disable_unprepare(pic32s->clk);
4308 + err_master:
4309 + spi_master_put(master);
4310 +diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
4311 +index 3641d0e20135b..1d7fd6dbaf876 100644
4312 +--- a/drivers/spi/spi-rb4xx.c
4313 ++++ b/drivers/spi/spi-rb4xx.c
4314 +@@ -148,7 +148,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
4315 + if (IS_ERR(spi_base))
4316 + return PTR_ERR(spi_base);
4317 +
4318 +- master = spi_alloc_master(&pdev->dev, sizeof(*rbspi));
4319 ++ master = devm_spi_alloc_master(&pdev->dev, sizeof(*rbspi));
4320 + if (!master)
4321 + return -ENOMEM;
4322 +
4323 +diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c
4324 +index 52cf0e9189c23..64cf1f572b6dd 100644
4325 +--- a/drivers/spi/spi-sc18is602.c
4326 ++++ b/drivers/spi/spi-sc18is602.c
4327 +@@ -248,13 +248,12 @@ static int sc18is602_probe(struct i2c_client *client,
4328 + struct sc18is602_platform_data *pdata = dev_get_platdata(dev);
4329 + struct sc18is602 *hw;
4330 + struct spi_master *master;
4331 +- int error;
4332 +
4333 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C |
4334 + I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
4335 + return -EINVAL;
4336 +
4337 +- master = spi_alloc_master(dev, sizeof(struct sc18is602));
4338 ++ master = devm_spi_alloc_master(dev, sizeof(struct sc18is602));
4339 + if (!master)
4340 + return -ENOMEM;
4341 +
4342 +@@ -308,15 +307,7 @@ static int sc18is602_probe(struct i2c_client *client,
4343 + master->min_speed_hz = hw->freq / 128;
4344 + master->max_speed_hz = hw->freq / 4;
4345 +
4346 +- error = devm_spi_register_master(dev, master);
4347 +- if (error)
4348 +- goto error_reg;
4349 +-
4350 +- return 0;
4351 +-
4352 +-error_reg:
4353 +- spi_master_put(master);
4354 +- return error;
4355 ++ return devm_spi_register_master(dev, master);
4356 + }
4357 +
4358 + static const struct i2c_device_id sc18is602_id[] = {
4359 +diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c
4360 +index 50e0ea9acf8b8..cba49a65ed2bd 100644
4361 +--- a/drivers/spi/spi-sh.c
4362 ++++ b/drivers/spi/spi-sh.c
4363 +@@ -450,7 +450,7 @@ static int spi_sh_probe(struct platform_device *pdev)
4364 + return irq;
4365 + }
4366 +
4367 +- master = spi_alloc_master(&pdev->dev, sizeof(struct spi_sh_data));
4368 ++ master = devm_spi_alloc_master(&pdev->dev, sizeof(struct spi_sh_data));
4369 + if (master == NULL) {
4370 + dev_err(&pdev->dev, "spi_alloc_master error.\n");
4371 + return -ENOMEM;
4372 +@@ -468,16 +468,14 @@ static int spi_sh_probe(struct platform_device *pdev)
4373 + break;
4374 + default:
4375 + dev_err(&pdev->dev, "No support width\n");
4376 +- ret = -ENODEV;
4377 +- goto error1;
4378 ++ return -ENODEV;
4379 + }
4380 + ss->irq = irq;
4381 + ss->master = master;
4382 + ss->addr = devm_ioremap(&pdev->dev, res->start, resource_size(res));
4383 + if (ss->addr == NULL) {
4384 + dev_err(&pdev->dev, "ioremap error.\n");
4385 +- ret = -ENOMEM;
4386 +- goto error1;
4387 ++ return -ENOMEM;
4388 + }
4389 + INIT_LIST_HEAD(&ss->queue);
4390 + spin_lock_init(&ss->lock);
4391 +@@ -487,7 +485,7 @@ static int spi_sh_probe(struct platform_device *pdev)
4392 + ret = request_irq(irq, spi_sh_irq, 0, "spi_sh", ss);
4393 + if (ret < 0) {
4394 + dev_err(&pdev->dev, "request_irq error\n");
4395 +- goto error1;
4396 ++ return ret;
4397 + }
4398 +
4399 + master->num_chipselect = 2;
4400 +@@ -506,9 +504,6 @@ static int spi_sh_probe(struct platform_device *pdev)
4401 +
4402 + error3:
4403 + free_irq(irq, ss);
4404 +- error1:
4405 +- spi_master_put(master);
4406 +-
4407 + return ret;
4408 + }
4409 +
4410 +diff --git a/drivers/spi/spi-st-ssc4.c b/drivers/spi/spi-st-ssc4.c
4411 +index 5df01ffdef468..b46502db7f122 100644
4412 +--- a/drivers/spi/spi-st-ssc4.c
4413 ++++ b/drivers/spi/spi-st-ssc4.c
4414 +@@ -379,13 +379,14 @@ static int spi_st_probe(struct platform_device *pdev)
4415 + ret = devm_spi_register_master(&pdev->dev, master);
4416 + if (ret) {
4417 + dev_err(&pdev->dev, "Failed to register master\n");
4418 +- goto clk_disable;
4419 ++ goto rpm_disable;
4420 + }
4421 +
4422 + return 0;
4423 +
4424 +-clk_disable:
4425 ++rpm_disable:
4426 + pm_runtime_disable(&pdev->dev);
4427 ++clk_disable:
4428 + clk_disable_unprepare(spi_st->clk);
4429 + put_master:
4430 + spi_master_put(master);
4431 +diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
4432 +index 84ff0c507f0b6..0e1a8d7aa3224 100644
4433 +--- a/drivers/spi/spi-tegra114.c
4434 ++++ b/drivers/spi/spi-tegra114.c
4435 +@@ -827,6 +827,7 @@ static int tegra_spi_setup(struct spi_device *spi)
4436 +
4437 + ret = pm_runtime_get_sync(tspi->dev);
4438 + if (ret < 0) {
4439 ++ pm_runtime_put_noidle(tspi->dev);
4440 + dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
4441 + return ret;
4442 + }
4443 +@@ -1252,6 +1253,7 @@ static int tegra_spi_resume(struct device *dev)
4444 +
4445 + ret = pm_runtime_get_sync(dev);
4446 + if (ret < 0) {
4447 ++ pm_runtime_put_noidle(dev);
4448 + dev_err(dev, "pm runtime failed, e = %d\n", ret);
4449 + return ret;
4450 + }
4451 +diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
4452 +index 22893a7e0aa0e..749288310c36c 100644
4453 +--- a/drivers/spi/spi-tegra20-sflash.c
4454 ++++ b/drivers/spi/spi-tegra20-sflash.c
4455 +@@ -564,6 +564,7 @@ static int tegra_sflash_resume(struct device *dev)
4456 +
4457 + ret = pm_runtime_get_sync(dev);
4458 + if (ret < 0) {
4459 ++ pm_runtime_put_noidle(dev);
4460 + dev_err(dev, "pm runtime failed, e = %d\n", ret);
4461 + return ret;
4462 + }
4463 +diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
4464 +index 62b074b167a9a..c39bfcbda5f2c 100644
4465 +--- a/drivers/spi/spi-tegra20-slink.c
4466 ++++ b/drivers/spi/spi-tegra20-slink.c
4467 +@@ -761,6 +761,7 @@ static int tegra_slink_setup(struct spi_device *spi)
4468 +
4469 + ret = pm_runtime_get_sync(tspi->dev);
4470 + if (ret < 0) {
4471 ++ pm_runtime_put_noidle(tspi->dev);
4472 + dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
4473 + return ret;
4474 + }
4475 +@@ -1197,6 +1198,7 @@ static int tegra_slink_resume(struct device *dev)
4476 +
4477 + ret = pm_runtime_get_sync(dev);
4478 + if (ret < 0) {
4479 ++ pm_runtime_put_noidle(dev);
4480 + dev_err(dev, "pm runtime failed, e = %d\n", ret);
4481 + return ret;
4482 + }
4483 +diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
4484 +index d0ea62d151c0f..29c1b5d3ae7ad 100644
4485 +--- a/drivers/spi/spi-ti-qspi.c
4486 ++++ b/drivers/spi/spi-ti-qspi.c
4487 +@@ -180,6 +180,7 @@ static int ti_qspi_setup(struct spi_device *spi)
4488 +
4489 + ret = pm_runtime_get_sync(qspi->dev);
4490 + if (ret < 0) {
4491 ++ pm_runtime_put_noidle(qspi->dev);
4492 + dev_err(qspi->dev, "pm_runtime_get_sync() failed\n");
4493 + return ret;
4494 + }
4495 +diff --git a/drivers/staging/comedi/drivers/mf6x4.c b/drivers/staging/comedi/drivers/mf6x4.c
4496 +index fbdf181d8cccc..40aa24a9b2c30 100644
4497 +--- a/drivers/staging/comedi/drivers/mf6x4.c
4498 ++++ b/drivers/staging/comedi/drivers/mf6x4.c
4499 +@@ -121,8 +121,9 @@ static int mf6x4_ai_eoc(struct comedi_device *dev,
4500 + struct mf6x4_private *devpriv = dev->private;
4501 + unsigned int status;
4502 +
4503 ++ /* EOLC goes low at end of conversion. */
4504 + status = ioread32(devpriv->gpioc_reg);
4505 +- if (status & MF6X4_GPIOC_EOLC)
4506 ++ if ((status & MF6X4_GPIOC_EOLC) == 0)
4507 + return 0;
4508 + return -EBUSY;
4509 + }
4510 +diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
4511 +index e36da20a2796b..e7856a9e685f4 100644
4512 +--- a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
4513 ++++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
4514 +@@ -77,7 +77,6 @@ static int register_dpio_irq_handlers(struct fsl_mc_device *dpio_dev, int cpu)
4515 + struct dpio_priv *priv;
4516 + int error;
4517 + struct fsl_mc_device_irq *irq;
4518 +- cpumask_t mask;
4519 +
4520 + priv = dev_get_drvdata(&dpio_dev->dev);
4521 +
4522 +@@ -96,9 +95,7 @@ static int register_dpio_irq_handlers(struct fsl_mc_device *dpio_dev, int cpu)
4523 + }
4524 +
4525 + /* set the affinity hint */
4526 +- cpumask_clear(&mask);
4527 +- cpumask_set_cpu(cpu, &mask);
4528 +- if (irq_set_affinity_hint(irq->msi_desc->irq, &mask))
4529 ++ if (irq_set_affinity_hint(irq->msi_desc->irq, cpumask_of(cpu)))
4530 + dev_err(&dpio_dev->dev,
4531 + "irq_set_affinity failed irq %d cpu %d\n",
4532 + irq->msi_desc->irq, cpu);
4533 +diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
4534 +index a6d01f0761f32..6ba5a34fcdf29 100644
4535 +--- a/drivers/staging/greybus/audio_codec.c
4536 ++++ b/drivers/staging/greybus/audio_codec.c
4537 +@@ -490,6 +490,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream *substream,
4538 + if (ret) {
4539 + dev_err_ratelimited(dai->dev, "%d: Error during set_config\n",
4540 + ret);
4541 ++ gb_pm_runtime_put_noidle(bundle);
4542 + mutex_unlock(&codec->lock);
4543 + return ret;
4544 + }
4545 +@@ -566,6 +567,7 @@ static int gbcodec_prepare(struct snd_pcm_substream *substream,
4546 + break;
4547 + }
4548 + if (ret) {
4549 ++ gb_pm_runtime_put_noidle(bundle);
4550 + mutex_unlock(&codec->lock);
4551 + dev_err_ratelimited(dai->dev, "set_data_size failed:%d\n",
4552 + ret);
4553 +diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c
4554 +index f069954800226..53316b0c0b13c 100644
4555 +--- a/drivers/staging/speakup/speakup_dectlk.c
4556 ++++ b/drivers/staging/speakup/speakup_dectlk.c
4557 +@@ -46,7 +46,7 @@ static unsigned char get_index(struct spk_synth *synth);
4558 + static int in_escape;
4559 + static int is_flushing;
4560 +
4561 +-static spinlock_t flush_lock;
4562 ++static DEFINE_SPINLOCK(flush_lock);
4563 + static DECLARE_WAIT_QUEUE_HEAD(flush);
4564 +
4565 + static struct var_t vars[] = {
4566 +diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
4567 +index 726852ebef855..e32afaa94d36d 100644
4568 +--- a/drivers/tty/serial/8250/8250_omap.c
4569 ++++ b/drivers/tty/serial/8250/8250_omap.c
4570 +@@ -161,11 +161,6 @@ static void omap_8250_mdr1_errataset(struct uart_8250_port *up,
4571 + struct omap8250_priv *priv)
4572 + {
4573 + u8 timeout = 255;
4574 +- u8 old_mdr1;
4575 +-
4576 +- old_mdr1 = serial_in(up, UART_OMAP_MDR1);
4577 +- if (old_mdr1 == priv->mdr1)
4578 +- return;
4579 +
4580 + serial_out(up, UART_OMAP_MDR1, priv->mdr1);
4581 + udelay(2);
4582 +diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
4583 +index 0ff8de7725cf6..3a9e27dd171eb 100644
4584 +--- a/drivers/tty/serial/serial_core.c
4585 ++++ b/drivers/tty/serial/serial_core.c
4586 +@@ -1434,6 +1434,10 @@ static void uart_set_ldisc(struct tty_struct *tty)
4587 + {
4588 + struct uart_state *state = tty->driver_data;
4589 + struct uart_port *uport;
4590 ++ struct tty_port *port = &state->port;
4591 ++
4592 ++ if (!tty_port_initialized(port))
4593 ++ return;
4594 +
4595 + mutex_lock(&state->port.mutex);
4596 + uport = uart_port_check(state);
4597 +diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
4598 +index 5f4a8157fad84..580468c449618 100644
4599 +--- a/drivers/usb/chipidea/ci_hdrc_imx.c
4600 ++++ b/drivers/usb/chipidea/ci_hdrc_imx.c
4601 +@@ -64,7 +64,8 @@ static const struct ci_hdrc_imx_platform_flag imx6sx_usb_data = {
4602 +
4603 + static const struct ci_hdrc_imx_platform_flag imx6ul_usb_data = {
4604 + .flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
4605 +- CI_HDRC_TURN_VBUS_EARLY_ON,
4606 ++ CI_HDRC_TURN_VBUS_EARLY_ON |
4607 ++ CI_HDRC_DISABLE_DEVICE_STREAMING,
4608 + };
4609 +
4610 + static const struct ci_hdrc_imx_platform_flag imx7d_usb_data = {
4611 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
4612 +index 34d8cece6dd3b..5d109717ac4e3 100644
4613 +--- a/drivers/usb/core/quirks.c
4614 ++++ b/drivers/usb/core/quirks.c
4615 +@@ -189,6 +189,9 @@ static const struct usb_device_id usb_quirk_list[] = {
4616 + { USB_DEVICE(0x06a3, 0x0006), .driver_info =
4617 + USB_QUIRK_CONFIG_INTF_STRINGS },
4618 +
4619 ++ /* Agfa SNAPSCAN 1212U */
4620 ++ { USB_DEVICE(0x06bd, 0x0001), .driver_info = USB_QUIRK_RESET_RESUME },
4621 ++
4622 + /* Guillemot Webcam Hercules Dualpix Exchange (2nd ID) */
4623 + { USB_DEVICE(0x06f8, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME },
4624 +
4625 +diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c
4626 +index 5e3828d9dac7f..7a135a36d1a2f 100644
4627 +--- a/drivers/usb/gadget/function/f_acm.c
4628 ++++ b/drivers/usb/gadget/function/f_acm.c
4629 +@@ -687,7 +687,7 @@ acm_bind(struct usb_configuration *c, struct usb_function *f)
4630 + acm_ss_out_desc.bEndpointAddress = acm_fs_out_desc.bEndpointAddress;
4631 +
4632 + status = usb_assign_descriptors(f, acm_fs_function, acm_hs_function,
4633 +- acm_ss_function, NULL);
4634 ++ acm_ss_function, acm_ss_function);
4635 + if (status)
4636 + goto fail;
4637 +
4638 +diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
4639 +index 2f98161d062e2..9f1bb8ed99bc7 100644
4640 +--- a/drivers/usb/gadget/function/f_fs.c
4641 ++++ b/drivers/usb/gadget/function/f_fs.c
4642 +@@ -1248,6 +1248,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
4643 +
4644 + switch (epfile->ffs->gadget->speed) {
4645 + case USB_SPEED_SUPER:
4646 ++ case USB_SPEED_SUPER_PLUS:
4647 + desc_idx = 2;
4648 + break;
4649 + case USB_SPEED_HIGH:
4650 +@@ -3067,7 +3068,8 @@ static int _ffs_func_bind(struct usb_configuration *c,
4651 + }
4652 +
4653 + if (likely(super)) {
4654 +- func->function.ss_descriptors = vla_ptr(vlabuf, d, ss_descs);
4655 ++ func->function.ss_descriptors = func->function.ssp_descriptors =
4656 ++ vla_ptr(vlabuf, d, ss_descs);
4657 + ss_len = ffs_do_descs(ffs->ss_descs_count,
4658 + vla_ptr(vlabuf, d, raw_descs) + fs_len + hs_len,
4659 + d_raw_descs__sz - fs_len - hs_len,
4660 +@@ -3477,6 +3479,7 @@ static void ffs_func_unbind(struct usb_configuration *c,
4661 + func->function.fs_descriptors = NULL;
4662 + func->function.hs_descriptors = NULL;
4663 + func->function.ss_descriptors = NULL;
4664 ++ func->function.ssp_descriptors = NULL;
4665 + func->interfaces_nums = NULL;
4666 +
4667 + ffs_event_add(ffs, FUNCTIONFS_UNBIND);
4668 +diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
4669 +index 34c0a385516ef..10ab13136cd14 100644
4670 +--- a/drivers/usb/gadget/function/f_midi.c
4671 ++++ b/drivers/usb/gadget/function/f_midi.c
4672 +@@ -1048,6 +1048,12 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
4673 + f->ss_descriptors = usb_copy_descriptors(midi_function);
4674 + if (!f->ss_descriptors)
4675 + goto fail_f_midi;
4676 ++
4677 ++ if (gadget_is_superspeed_plus(c->cdev->gadget)) {
4678 ++ f->ssp_descriptors = usb_copy_descriptors(midi_function);
4679 ++ if (!f->ssp_descriptors)
4680 ++ goto fail_f_midi;
4681 ++ }
4682 + }
4683 +
4684 + kfree(midi_function);
4685 +diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
4686 +index 2bde68f5d2463..b35c1d27dc52b 100644
4687 +--- a/drivers/usb/gadget/function/f_rndis.c
4688 ++++ b/drivers/usb/gadget/function/f_rndis.c
4689 +@@ -91,8 +91,10 @@ static inline struct f_rndis *func_to_rndis(struct usb_function *f)
4690 + /* peak (theoretical) bulk transfer rate in bits-per-second */
4691 + static unsigned int bitrate(struct usb_gadget *g)
4692 + {
4693 ++ if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER_PLUS)
4694 ++ return 4250000000U;
4695 + if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER)
4696 +- return 13 * 1024 * 8 * 1000 * 8;
4697 ++ return 3750000000U;
4698 + else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
4699 + return 13 * 512 * 8 * 1000 * 8;
4700 + else
4701 +diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
4702 +index a0c1d77a7e38d..df27b174b4d06 100644
4703 +--- a/drivers/usb/gadget/udc/dummy_hcd.c
4704 ++++ b/drivers/usb/gadget/udc/dummy_hcd.c
4705 +@@ -2742,7 +2742,7 @@ static int __init init(void)
4706 + {
4707 + int retval = -ENOMEM;
4708 + int i;
4709 +- struct dummy *dum[MAX_NUM_UDC];
4710 ++ struct dummy *dum[MAX_NUM_UDC] = {};
4711 +
4712 + if (usb_disabled())
4713 + return -ENODEV;
4714 +diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
4715 +index 4d308533bc835..a6b738139cd21 100644
4716 +--- a/drivers/usb/host/ehci-omap.c
4717 ++++ b/drivers/usb/host/ehci-omap.c
4718 +@@ -237,6 +237,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
4719 +
4720 + err_pm_runtime:
4721 + pm_runtime_put_sync(dev);
4722 ++ pm_runtime_disable(dev);
4723 +
4724 + err_phy:
4725 + for (i = 0; i < omap->nports; i++) {
4726 +diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
4727 +index ed20fb34c897f..1d3a79c2eba2f 100644
4728 +--- a/drivers/usb/host/oxu210hp-hcd.c
4729 ++++ b/drivers/usb/host/oxu210hp-hcd.c
4730 +@@ -3732,8 +3732,10 @@ static struct usb_hcd *oxu_create(struct platform_device *pdev,
4731 + oxu->is_otg = otg;
4732 +
4733 + ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
4734 +- if (ret < 0)
4735 ++ if (ret < 0) {
4736 ++ usb_put_hcd(hcd);
4737 + return ERR_PTR(ret);
4738 ++ }
4739 +
4740 + device_wakeup_enable(hcd->self.controller);
4741 + return hcd;
4742 +diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
4743 +index 592f8183af280..7f1685a545142 100644
4744 +--- a/drivers/usb/host/xhci-hub.c
4745 ++++ b/drivers/usb/host/xhci-hub.c
4746 +@@ -1590,6 +1590,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
4747 + hcd->state = HC_STATE_SUSPENDED;
4748 + bus_state->next_statechange = jiffies + msecs_to_jiffies(10);
4749 + spin_unlock_irqrestore(&xhci->lock, flags);
4750 ++
4751 ++ if (bus_state->bus_suspended)
4752 ++ usleep_range(5000, 10000);
4753 ++
4754 + return 0;
4755 + }
4756 +
4757 +diff --git a/drivers/usb/misc/sisusbvga/Kconfig b/drivers/usb/misc/sisusbvga/Kconfig
4758 +index 36bc28c884ad7..47dabccafef43 100644
4759 +--- a/drivers/usb/misc/sisusbvga/Kconfig
4760 ++++ b/drivers/usb/misc/sisusbvga/Kconfig
4761 +@@ -15,7 +15,7 @@ config USB_SISUSBVGA
4762 +
4763 + config USB_SISUSBVGA_CON
4764 + bool "Text console and mode switching support" if USB_SISUSBVGA
4765 +- depends on VT
4766 ++ depends on VT && BROKEN
4767 + select FONT_8x16
4768 + ---help---
4769 + Say Y here if you want a VGA text console via the USB dongle or
4770 +diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
4771 +index f8e8285663a62..30e5050ee4868 100644
4772 +--- a/drivers/usb/serial/keyspan_pda.c
4773 ++++ b/drivers/usb/serial/keyspan_pda.c
4774 +@@ -44,11 +44,12 @@
4775 + #define DRIVER_AUTHOR "Brian Warner <warner@××××××.com>"
4776 + #define DRIVER_DESC "USB Keyspan PDA Converter driver"
4777 +
4778 ++#define KEYSPAN_TX_THRESHOLD 16
4779 ++
4780 + struct keyspan_pda_private {
4781 + int tx_room;
4782 + int tx_throttled;
4783 +- struct work_struct wakeup_work;
4784 +- struct work_struct unthrottle_work;
4785 ++ struct work_struct unthrottle_work;
4786 + struct usb_serial *serial;
4787 + struct usb_serial_port *port;
4788 + };
4789 +@@ -101,15 +102,6 @@ static const struct usb_device_id id_table_fake_xircom[] = {
4790 + };
4791 + #endif
4792 +
4793 +-static void keyspan_pda_wakeup_write(struct work_struct *work)
4794 +-{
4795 +- struct keyspan_pda_private *priv =
4796 +- container_of(work, struct keyspan_pda_private, wakeup_work);
4797 +- struct usb_serial_port *port = priv->port;
4798 +-
4799 +- tty_port_tty_wakeup(&port->port);
4800 +-}
4801 +-
4802 + static void keyspan_pda_request_unthrottle(struct work_struct *work)
4803 + {
4804 + struct keyspan_pda_private *priv =
4805 +@@ -124,7 +116,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work)
4806 + 7, /* request_unthrottle */
4807 + USB_TYPE_VENDOR | USB_RECIP_INTERFACE
4808 + | USB_DIR_OUT,
4809 +- 16, /* value: threshold */
4810 ++ KEYSPAN_TX_THRESHOLD,
4811 + 0, /* index */
4812 + NULL,
4813 + 0,
4814 +@@ -143,6 +135,8 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
4815 + int retval;
4816 + int status = urb->status;
4817 + struct keyspan_pda_private *priv;
4818 ++ unsigned long flags;
4819 ++
4820 + priv = usb_get_serial_port_data(port);
4821 +
4822 + switch (status) {
4823 +@@ -176,18 +170,21 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
4824 + break;
4825 + case 1:
4826 + /* status interrupt */
4827 +- if (len < 3) {
4828 ++ if (len < 2) {
4829 + dev_warn(&port->dev, "short interrupt message received\n");
4830 + break;
4831 + }
4832 +- dev_dbg(&port->dev, "rx int, d1=%d, d2=%d\n", data[1], data[2]);
4833 ++ dev_dbg(&port->dev, "rx int, d1=%d\n", data[1]);
4834 + switch (data[1]) {
4835 + case 1: /* modemline change */
4836 + break;
4837 + case 2: /* tx unthrottle interrupt */
4838 ++ spin_lock_irqsave(&port->lock, flags);
4839 + priv->tx_throttled = 0;
4840 ++ priv->tx_room = max(priv->tx_room, KEYSPAN_TX_THRESHOLD);
4841 ++ spin_unlock_irqrestore(&port->lock, flags);
4842 + /* queue up a wakeup at scheduler time */
4843 +- schedule_work(&priv->wakeup_work);
4844 ++ usb_serial_port_softint(port);
4845 + break;
4846 + default:
4847 + break;
4848 +@@ -447,6 +444,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
4849 + int request_unthrottle = 0;
4850 + int rc = 0;
4851 + struct keyspan_pda_private *priv;
4852 ++ unsigned long flags;
4853 +
4854 + priv = usb_get_serial_port_data(port);
4855 + /* guess how much room is left in the device's ring buffer, and if we
4856 +@@ -466,13 +464,13 @@ static int keyspan_pda_write(struct tty_struct *tty,
4857 + the TX urb is in-flight (wait until it completes)
4858 + the device is full (wait until it says there is room)
4859 + */
4860 +- spin_lock_bh(&port->lock);
4861 ++ spin_lock_irqsave(&port->lock, flags);
4862 + if (!test_bit(0, &port->write_urbs_free) || priv->tx_throttled) {
4863 +- spin_unlock_bh(&port->lock);
4864 ++ spin_unlock_irqrestore(&port->lock, flags);
4865 + return 0;
4866 + }
4867 + clear_bit(0, &port->write_urbs_free);
4868 +- spin_unlock_bh(&port->lock);
4869 ++ spin_unlock_irqrestore(&port->lock, flags);
4870 +
4871 + /* At this point the URB is in our control, nobody else can submit it
4872 + again (the only sudden transition was the one from EINPROGRESS to
4873 +@@ -518,7 +516,8 @@ static int keyspan_pda_write(struct tty_struct *tty,
4874 + goto exit;
4875 + }
4876 + }
4877 +- if (count > priv->tx_room) {
4878 ++
4879 ++ if (count >= priv->tx_room) {
4880 + /* we're about to completely fill the Tx buffer, so
4881 + we'll be throttled afterwards. */
4882 + count = priv->tx_room;
4883 +@@ -551,7 +550,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
4884 +
4885 + rc = count;
4886 + exit:
4887 +- if (rc < 0)
4888 ++ if (rc <= 0)
4889 + set_bit(0, &port->write_urbs_free);
4890 + return rc;
4891 + }
4892 +@@ -566,21 +565,24 @@ static void keyspan_pda_write_bulk_callback(struct urb *urb)
4893 + priv = usb_get_serial_port_data(port);
4894 +
4895 + /* queue up a wakeup at scheduler time */
4896 +- schedule_work(&priv->wakeup_work);
4897 ++ usb_serial_port_softint(port);
4898 + }
4899 +
4900 +
4901 + static int keyspan_pda_write_room(struct tty_struct *tty)
4902 + {
4903 + struct usb_serial_port *port = tty->driver_data;
4904 +- struct keyspan_pda_private *priv;
4905 +- priv = usb_get_serial_port_data(port);
4906 +- /* used by n_tty.c for processing of tabs and such. Giving it our
4907 +- conservative guess is probably good enough, but needs testing by
4908 +- running a console through the device. */
4909 +- return priv->tx_room;
4910 +-}
4911 ++ struct keyspan_pda_private *priv = usb_get_serial_port_data(port);
4912 ++ unsigned long flags;
4913 ++ int room = 0;
4914 +
4915 ++ spin_lock_irqsave(&port->lock, flags);
4916 ++ if (test_bit(0, &port->write_urbs_free) && !priv->tx_throttled)
4917 ++ room = priv->tx_room;
4918 ++ spin_unlock_irqrestore(&port->lock, flags);
4919 ++
4920 ++ return room;
4921 ++}
4922 +
4923 + static int keyspan_pda_chars_in_buffer(struct tty_struct *tty)
4924 + {
4925 +@@ -660,8 +662,12 @@ error:
4926 + }
4927 + static void keyspan_pda_close(struct usb_serial_port *port)
4928 + {
4929 ++ struct keyspan_pda_private *priv = usb_get_serial_port_data(port);
4930 ++
4931 + usb_kill_urb(port->write_urb);
4932 + usb_kill_urb(port->interrupt_in_urb);
4933 ++
4934 ++ cancel_work_sync(&priv->unthrottle_work);
4935 + }
4936 +
4937 +
4938 +@@ -719,7 +725,6 @@ static int keyspan_pda_port_probe(struct usb_serial_port *port)
4939 + if (!priv)
4940 + return -ENOMEM;
4941 +
4942 +- INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write);
4943 + INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle);
4944 + priv->serial = port->serial;
4945 + priv->port = port;
4946 +diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
4947 +index 37967f4d93fda..6dace4800a069 100644
4948 +--- a/drivers/usb/serial/mos7720.c
4949 ++++ b/drivers/usb/serial/mos7720.c
4950 +@@ -640,6 +640,8 @@ static void parport_mos7715_restore_state(struct parport *pp,
4951 + spin_unlock(&release_lock);
4952 + return;
4953 + }
4954 ++ mos_parport->shadowDCR = s->u.pc.ctr;
4955 ++ mos_parport->shadowECR = s->u.pc.ecr;
4956 + write_parport_reg_nonblock(mos_parport, MOS7720_DCR,
4957 + mos_parport->shadowDCR);
4958 + write_parport_reg_nonblock(mos_parport, MOS7720_ECR,
4959 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
4960 +index 0a4b0c3839b5f..9e5fe0d2ae665 100644
4961 +--- a/drivers/usb/serial/option.c
4962 ++++ b/drivers/usb/serial/option.c
4963 +@@ -566,6 +566,9 @@ static void option_instat_callback(struct urb *urb);
4964 +
4965 + /* Device flags */
4966 +
4967 ++/* Highest interface number which can be used with NCTRL() and RSVD() */
4968 ++#define FLAG_IFNUM_MAX 7
4969 ++
4970 + /* Interface does not support modem-control requests */
4971 + #define NCTRL(ifnum) ((BIT(ifnum) & 0xff) << 8)
4972 +
4973 +@@ -2102,6 +2105,14 @@ static struct usb_serial_driver * const serial_drivers[] = {
4974 +
4975 + module_usb_serial_driver(serial_drivers, option_ids);
4976 +
4977 ++static bool iface_is_reserved(unsigned long device_flags, u8 ifnum)
4978 ++{
4979 ++ if (ifnum > FLAG_IFNUM_MAX)
4980 ++ return false;
4981 ++
4982 ++ return device_flags & RSVD(ifnum);
4983 ++}
4984 ++
4985 + static int option_probe(struct usb_serial *serial,
4986 + const struct usb_device_id *id)
4987 + {
4988 +@@ -2119,7 +2130,7 @@ static int option_probe(struct usb_serial *serial,
4989 + * the same class/subclass/protocol as the serial interfaces. Look at
4990 + * the Windows driver .INF files for reserved interface numbers.
4991 + */
4992 +- if (device_flags & RSVD(iface_desc->bInterfaceNumber))
4993 ++ if (iface_is_reserved(device_flags, iface_desc->bInterfaceNumber))
4994 + return -ENODEV;
4995 + /*
4996 + * Don't bind network interface on Samsung GT-B3730, it is handled by
4997 +@@ -2143,6 +2154,14 @@ static int option_probe(struct usb_serial *serial,
4998 + return 0;
4999 + }
5000 +
5001 ++static bool iface_no_modem_control(unsigned long device_flags, u8 ifnum)
5002 ++{
5003 ++ if (ifnum > FLAG_IFNUM_MAX)
5004 ++ return false;
5005 ++
5006 ++ return device_flags & NCTRL(ifnum);
5007 ++}
5008 ++
5009 + static int option_attach(struct usb_serial *serial)
5010 + {
5011 + struct usb_interface_descriptor *iface_desc;
5012 +@@ -2158,7 +2177,7 @@ static int option_attach(struct usb_serial *serial)
5013 +
5014 + iface_desc = &serial->interface->cur_altsetting->desc;
5015 +
5016 +- if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber)))
5017 ++ if (!iface_no_modem_control(device_flags, iface_desc->bInterfaceNumber))
5018 + data->use_send_setup = 1;
5019 +
5020 + if (device_flags & ZLP)
5021 +diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
5022 +index 6234cee50a889..e9ca6f13dbf2d 100644
5023 +--- a/drivers/usb/storage/uas.c
5024 ++++ b/drivers/usb/storage/uas.c
5025 +@@ -874,6 +874,9 @@ static int uas_slave_configure(struct scsi_device *sdev)
5026 + if (devinfo->flags & US_FL_NO_READ_CAPACITY_16)
5027 + sdev->no_read_capacity_16 = 1;
5028 +
5029 ++ /* Some disks cannot handle WRITE_SAME */
5030 ++ if (devinfo->flags & US_FL_NO_SAME)
5031 ++ sdev->no_write_same = 1;
5032 + /*
5033 + * Some disks return the total number of blocks in response
5034 + * to READ CAPACITY rather than the highest block number.
5035 +diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
5036 +index 018b0663d6109..61891c2dc9fcc 100644
5037 +--- a/drivers/usb/storage/unusual_uas.h
5038 ++++ b/drivers/usb/storage/unusual_uas.h
5039 +@@ -48,12 +48,15 @@ UNUSUAL_DEV(0x054c, 0x087d, 0x0000, 0x9999,
5040 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
5041 + US_FL_NO_REPORT_OPCODES),
5042 +
5043 +-/* Reported-by: Julian Groß <julian.g@××××××.de> */
5044 ++/*
5045 ++ * Initially Reported-by: Julian Groß <julian.g@××××××.de>
5046 ++ * Further reports David C. Partridge <david.partridge@××××××××××.uk>
5047 ++ */
5048 + UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999,
5049 + "LaCie",
5050 + "2Big Quadra USB3",
5051 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
5052 +- US_FL_NO_REPORT_OPCODES),
5053 ++ US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME),
5054 +
5055 + /*
5056 + * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI
5057 +diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
5058 +index 0dceb9fa3a062..2b6f8600c594b 100644
5059 +--- a/drivers/usb/storage/usb.c
5060 ++++ b/drivers/usb/storage/usb.c
5061 +@@ -557,6 +557,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags)
5062 + case 'j':
5063 + f |= US_FL_NO_REPORT_LUNS;
5064 + break;
5065 ++ case 'k':
5066 ++ f |= US_FL_NO_SAME;
5067 ++ break;
5068 + case 'l':
5069 + f |= US_FL_NOT_LOCKABLE;
5070 + break;
5071 +diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
5072 +index ac1c54bcfe8fb..6fceefcab81db 100644
5073 +--- a/drivers/vfio/pci/vfio_pci.c
5074 ++++ b/drivers/vfio/pci/vfio_pci.c
5075 +@@ -1380,8 +1380,8 @@ static int vfio_pci_mmap_fault(struct vm_fault *vmf)
5076 +
5077 + mutex_unlock(&vdev->vma_lock);
5078 +
5079 +- if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
5080 +- vma->vm_end - vma->vm_start, vma->vm_page_prot))
5081 ++ if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
5082 ++ vma->vm_end - vma->vm_start, vma->vm_page_prot))
5083 + ret = VM_FAULT_SIGBUS;
5084 +
5085 + up_out:
5086 +diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
5087 +index fa15a683ae2d4..de228669a2c8b 100644
5088 +--- a/drivers/watchdog/Kconfig
5089 ++++ b/drivers/watchdog/Kconfig
5090 +@@ -495,7 +495,7 @@ config SUNXI_WATCHDOG
5091 +
5092 + config COH901327_WATCHDOG
5093 + bool "ST-Ericsson COH 901 327 watchdog"
5094 +- depends on ARCH_U300 || (ARM && COMPILE_TEST)
5095 ++ depends on ARCH_U300 || (ARM && COMMON_CLK && COMPILE_TEST)
5096 + default y if MACH_U300
5097 + select WATCHDOG_CORE
5098 + help
5099 +@@ -620,6 +620,7 @@ config MOXART_WDT
5100 +
5101 + config SIRFSOC_WATCHDOG
5102 + tristate "SiRFSOC watchdog"
5103 ++ depends on HAS_IOMEM
5104 + depends on ARCH_SIRF || COMPILE_TEST
5105 + select WATCHDOG_CORE
5106 + default y
5107 +diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
5108 +index 780971318810d..1a0005a8fadb2 100644
5109 +--- a/drivers/watchdog/qcom-wdt.c
5110 ++++ b/drivers/watchdog/qcom-wdt.c
5111 +@@ -121,7 +121,7 @@ static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action,
5112 + */
5113 + wmb();
5114 +
5115 +- msleep(150);
5116 ++ mdelay(150);
5117 + return 0;
5118 + }
5119 +
5120 +diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
5121 +index 3bbed47da3fa5..1e2a996c75158 100644
5122 +--- a/drivers/xen/xen-pciback/xenbus.c
5123 ++++ b/drivers/xen/xen-pciback/xenbus.c
5124 +@@ -688,7 +688,7 @@ static int xen_pcibk_xenbus_probe(struct xenbus_device *dev,
5125 +
5126 + /* watch the backend node for backend configuration information */
5127 + err = xenbus_watch_path(dev, dev->nodename, &pdev->be_watch,
5128 +- xen_pcibk_be_watch);
5129 ++ NULL, xen_pcibk_be_watch);
5130 + if (err)
5131 + goto out;
5132 +
5133 +diff --git a/drivers/xen/xenbus/xenbus.h b/drivers/xen/xenbus/xenbus.h
5134 +index 092981171df17..139539b0ab20d 100644
5135 +--- a/drivers/xen/xenbus/xenbus.h
5136 ++++ b/drivers/xen/xenbus/xenbus.h
5137 +@@ -44,6 +44,8 @@ struct xen_bus_type {
5138 + int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename);
5139 + int (*probe)(struct xen_bus_type *bus, const char *type,
5140 + const char *dir);
5141 ++ bool (*otherend_will_handle)(struct xenbus_watch *watch,
5142 ++ const char *path, const char *token);
5143 + void (*otherend_changed)(struct xenbus_watch *watch, const char *path,
5144 + const char *token);
5145 + struct bus_type bus;
5146 +diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
5147 +index f7b553faadb10..e35bb6b874491 100644
5148 +--- a/drivers/xen/xenbus/xenbus_client.c
5149 ++++ b/drivers/xen/xenbus/xenbus_client.c
5150 +@@ -114,18 +114,22 @@ EXPORT_SYMBOL_GPL(xenbus_strstate);
5151 + */
5152 + int xenbus_watch_path(struct xenbus_device *dev, const char *path,
5153 + struct xenbus_watch *watch,
5154 ++ bool (*will_handle)(struct xenbus_watch *,
5155 ++ const char *, const char *),
5156 + void (*callback)(struct xenbus_watch *,
5157 + const char *, const char *))
5158 + {
5159 + int err;
5160 +
5161 + watch->node = path;
5162 ++ watch->will_handle = will_handle;
5163 + watch->callback = callback;
5164 +
5165 + err = register_xenbus_watch(watch);
5166 +
5167 + if (err) {
5168 + watch->node = NULL;
5169 ++ watch->will_handle = NULL;
5170 + watch->callback = NULL;
5171 + xenbus_dev_fatal(dev, err, "adding watch on %s", path);
5172 + }
5173 +@@ -152,6 +156,8 @@ EXPORT_SYMBOL_GPL(xenbus_watch_path);
5174 + */
5175 + int xenbus_watch_pathfmt(struct xenbus_device *dev,
5176 + struct xenbus_watch *watch,
5177 ++ bool (*will_handle)(struct xenbus_watch *,
5178 ++ const char *, const char *),
5179 + void (*callback)(struct xenbus_watch *,
5180 + const char *, const char *),
5181 + const char *pathfmt, ...)
5182 +@@ -168,7 +174,7 @@ int xenbus_watch_pathfmt(struct xenbus_device *dev,
5183 + xenbus_dev_fatal(dev, -ENOMEM, "allocating path for watch");
5184 + return -ENOMEM;
5185 + }
5186 +- err = xenbus_watch_path(dev, path, watch, callback);
5187 ++ err = xenbus_watch_path(dev, path, watch, will_handle, callback);
5188 +
5189 + if (err)
5190 + kfree(path);
5191 +diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
5192 +index ec9eb4fba59c7..217bcc092a968 100644
5193 +--- a/drivers/xen/xenbus/xenbus_probe.c
5194 ++++ b/drivers/xen/xenbus/xenbus_probe.c
5195 +@@ -136,6 +136,7 @@ static int watch_otherend(struct xenbus_device *dev)
5196 + container_of(dev->dev.bus, struct xen_bus_type, bus);
5197 +
5198 + return xenbus_watch_pathfmt(dev, &dev->otherend_watch,
5199 ++ bus->otherend_will_handle,
5200 + bus->otherend_changed,
5201 + "%s/%s", dev->otherend, "state");
5202 + }
5203 +diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c
5204 +index b0bed4faf44cc..4bb603051d5b6 100644
5205 +--- a/drivers/xen/xenbus/xenbus_probe_backend.c
5206 ++++ b/drivers/xen/xenbus/xenbus_probe_backend.c
5207 +@@ -180,6 +180,12 @@ static int xenbus_probe_backend(struct xen_bus_type *bus, const char *type,
5208 + return err;
5209 + }
5210 +
5211 ++static bool frontend_will_handle(struct xenbus_watch *watch,
5212 ++ const char *path, const char *token)
5213 ++{
5214 ++ return watch->nr_pending == 0;
5215 ++}
5216 ++
5217 + static void frontend_changed(struct xenbus_watch *watch,
5218 + const char *path, const char *token)
5219 + {
5220 +@@ -191,6 +197,7 @@ static struct xen_bus_type xenbus_backend = {
5221 + .levels = 3, /* backend/type/<frontend>/<id> */
5222 + .get_bus_id = backend_bus_id,
5223 + .probe = xenbus_probe_backend,
5224 ++ .otherend_will_handle = frontend_will_handle,
5225 + .otherend_changed = frontend_changed,
5226 + .bus = {
5227 + .name = "xen-backend",
5228 +diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
5229 +index b609c6e08796e..a0c61561bec60 100644
5230 +--- a/drivers/xen/xenbus/xenbus_xs.c
5231 ++++ b/drivers/xen/xenbus/xenbus_xs.c
5232 +@@ -700,9 +700,13 @@ int xs_watch_msg(struct xs_watch_event *event)
5233 +
5234 + spin_lock(&watches_lock);
5235 + event->handle = find_watch(event->token);
5236 +- if (event->handle != NULL) {
5237 ++ if (event->handle != NULL &&
5238 ++ (!event->handle->will_handle ||
5239 ++ event->handle->will_handle(event->handle,
5240 ++ event->path, event->token))) {
5241 + spin_lock(&watch_events_lock);
5242 + list_add_tail(&event->list, &watch_events);
5243 ++ event->handle->nr_pending++;
5244 + wake_up(&watch_events_waitq);
5245 + spin_unlock(&watch_events_lock);
5246 + } else
5247 +@@ -760,6 +764,8 @@ int register_xenbus_watch(struct xenbus_watch *watch)
5248 +
5249 + sprintf(token, "%lX", (long)watch);
5250 +
5251 ++ watch->nr_pending = 0;
5252 ++
5253 + down_read(&xs_watch_rwsem);
5254 +
5255 + spin_lock(&watches_lock);
5256 +@@ -809,11 +815,14 @@ void unregister_xenbus_watch(struct xenbus_watch *watch)
5257 +
5258 + /* Cancel pending watch events. */
5259 + spin_lock(&watch_events_lock);
5260 +- list_for_each_entry_safe(event, tmp, &watch_events, list) {
5261 +- if (event->handle != watch)
5262 +- continue;
5263 +- list_del(&event->list);
5264 +- kfree(event);
5265 ++ if (watch->nr_pending) {
5266 ++ list_for_each_entry_safe(event, tmp, &watch_events, list) {
5267 ++ if (event->handle != watch)
5268 ++ continue;
5269 ++ list_del(&event->list);
5270 ++ kfree(event);
5271 ++ }
5272 ++ watch->nr_pending = 0;
5273 + }
5274 + spin_unlock(&watch_events_lock);
5275 +
5276 +@@ -860,7 +869,6 @@ void xs_suspend_cancel(void)
5277 +
5278 + static int xenwatch_thread(void *unused)
5279 + {
5280 +- struct list_head *ent;
5281 + struct xs_watch_event *event;
5282 +
5283 + xenwatch_pid = current->pid;
5284 +@@ -875,13 +883,15 @@ static int xenwatch_thread(void *unused)
5285 + mutex_lock(&xenwatch_mutex);
5286 +
5287 + spin_lock(&watch_events_lock);
5288 +- ent = watch_events.next;
5289 +- if (ent != &watch_events)
5290 +- list_del(ent);
5291 ++ event = list_first_entry_or_null(&watch_events,
5292 ++ struct xs_watch_event, list);
5293 ++ if (event) {
5294 ++ list_del(&event->list);
5295 ++ event->handle->nr_pending--;
5296 ++ }
5297 + spin_unlock(&watch_events_lock);
5298 +
5299 +- if (ent != &watch_events) {
5300 +- event = list_entry(ent, struct xs_watch_event, list);
5301 ++ if (event) {
5302 + event->handle->callback(event->handle, event->path,
5303 + event->token);
5304 + kfree(event);
5305 +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
5306 +index c5ae2f4a7ec32..9769a5db7d5e9 100644
5307 +--- a/fs/btrfs/inode.c
5308 ++++ b/fs/btrfs/inode.c
5309 +@@ -7179,7 +7179,7 @@ again:
5310 + found_type == BTRFS_FILE_EXTENT_PREALLOC) {
5311 + /* Only regular file could have regular/prealloc extent */
5312 + if (!S_ISREG(inode->vfs_inode.i_mode)) {
5313 +- ret = -EUCLEAN;
5314 ++ err = -EUCLEAN;
5315 + btrfs_crit(fs_info,
5316 + "regular/prealloc extent found for non-regular inode %llu",
5317 + btrfs_ino(inode));
5318 +diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c
5319 +index 6c92101e80928..eb6ae2450fed5 100644
5320 +--- a/fs/btrfs/tests/btrfs-tests.c
5321 ++++ b/fs/btrfs/tests/btrfs-tests.c
5322 +@@ -51,7 +51,13 @@ static struct file_system_type test_type = {
5323 +
5324 + struct inode *btrfs_new_test_inode(void)
5325 + {
5326 +- return new_inode(test_mnt->mnt_sb);
5327 ++ struct inode *inode;
5328 ++
5329 ++ inode = new_inode(test_mnt->mnt_sb);
5330 ++ if (inode)
5331 ++ inode_init_owner(inode, NULL, S_IFREG);
5332 ++
5333 ++ return inode;
5334 + }
5335 +
5336 + static int btrfs_init_test_fs(void)
5337 +diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
5338 +index ce94d09f6abf9..382cf85fd574a 100644
5339 +--- a/fs/ceph/caps.c
5340 ++++ b/fs/ceph/caps.c
5341 +@@ -929,12 +929,19 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
5342 + {
5343 + struct ceph_mds_session *session = cap->session;
5344 + struct ceph_inode_info *ci = cap->ci;
5345 +- struct ceph_mds_client *mdsc =
5346 +- ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
5347 ++ struct ceph_mds_client *mdsc;
5348 + int removed = 0;
5349 +
5350 ++ /* 'ci' being NULL means the remove have already occurred */
5351 ++ if (!ci) {
5352 ++ dout("%s: cap inode is NULL\n", __func__);
5353 ++ return;
5354 ++ }
5355 ++
5356 + dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);
5357 +
5358 ++ mdsc = ceph_inode_to_client(&ci->vfs_inode)->mdsc;
5359 ++
5360 + /* remove from inode's cap rbtree, and clear auth cap */
5361 + rb_erase(&cap->ci_node, &ci->i_caps);
5362 + if (ci->i_auth_cap == cap)
5363 +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
5364 +index 1d8638ee54420..898f962d3a068 100644
5365 +--- a/fs/ext4/inode.c
5366 ++++ b/fs/ext4/inode.c
5367 +@@ -202,6 +202,7 @@ void ext4_evict_inode(struct inode *inode)
5368 + */
5369 + int extra_credits = 6;
5370 + struct ext4_xattr_inode_array *ea_inode_array = NULL;
5371 ++ bool freeze_protected = false;
5372 +
5373 + trace_ext4_evict_inode(inode);
5374 +
5375 +@@ -249,9 +250,14 @@ void ext4_evict_inode(struct inode *inode)
5376 +
5377 + /*
5378 + * Protect us against freezing - iput() caller didn't have to have any
5379 +- * protection against it
5380 ++ * protection against it. When we are in a running transaction though,
5381 ++ * we are already protected against freezing and we cannot grab further
5382 ++ * protection due to lock ordering constraints.
5383 + */
5384 +- sb_start_intwrite(inode->i_sb);
5385 ++ if (!ext4_journal_current_handle()) {
5386 ++ sb_start_intwrite(inode->i_sb);
5387 ++ freeze_protected = true;
5388 ++ }
5389 +
5390 + if (!IS_NOQUOTA(inode))
5391 + extra_credits += EXT4_MAXQUOTAS_DEL_BLOCKS(inode->i_sb);
5392 +@@ -270,7 +276,8 @@ void ext4_evict_inode(struct inode *inode)
5393 + * cleaned up.
5394 + */
5395 + ext4_orphan_del(NULL, inode);
5396 +- sb_end_intwrite(inode->i_sb);
5397 ++ if (freeze_protected)
5398 ++ sb_end_intwrite(inode->i_sb);
5399 + goto no_delete;
5400 + }
5401 +
5402 +@@ -311,7 +318,8 @@ void ext4_evict_inode(struct inode *inode)
5403 + stop_handle:
5404 + ext4_journal_stop(handle);
5405 + ext4_orphan_del(NULL, inode);
5406 +- sb_end_intwrite(inode->i_sb);
5407 ++ if (freeze_protected)
5408 ++ sb_end_intwrite(inode->i_sb);
5409 + ext4_xattr_inode_array_free(ea_inode_array);
5410 + goto no_delete;
5411 + }
5412 +@@ -340,7 +348,8 @@ stop_handle:
5413 + else
5414 + ext4_free_inode(handle, inode);
5415 + ext4_journal_stop(handle);
5416 +- sb_end_intwrite(inode->i_sb);
5417 ++ if (freeze_protected)
5418 ++ sb_end_intwrite(inode->i_sb);
5419 + ext4_xattr_inode_array_free(ea_inode_array);
5420 + return;
5421 + no_delete:
5422 +diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
5423 +index d7cedfaa1cc08..4cafe41ab5244 100644
5424 +--- a/fs/ext4/mballoc.c
5425 ++++ b/fs/ext4/mballoc.c
5426 +@@ -4718,6 +4718,7 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
5427 + ext4_group_first_block_no(sb, group) +
5428 + EXT4_C2B(sbi, cluster),
5429 + "Block already on to-be-freed list");
5430 ++ kmem_cache_free(ext4_free_data_cachep, new_entry);
5431 + return 0;
5432 + }
5433 + }
5434 +diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
5435 +index bccfc40b3a74a..d19483fa1fe89 100644
5436 +--- a/fs/jffs2/readinode.c
5437 ++++ b/fs/jffs2/readinode.c
5438 +@@ -672,6 +672,22 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r
5439 + jffs2_free_full_dirent(fd);
5440 + return -EIO;
5441 + }
5442 ++
5443 ++#ifdef CONFIG_JFFS2_SUMMARY
5444 ++ /*
5445 ++ * we use CONFIG_JFFS2_SUMMARY because without it, we
5446 ++ * have checked it while mounting
5447 ++ */
5448 ++ crc = crc32(0, fd->name, rd->nsize);
5449 ++ if (unlikely(crc != je32_to_cpu(rd->name_crc))) {
5450 ++ JFFS2_NOTICE("name CRC failed on dirent node at"
5451 ++ "%#08x: read %#08x,calculated %#08x\n",
5452 ++ ref_offset(ref), je32_to_cpu(rd->node_crc), crc);
5453 ++ jffs2_mark_node_obsolete(c, ref);
5454 ++ jffs2_free_full_dirent(fd);
5455 ++ return 0;
5456 ++ }
5457 ++#endif
5458 + }
5459 +
5460 + fd->nhash = full_name_hash(NULL, fd->name, rd->nsize);
5461 +diff --git a/fs/jfs/jfs_dmap.h b/fs/jfs/jfs_dmap.h
5462 +index 562b9a7e4311f..f502a15c6c987 100644
5463 +--- a/fs/jfs/jfs_dmap.h
5464 ++++ b/fs/jfs/jfs_dmap.h
5465 +@@ -196,7 +196,7 @@ typedef union dmtree {
5466 + #define dmt_leafidx t1.leafidx
5467 + #define dmt_height t1.height
5468 + #define dmt_budmin t1.budmin
5469 +-#define dmt_stree t1.stree
5470 ++#define dmt_stree t2.stree
5471 +
5472 + /*
5473 + * on-disk aggregate disk allocation map descriptor.
5474 +diff --git a/fs/lockd/host.c b/fs/lockd/host.c
5475 +index c4504ed9f6807..9c39e13a28df2 100644
5476 +--- a/fs/lockd/host.c
5477 ++++ b/fs/lockd/host.c
5478 +@@ -431,12 +431,7 @@ nlm_bind_host(struct nlm_host *host)
5479 + * RPC rebind is required
5480 + */
5481 + if ((clnt = host->h_rpcclnt) != NULL) {
5482 +- if (time_after_eq(jiffies, host->h_nextrebind)) {
5483 +- rpc_force_rebind(clnt);
5484 +- host->h_nextrebind = jiffies + NLM_HOST_REBIND;
5485 +- dprintk("lockd: next rebind in %lu jiffies\n",
5486 +- host->h_nextrebind - jiffies);
5487 +- }
5488 ++ nlm_rebind_host(host);
5489 + } else {
5490 + unsigned long increment = nlmsvc_timeout;
5491 + struct rpc_timeout timeparms = {
5492 +@@ -484,13 +479,20 @@ nlm_bind_host(struct nlm_host *host)
5493 + return clnt;
5494 + }
5495 +
5496 +-/*
5497 +- * Force a portmap lookup of the remote lockd port
5498 ++/**
5499 ++ * nlm_rebind_host - If needed, force a portmap lookup of the peer's lockd port
5500 ++ * @host: NLM host handle for peer
5501 ++ *
5502 ++ * This is not needed when using a connection-oriented protocol, such as TCP.
5503 ++ * The existing autobind mechanism is sufficient to force a rebind when
5504 ++ * required, e.g. on connection state transitions.
5505 + */
5506 + void
5507 + nlm_rebind_host(struct nlm_host *host)
5508 + {
5509 +- dprintk("lockd: rebind host %s\n", host->h_name);
5510 ++ if (host->h_proto != IPPROTO_UDP)
5511 ++ return;
5512 ++
5513 + if (host->h_rpcclnt && time_after_eq(jiffies, host->h_nextrebind)) {
5514 + rpc_force_rebind(host->h_rpcclnt);
5515 + host->h_nextrebind = jiffies + NLM_HOST_REBIND;
5516 +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
5517 +index 71a399f6805ac..f0534b356f071 100644
5518 +--- a/fs/nfs/inode.c
5519 ++++ b/fs/nfs/inode.c
5520 +@@ -2053,7 +2053,7 @@ static int nfsiod_start(void)
5521 + {
5522 + struct workqueue_struct *wq;
5523 + dprintk("RPC: creating workqueue nfsiod\n");
5524 +- wq = alloc_workqueue("nfsiod", WQ_MEM_RECLAIM, 0);
5525 ++ wq = alloc_workqueue("nfsiod", WQ_MEM_RECLAIM | WQ_UNBOUND, 0);
5526 + if (wq == NULL)
5527 + return -ENOMEM;
5528 + nfsiod_workqueue = wq;
5529 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
5530 +index bb899a6fe8ac0..9f2ba4874f10f 100644
5531 +--- a/fs/nfs/nfs4proc.c
5532 ++++ b/fs/nfs/nfs4proc.c
5533 +@@ -4445,12 +4445,12 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
5534 + u64 cookie, struct page **pages, unsigned int count, bool plus)
5535 + {
5536 + struct inode *dir = d_inode(dentry);
5537 ++ struct nfs_server *server = NFS_SERVER(dir);
5538 + struct nfs4_readdir_arg args = {
5539 + .fh = NFS_FH(dir),
5540 + .pages = pages,
5541 + .pgbase = 0,
5542 + .count = count,
5543 +- .bitmask = NFS_SERVER(d_inode(dentry))->attr_bitmask,
5544 + .plus = plus,
5545 + };
5546 + struct nfs4_readdir_res res;
5547 +@@ -4465,9 +4465,15 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
5548 + dprintk("%s: dentry = %pd2, cookie = %Lu\n", __func__,
5549 + dentry,
5550 + (unsigned long long)cookie);
5551 ++ if (!(server->caps & NFS_CAP_SECURITY_LABEL))
5552 ++ args.bitmask = server->attr_bitmask_nl;
5553 ++ else
5554 ++ args.bitmask = server->attr_bitmask;
5555 ++
5556 + nfs4_setup_readdir(cookie, NFS_I(dir)->cookieverf, dentry, &args);
5557 + res.pgbase = args.pgbase;
5558 +- status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0);
5559 ++ status = nfs4_call_sync(server->client, server, &msg, &args.seq_args,
5560 ++ &res.seq_res, 0);
5561 + if (status >= 0) {
5562 + memcpy(NFS_I(dir)->cookieverf, res.verifier.data, NFS4_VERIFIER_SIZE);
5563 + status += args.pgbase;
5564 +diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
5565 +index 3b13fb3b05530..63c9c2a70937f 100644
5566 +--- a/fs/nfs_common/grace.c
5567 ++++ b/fs/nfs_common/grace.c
5568 +@@ -75,10 +75,14 @@ __state_in_grace(struct net *net, bool open)
5569 + if (!open)
5570 + return !list_empty(grace_list);
5571 +
5572 ++ spin_lock(&grace_lock);
5573 + list_for_each_entry(lm, grace_list, list) {
5574 +- if (lm->block_opens)
5575 ++ if (lm->block_opens) {
5576 ++ spin_unlock(&grace_lock);
5577 + return true;
5578 ++ }
5579 + }
5580 ++ spin_unlock(&grace_lock);
5581 + return false;
5582 + }
5583 +
5584 +diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
5585 +index 4a9e0fb634b6c..67e85a752d3a4 100644
5586 +--- a/fs/nfsd/nfssvc.c
5587 ++++ b/fs/nfsd/nfssvc.c
5588 +@@ -410,8 +410,7 @@ static void nfsd_last_thread(struct svc_serv *serv, struct net *net)
5589 + return;
5590 +
5591 + nfsd_shutdown_net(net);
5592 +- printk(KERN_WARNING "nfsd: last server has exited, flushing export "
5593 +- "cache\n");
5594 ++ pr_info("nfsd: last server has exited, flushing export cache\n");
5595 + nfsd_export_flush(net);
5596 + }
5597 +
5598 +diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c
5599 +index 5d4dc0f84f202..d99710270a373 100644
5600 +--- a/fs/quota/quota_v2.c
5601 ++++ b/fs/quota/quota_v2.c
5602 +@@ -158,6 +158,25 @@ static int v2_read_file_info(struct super_block *sb, int type)
5603 + qinfo->dqi_entry_size = sizeof(struct v2r1_disk_dqblk);
5604 + qinfo->dqi_ops = &v2r1_qtree_ops;
5605 + }
5606 ++ ret = -EUCLEAN;
5607 ++ /* Some sanity checks of the read headers... */
5608 ++ if ((loff_t)qinfo->dqi_blocks << qinfo->dqi_blocksize_bits >
5609 ++ i_size_read(sb_dqopt(sb)->files[type])) {
5610 ++ quota_error(sb, "Number of blocks too big for quota file size (%llu > %llu).",
5611 ++ (loff_t)qinfo->dqi_blocks << qinfo->dqi_blocksize_bits,
5612 ++ i_size_read(sb_dqopt(sb)->files[type]));
5613 ++ goto out;
5614 ++ }
5615 ++ if (qinfo->dqi_free_blk >= qinfo->dqi_blocks) {
5616 ++ quota_error(sb, "Free block number too big (%u >= %u).",
5617 ++ qinfo->dqi_free_blk, qinfo->dqi_blocks);
5618 ++ goto out;
5619 ++ }
5620 ++ if (qinfo->dqi_free_entry >= qinfo->dqi_blocks) {
5621 ++ quota_error(sb, "Block with free entry too big (%u >= %u).",
5622 ++ qinfo->dqi_free_entry, qinfo->dqi_blocks);
5623 ++ goto out;
5624 ++ }
5625 + ret = 0;
5626 + out:
5627 + up_read(&dqopt->dqio_sem);
5628 +diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
5629 +index 324a04df3785b..67f4fce222091 100644
5630 +--- a/include/acpi/acpi_bus.h
5631 ++++ b/include/acpi/acpi_bus.h
5632 +@@ -619,7 +619,6 @@ acpi_status acpi_remove_pm_notifier(struct acpi_device *adev);
5633 + bool acpi_pm_device_can_wakeup(struct device *dev);
5634 + int acpi_pm_device_sleep_state(struct device *, int *, int);
5635 + int acpi_pm_set_device_wakeup(struct device *dev, bool enable);
5636 +-int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable);
5637 + #else
5638 + static inline void acpi_pm_wakeup_event(struct device *dev)
5639 + {
5640 +@@ -650,10 +649,6 @@ static inline int acpi_pm_set_device_wakeup(struct device *dev, bool enable)
5641 + {
5642 + return -ENODEV;
5643 + }
5644 +-static inline int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable)
5645 +-{
5646 +- return -ENODEV;
5647 +-}
5648 + #endif
5649 +
5650 + #ifdef CONFIG_ACPI_SLEEP
5651 +diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h
5652 +index 3efed0d742a05..969904a01dacb 100644
5653 +--- a/include/linux/build_bug.h
5654 ++++ b/include/linux/build_bug.h
5655 +@@ -82,4 +82,9 @@
5656 +
5657 + #endif /* __CHECKER__ */
5658 +
5659 ++#ifdef __GENKSYMS__
5660 ++/* genksyms gets confused by _Static_assert */
5661 ++#define _Static_assert(expr, ...)
5662 ++#endif
5663 ++
5664 + #endif /* _LINUX_BUILD_BUG_H */
5665 +diff --git a/include/linux/security.h b/include/linux/security.h
5666 +index ce6265960d6c4..dab093af4ee8d 100644
5667 +--- a/include/linux/security.h
5668 ++++ b/include/linux/security.h
5669 +@@ -780,7 +780,7 @@ static inline int security_inode_killpriv(struct dentry *dentry)
5670 +
5671 + static inline int security_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc)
5672 + {
5673 +- return -EOPNOTSUPP;
5674 ++ return cap_inode_getsecurity(inode, name, buffer, alloc);
5675 + }
5676 +
5677 + static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
5678 +diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h
5679 +index aa5deb041c25d..7cc952282e8be 100644
5680 +--- a/include/linux/seq_buf.h
5681 ++++ b/include/linux/seq_buf.h
5682 +@@ -30,7 +30,7 @@ static inline void seq_buf_clear(struct seq_buf *s)
5683 + }
5684 +
5685 + static inline void
5686 +-seq_buf_init(struct seq_buf *s, unsigned char *buf, unsigned int size)
5687 ++seq_buf_init(struct seq_buf *s, char *buf, unsigned int size)
5688 + {
5689 + s->buffer = buf;
5690 + s->size = size;
5691 +diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
5692 +index 7fad83881ce19..9785715eea145 100644
5693 +--- a/include/linux/sunrpc/xprt.h
5694 ++++ b/include/linux/sunrpc/xprt.h
5695 +@@ -316,6 +316,7 @@ struct xprt_class {
5696 + struct rpc_xprt * (*setup)(struct xprt_create *);
5697 + struct module *owner;
5698 + char name[32];
5699 ++ const char * netid[];
5700 + };
5701 +
5702 + /*
5703 +diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
5704 +index 6609b39a72326..6db257466af68 100644
5705 +--- a/include/linux/trace_seq.h
5706 ++++ b/include/linux/trace_seq.h
5707 +@@ -12,7 +12,7 @@
5708 + */
5709 +
5710 + struct trace_seq {
5711 +- unsigned char buffer[PAGE_SIZE];
5712 ++ char buffer[PAGE_SIZE];
5713 + struct seq_buf seq;
5714 + int full;
5715 + };
5716 +@@ -51,7 +51,7 @@ static inline int trace_seq_used(struct trace_seq *s)
5717 + * that is about to be written to and then return the result
5718 + * of that write.
5719 + */
5720 +-static inline unsigned char *
5721 ++static inline char *
5722 + trace_seq_buffer_ptr(struct trace_seq *s)
5723 + {
5724 + return s->buffer + seq_buf_used(&s->seq);
5725 +diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
5726 +index 000a5954b2e89..a7f7ebdd3069e 100644
5727 +--- a/include/linux/usb_usual.h
5728 ++++ b/include/linux/usb_usual.h
5729 +@@ -84,6 +84,8 @@
5730 + /* Cannot handle REPORT_LUNS */ \
5731 + US_FLAG(ALWAYS_SYNC, 0x20000000) \
5732 + /* lies about caching, so always sync */ \
5733 ++ US_FLAG(NO_SAME, 0x40000000) \
5734 ++ /* Cannot handle WRITE_SAME */ \
5735 +
5736 + #define US_FLAG(name, value) US_FL_##name = value ,
5737 + enum { US_DO_ALL_FLAGS };
5738 +diff --git a/include/uapi/linux/if_alg.h b/include/uapi/linux/if_alg.h
5739 +index bc2bcdec377b4..7690507714231 100644
5740 +--- a/include/uapi/linux/if_alg.h
5741 ++++ b/include/uapi/linux/if_alg.h
5742 +@@ -24,6 +24,22 @@ struct sockaddr_alg {
5743 + __u8 salg_name[64];
5744 + };
5745 +
5746 ++/*
5747 ++ * Linux v4.12 and later removed the 64-byte limit on salg_name[]; it's now an
5748 ++ * arbitrary-length field. We had to keep the original struct above for source
5749 ++ * compatibility with existing userspace programs, though. Use the new struct
5750 ++ * below if support for very long algorithm names is needed. To do this,
5751 ++ * allocate 'sizeof(struct sockaddr_alg_new) + strlen(algname) + 1' bytes, and
5752 ++ * copy algname (including the null terminator) into salg_name.
5753 ++ */
5754 ++struct sockaddr_alg_new {
5755 ++ __u16 salg_family;
5756 ++ __u8 salg_type[14];
5757 ++ __u32 salg_feat;
5758 ++ __u32 salg_mask;
5759 ++ __u8 salg_name[];
5760 ++};
5761 ++
5762 + struct af_alg_iv {
5763 + __u32 ivlen;
5764 + __u8 iv[0];
5765 +diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
5766 +index 869c816d5f8c3..eba01ab5a55e0 100644
5767 +--- a/include/xen/xenbus.h
5768 ++++ b/include/xen/xenbus.h
5769 +@@ -59,6 +59,15 @@ struct xenbus_watch
5770 + /* Path being watched. */
5771 + const char *node;
5772 +
5773 ++ unsigned int nr_pending;
5774 ++
5775 ++ /*
5776 ++ * Called just before enqueing new event while a spinlock is held.
5777 ++ * The event will be discarded if this callback returns false.
5778 ++ */
5779 ++ bool (*will_handle)(struct xenbus_watch *,
5780 ++ const char *path, const char *token);
5781 ++
5782 + /* Callback (executed in a process context with no locks held). */
5783 + void (*callback)(struct xenbus_watch *,
5784 + const char *path, const char *token);
5785 +@@ -192,10 +201,14 @@ void xenbus_probe(struct work_struct *);
5786 +
5787 + int xenbus_watch_path(struct xenbus_device *dev, const char *path,
5788 + struct xenbus_watch *watch,
5789 ++ bool (*will_handle)(struct xenbus_watch *,
5790 ++ const char *, const char *),
5791 + void (*callback)(struct xenbus_watch *,
5792 + const char *, const char *));
5793 +-__printf(4, 5)
5794 ++__printf(5, 6)
5795 + int xenbus_watch_pathfmt(struct xenbus_device *dev, struct xenbus_watch *watch,
5796 ++ bool (*will_handle)(struct xenbus_watch *,
5797 ++ const char *, const char *),
5798 + void (*callback)(struct xenbus_watch *,
5799 + const char *, const char *),
5800 + const char *pathfmt, ...);
5801 +diff --git a/kernel/cpu.c b/kernel/cpu.c
5802 +index d8c77bfb6e7e4..e1d10629022a5 100644
5803 +--- a/kernel/cpu.c
5804 ++++ b/kernel/cpu.c
5805 +@@ -772,6 +772,10 @@ void __init cpuhp_threads_init(void)
5806 + }
5807 +
5808 + #ifdef CONFIG_HOTPLUG_CPU
5809 ++#ifndef arch_clear_mm_cpumask_cpu
5810 ++#define arch_clear_mm_cpumask_cpu(cpu, mm) cpumask_clear_cpu(cpu, mm_cpumask(mm))
5811 ++#endif
5812 ++
5813 + /**
5814 + * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU
5815 + * @cpu: a CPU id
5816 +@@ -807,7 +811,7 @@ void clear_tasks_mm_cpumask(int cpu)
5817 + t = find_lock_task_mm(p);
5818 + if (!t)
5819 + continue;
5820 +- cpumask_clear_cpu(cpu, mm_cpumask(t->mm));
5821 ++ arch_clear_mm_cpumask_cpu(cpu, t->mm);
5822 + task_unlock(t);
5823 + }
5824 + rcu_read_unlock();
5825 +diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
5826 +index 0d54f8256b9f4..cafea68749e0a 100644
5827 +--- a/kernel/irq/irqdomain.c
5828 ++++ b/kernel/irq/irqdomain.c
5829 +@@ -1364,8 +1364,15 @@ static void irq_domain_free_irqs_hierarchy(struct irq_domain *domain,
5830 + unsigned int irq_base,
5831 + unsigned int nr_irqs)
5832 + {
5833 +- if (domain->ops->free)
5834 +- domain->ops->free(domain, irq_base, nr_irqs);
5835 ++ unsigned int i;
5836 ++
5837 ++ if (!domain->ops->free)
5838 ++ return;
5839 ++
5840 ++ for (i = 0; i < nr_irqs; i++) {
5841 ++ if (irq_domain_get_irq_data(domain, irq_base + i))
5842 ++ domain->ops->free(domain, irq_base + i, 1);
5843 ++ }
5844 + }
5845 +
5846 + int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain,
5847 +diff --git a/kernel/sched/core.c b/kernel/sched/core.c
5848 +index c5599174e7450..7cedada731c1b 100644
5849 +--- a/kernel/sched/core.c
5850 ++++ b/kernel/sched/core.c
5851 +@@ -4826,12 +4826,8 @@ SYSCALL_DEFINE0(sched_yield)
5852 + schedstat_inc(rq->yld_count);
5853 + current->sched_class->yield_task(rq);
5854 +
5855 +- /*
5856 +- * Since we are going to call schedule() anyway, there's
5857 +- * no need to preempt or enable interrupts:
5858 +- */
5859 + preempt_disable();
5860 +- rq_unlock(rq, &rf);
5861 ++ rq_unlock_irq(rq, &rf);
5862 + sched_preempt_enable_no_resched();
5863 +
5864 + schedule();
5865 +diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
5866 +index 22770168bff84..06a6bcd6cfa66 100644
5867 +--- a/kernel/sched/deadline.c
5868 ++++ b/kernel/sched/deadline.c
5869 +@@ -2345,7 +2345,7 @@ int sched_dl_global_validate(void)
5870 + u64 period = global_rt_period();
5871 + u64 new_bw = to_ratio(period, runtime);
5872 + struct dl_bw *dl_b;
5873 +- int cpu, ret = 0;
5874 ++ int cpu, cpus, ret = 0;
5875 + unsigned long flags;
5876 +
5877 + /*
5878 +@@ -2360,9 +2360,10 @@ int sched_dl_global_validate(void)
5879 + for_each_possible_cpu(cpu) {
5880 + rcu_read_lock_sched();
5881 + dl_b = dl_bw_of(cpu);
5882 ++ cpus = dl_bw_cpus(cpu);
5883 +
5884 + raw_spin_lock_irqsave(&dl_b->lock, flags);
5885 +- if (new_bw < dl_b->total_bw)
5886 ++ if (new_bw * cpus < dl_b->total_bw)
5887 + ret = -EBUSY;
5888 + raw_spin_unlock_irqrestore(&dl_b->lock, flags);
5889 +
5890 +diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
5891 +index 391d73a12ad72..e5cfec6bc8913 100644
5892 +--- a/kernel/sched/sched.h
5893 ++++ b/kernel/sched/sched.h
5894 +@@ -191,30 +191,6 @@ struct rt_bandwidth {
5895 +
5896 + void __dl_clear_params(struct task_struct *p);
5897 +
5898 +-/*
5899 +- * To keep the bandwidth of -deadline tasks and groups under control
5900 +- * we need some place where:
5901 +- * - store the maximum -deadline bandwidth of the system (the group);
5902 +- * - cache the fraction of that bandwidth that is currently allocated.
5903 +- *
5904 +- * This is all done in the data structure below. It is similar to the
5905 +- * one used for RT-throttling (rt_bandwidth), with the main difference
5906 +- * that, since here we are only interested in admission control, we
5907 +- * do not decrease any runtime while the group "executes", neither we
5908 +- * need a timer to replenish it.
5909 +- *
5910 +- * With respect to SMP, the bandwidth is given on a per-CPU basis,
5911 +- * meaning that:
5912 +- * - dl_bw (< 100%) is the bandwidth of the system (group) on each CPU;
5913 +- * - dl_total_bw array contains, in the i-eth element, the currently
5914 +- * allocated bandwidth on the i-eth CPU.
5915 +- * Moreover, groups consume bandwidth on each CPU, while tasks only
5916 +- * consume bandwidth on the CPU they're running on.
5917 +- * Finally, dl_total_bw_cpu is used to cache the index of dl_total_bw
5918 +- * that will be shown the next time the proc or cgroup controls will
5919 +- * be red. It on its turn can be changed by writing on its own
5920 +- * control.
5921 +- */
5922 + struct dl_bandwidth {
5923 + raw_spinlock_t dl_runtime_lock;
5924 + u64 dl_runtime;
5925 +@@ -226,6 +202,24 @@ static inline int dl_bandwidth_enabled(void)
5926 + return sysctl_sched_rt_runtime >= 0;
5927 + }
5928 +
5929 ++/*
5930 ++ * To keep the bandwidth of -deadline tasks under control
5931 ++ * we need some place where:
5932 ++ * - store the maximum -deadline bandwidth of each cpu;
5933 ++ * - cache the fraction of bandwidth that is currently allocated in
5934 ++ * each root domain;
5935 ++ *
5936 ++ * This is all done in the data structure below. It is similar to the
5937 ++ * one used for RT-throttling (rt_bandwidth), with the main difference
5938 ++ * that, since here we are only interested in admission control, we
5939 ++ * do not decrease any runtime while the group "executes", neither we
5940 ++ * need a timer to replenish it.
5941 ++ *
5942 ++ * With respect to SMP, bandwidth is given on a per root domain basis,
5943 ++ * meaning that:
5944 ++ * - bw (< 100%) is the deadline bandwidth of each CPU;
5945 ++ * - total_bw is the currently allocated bandwidth in each root domain;
5946 ++ */
5947 + struct dl_bw {
5948 + raw_spinlock_t lock;
5949 + u64 bw, total_bw;
5950 +diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
5951 +index ba12bf8de8267..5e05a96e0646a 100644
5952 +--- a/net/bluetooth/hci_event.c
5953 ++++ b/net/bluetooth/hci_event.c
5954 +@@ -4350,6 +4350,11 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev,
5955 + return;
5956 + }
5957 +
5958 ++ if (!hcon->amp_mgr) {
5959 ++ hci_dev_unlock(hdev);
5960 ++ return;
5961 ++ }
5962 ++
5963 + if (ev->status) {
5964 + hci_conn_del(hcon);
5965 + hci_dev_unlock(hdev);
5966 +@@ -5141,20 +5146,18 @@ static void hci_le_direct_adv_report_evt(struct hci_dev *hdev,
5967 + struct sk_buff *skb)
5968 + {
5969 + u8 num_reports = skb->data[0];
5970 +- void *ptr = &skb->data[1];
5971 ++ struct hci_ev_le_direct_adv_info *ev = (void *)&skb->data[1];
5972 +
5973 +- hci_dev_lock(hdev);
5974 ++ if (!num_reports || skb->len < num_reports * sizeof(*ev) + 1)
5975 ++ return;
5976 +
5977 +- while (num_reports--) {
5978 +- struct hci_ev_le_direct_adv_info *ev = ptr;
5979 ++ hci_dev_lock(hdev);
5980 +
5981 ++ for (; num_reports; num_reports--, ev++)
5982 + process_adv_report(hdev, ev->evt_type, &ev->bdaddr,
5983 + ev->bdaddr_type, &ev->direct_addr,
5984 + ev->direct_addr_type, ev->rssi, NULL, 0);
5985 +
5986 +- ptr += sizeof(*ev);
5987 +- }
5988 +-
5989 + hci_dev_unlock(hdev);
5990 + }
5991 +
5992 +diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
5993 +index e24a74884768c..830ff7bba5e32 100644
5994 +--- a/net/bridge/br_vlan.c
5995 ++++ b/net/bridge/br_vlan.c
5996 +@@ -241,8 +241,10 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags)
5997 + }
5998 +
5999 + masterv = br_vlan_get_master(br, v->vid);
6000 +- if (!masterv)
6001 ++ if (!masterv) {
6002 ++ err = -ENOMEM;
6003 + goto out_filt;
6004 ++ }
6005 + v->brvlan = masterv;
6006 + v->stats = masterv->stats;
6007 + }
6008 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
6009 +index 355ebae883c1a..90827c386b5bc 100644
6010 +--- a/net/ipv4/tcp_output.c
6011 ++++ b/net/ipv4/tcp_output.c
6012 +@@ -1620,7 +1620,8 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited)
6013 + * window, and remember whether we were cwnd-limited then.
6014 + */
6015 + if (!before(tp->snd_una, tp->max_packets_seq) ||
6016 +- tp->packets_out > tp->max_packets_out) {
6017 ++ tp->packets_out > tp->max_packets_out ||
6018 ++ is_cwnd_limited) {
6019 + tp->max_packets_out = tp->packets_out;
6020 + tp->max_packets_seq = tp->snd_nxt;
6021 + tp->is_cwnd_limited = is_cwnd_limited;
6022 +@@ -2411,6 +2412,10 @@ repair:
6023 + else
6024 + tcp_chrono_stop(sk, TCP_CHRONO_RWND_LIMITED);
6025 +
6026 ++ is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd);
6027 ++ if (likely(sent_pkts || is_cwnd_limited))
6028 ++ tcp_cwnd_validate(sk, is_cwnd_limited);
6029 ++
6030 + if (likely(sent_pkts)) {
6031 + if (tcp_in_cwnd_reduction(sk))
6032 + tp->prr_out += sent_pkts;
6033 +@@ -2418,8 +2423,6 @@ repair:
6034 + /* Send one loss probe per tail loss episode. */
6035 + if (push_one != 2)
6036 + tcp_schedule_loss_probe(sk, false);
6037 +- is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd);
6038 +- tcp_cwnd_validate(sk, is_cwnd_limited);
6039 + return false;
6040 + }
6041 + return !tp->packets_out && tcp_send_head(sk);
6042 +diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
6043 +index 933f26e2ff8be..54d44836dd283 100644
6044 +--- a/net/mac80211/mesh_pathtbl.c
6045 ++++ b/net/mac80211/mesh_pathtbl.c
6046 +@@ -61,6 +61,7 @@ static struct mesh_table *mesh_table_alloc(void)
6047 + INIT_HLIST_HEAD(&newtbl->known_gates);
6048 + atomic_set(&newtbl->entries, 0);
6049 + spin_lock_init(&newtbl->gates_lock);
6050 ++ rhashtable_init(&newtbl->rhead, &mesh_rht_params);
6051 +
6052 + return newtbl;
6053 + }
6054 +@@ -851,9 +852,6 @@ int mesh_pathtbl_init(struct ieee80211_sub_if_data *sdata)
6055 + goto free_path;
6056 + }
6057 +
6058 +- rhashtable_init(&tbl_path->rhead, &mesh_rht_params);
6059 +- rhashtable_init(&tbl_mpp->rhead, &mesh_rht_params);
6060 +-
6061 + sdata->u.mesh.mesh_paths = tbl_path;
6062 + sdata->u.mesh.mpp_paths = tbl_mpp;
6063 +
6064 +diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
6065 +index b852c34bb6373..7b1213be3e81a 100644
6066 +--- a/net/sunrpc/xprt.c
6067 ++++ b/net/sunrpc/xprt.c
6068 +@@ -143,31 +143,64 @@ out:
6069 + }
6070 + EXPORT_SYMBOL_GPL(xprt_unregister_transport);
6071 +
6072 ++static void
6073 ++xprt_class_release(const struct xprt_class *t)
6074 ++{
6075 ++ module_put(t->owner);
6076 ++}
6077 ++
6078 ++static const struct xprt_class *
6079 ++xprt_class_find_by_netid_locked(const char *netid)
6080 ++{
6081 ++ const struct xprt_class *t;
6082 ++ unsigned int i;
6083 ++
6084 ++ list_for_each_entry(t, &xprt_list, list) {
6085 ++ for (i = 0; t->netid[i][0] != '\0'; i++) {
6086 ++ if (strcmp(t->netid[i], netid) != 0)
6087 ++ continue;
6088 ++ if (!try_module_get(t->owner))
6089 ++ continue;
6090 ++ return t;
6091 ++ }
6092 ++ }
6093 ++ return NULL;
6094 ++}
6095 ++
6096 ++static const struct xprt_class *
6097 ++xprt_class_find_by_netid(const char *netid)
6098 ++{
6099 ++ const struct xprt_class *t;
6100 ++
6101 ++ spin_lock(&xprt_list_lock);
6102 ++ t = xprt_class_find_by_netid_locked(netid);
6103 ++ if (!t) {
6104 ++ spin_unlock(&xprt_list_lock);
6105 ++ request_module("rpc%s", netid);
6106 ++ spin_lock(&xprt_list_lock);
6107 ++ t = xprt_class_find_by_netid_locked(netid);
6108 ++ }
6109 ++ spin_unlock(&xprt_list_lock);
6110 ++ return t;
6111 ++}
6112 ++
6113 + /**
6114 + * xprt_load_transport - load a transport implementation
6115 +- * @transport_name: transport to load
6116 ++ * @netid: transport to load
6117 + *
6118 + * Returns:
6119 + * 0: transport successfully loaded
6120 + * -ENOENT: transport module not available
6121 + */
6122 +-int xprt_load_transport(const char *transport_name)
6123 ++int xprt_load_transport(const char *netid)
6124 + {
6125 +- struct xprt_class *t;
6126 +- int result;
6127 ++ const struct xprt_class *t;
6128 +
6129 +- result = 0;
6130 +- spin_lock(&xprt_list_lock);
6131 +- list_for_each_entry(t, &xprt_list, list) {
6132 +- if (strcmp(t->name, transport_name) == 0) {
6133 +- spin_unlock(&xprt_list_lock);
6134 +- goto out;
6135 +- }
6136 +- }
6137 +- spin_unlock(&xprt_list_lock);
6138 +- result = request_module("xprt%s", transport_name);
6139 +-out:
6140 +- return result;
6141 ++ t = xprt_class_find_by_netid(netid);
6142 ++ if (!t)
6143 ++ return -ENOENT;
6144 ++ xprt_class_release(t);
6145 ++ return 0;
6146 + }
6147 + EXPORT_SYMBOL_GPL(xprt_load_transport);
6148 +
6149 +diff --git a/net/sunrpc/xprtrdma/module.c b/net/sunrpc/xprtrdma/module.c
6150 +index 560712bd9fa2c..dd227de31a589 100644
6151 +--- a/net/sunrpc/xprtrdma/module.c
6152 ++++ b/net/sunrpc/xprtrdma/module.c
6153 +@@ -19,6 +19,7 @@ MODULE_DESCRIPTION("RPC/RDMA Transport");
6154 + MODULE_LICENSE("Dual BSD/GPL");
6155 + MODULE_ALIAS("svcrdma");
6156 + MODULE_ALIAS("xprtrdma");
6157 ++MODULE_ALIAS("rpcrdma6");
6158 +
6159 + static void __exit rpc_rdma_cleanup(void)
6160 + {
6161 +diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
6162 +index b1b40a1be8c57..ead20e6754ab7 100644
6163 +--- a/net/sunrpc/xprtrdma/transport.c
6164 ++++ b/net/sunrpc/xprtrdma/transport.c
6165 +@@ -849,6 +849,7 @@ static struct xprt_class xprt_rdma = {
6166 + .owner = THIS_MODULE,
6167 + .ident = XPRT_TRANSPORT_RDMA,
6168 + .setup = xprt_setup_rdma,
6169 ++ .netid = { "rdma", "rdma6", "" },
6170 + };
6171 +
6172 + void xprt_rdma_cleanup(void)
6173 +diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
6174 +index f75b5b7c1fc2a..5124a21ecfa39 100644
6175 +--- a/net/sunrpc/xprtsock.c
6176 ++++ b/net/sunrpc/xprtsock.c
6177 +@@ -3208,6 +3208,7 @@ static struct xprt_class xs_local_transport = {
6178 + .owner = THIS_MODULE,
6179 + .ident = XPRT_TRANSPORT_LOCAL,
6180 + .setup = xs_setup_local,
6181 ++ .netid = { "" },
6182 + };
6183 +
6184 + static struct xprt_class xs_udp_transport = {
6185 +@@ -3216,6 +3217,7 @@ static struct xprt_class xs_udp_transport = {
6186 + .owner = THIS_MODULE,
6187 + .ident = XPRT_TRANSPORT_UDP,
6188 + .setup = xs_setup_udp,
6189 ++ .netid = { "udp", "udp6", "" },
6190 + };
6191 +
6192 + static struct xprt_class xs_tcp_transport = {
6193 +@@ -3224,6 +3226,7 @@ static struct xprt_class xs_tcp_transport = {
6194 + .owner = THIS_MODULE,
6195 + .ident = XPRT_TRANSPORT_TCP,
6196 + .setup = xs_setup_tcp,
6197 ++ .netid = { "tcp", "tcp6", "" },
6198 + };
6199 +
6200 + static struct xprt_class xs_bc_tcp_transport = {
6201 +@@ -3232,6 +3235,7 @@ static struct xprt_class xs_bc_tcp_transport = {
6202 + .owner = THIS_MODULE,
6203 + .ident = XPRT_TRANSPORT_BC_TCP,
6204 + .setup = xs_setup_bc_tcp,
6205 ++ .netid = { "" },
6206 + };
6207 +
6208 + /**
6209 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
6210 +index 6bd4f6c8fc2ef..f630fa2e31647 100644
6211 +--- a/net/wireless/nl80211.c
6212 ++++ b/net/wireless/nl80211.c
6213 +@@ -10969,7 +10969,7 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)
6214 + struct net_device *dev = info->user_ptr[1];
6215 + struct wireless_dev *wdev = dev->ieee80211_ptr;
6216 + struct nlattr *tb[NUM_NL80211_REKEY_DATA];
6217 +- struct cfg80211_gtk_rekey_data rekey_data;
6218 ++ struct cfg80211_gtk_rekey_data rekey_data = {};
6219 + int err;
6220 +
6221 + if (!info->attrs[NL80211_ATTR_REKEY_DATA])
6222 +diff --git a/samples/bpf/lwt_len_hist.sh b/samples/bpf/lwt_len_hist.sh
6223 +old mode 100644
6224 +new mode 100755
6225 +index 090b96eaf7f76..0eda9754f50b8
6226 +--- a/samples/bpf/lwt_len_hist.sh
6227 ++++ b/samples/bpf/lwt_len_hist.sh
6228 +@@ -8,6 +8,8 @@ VETH1=tst_lwt1b
6229 + TRACE_ROOT=/sys/kernel/debug/tracing
6230 +
6231 + function cleanup {
6232 ++ # To reset saved histogram, remove pinned map
6233 ++ rm /sys/fs/bpf/tc/globals/lwt_len_hist_map
6234 + ip route del 192.168.253.2/32 dev $VETH0 2> /dev/null
6235 + ip link del $VETH0 2> /dev/null
6236 + ip link del $VETH1 2> /dev/null
6237 +diff --git a/samples/bpf/test_lwt_bpf.sh b/samples/bpf/test_lwt_bpf.sh
6238 +old mode 100644
6239 +new mode 100755
6240 +diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
6241 +index d702bdf19eb10..0f24a6f3af995 100755
6242 +--- a/scripts/checkpatch.pl
6243 ++++ b/scripts/checkpatch.pl
6244 +@@ -3898,7 +3898,7 @@ sub process {
6245 + $fix) {
6246 + fix_delete_line($fixlinenr, $rawline);
6247 + my $fixed_line = $rawline;
6248 +- $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/;
6249 ++ $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*)\{(.*)$/;
6250 + my $line1 = $1;
6251 + my $line2 = $2;
6252 + fix_insert_line($fixlinenr, ltrim($line1));
6253 +diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c
6254 +index 2c8fd4e907009..1b61dbb3a319d 100644
6255 +--- a/security/integrity/ima/ima_crypto.c
6256 ++++ b/security/integrity/ima/ima_crypto.c
6257 +@@ -432,7 +432,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
6258 + loff_t i_size;
6259 + int rc;
6260 + struct file *f = file;
6261 +- bool new_file_instance = false, modified_mode = false;
6262 ++ bool new_file_instance = false;
6263 +
6264 + /*
6265 + * For consistency, fail file's opened with the O_DIRECT flag on
6266 +@@ -450,18 +450,10 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
6267 + O_TRUNC | O_CREAT | O_NOCTTY | O_EXCL);
6268 + flags |= O_RDONLY;
6269 + f = dentry_open(&file->f_path, flags, file->f_cred);
6270 +- if (IS_ERR(f)) {
6271 +- /*
6272 +- * Cannot open the file again, lets modify f_mode
6273 +- * of original and continue
6274 +- */
6275 +- pr_info_ratelimited("Unable to reopen file for reading.\n");
6276 +- f = file;
6277 +- f->f_mode |= FMODE_READ;
6278 +- modified_mode = true;
6279 +- } else {
6280 +- new_file_instance = true;
6281 +- }
6282 ++ if (IS_ERR(f))
6283 ++ return PTR_ERR(f);
6284 ++
6285 ++ new_file_instance = true;
6286 + }
6287 +
6288 + i_size = i_size_read(file_inode(f));
6289 +@@ -476,8 +468,6 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
6290 + out:
6291 + if (new_file_instance)
6292 + fput(f);
6293 +- else if (modified_mode)
6294 +- f->f_mode &= ~FMODE_READ;
6295 + return rc;
6296 + }
6297 +
6298 +diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
6299 +index 5def19ec11797..895d369bc4103 100644
6300 +--- a/security/selinux/hooks.c
6301 ++++ b/security/selinux/hooks.c
6302 +@@ -1569,7 +1569,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
6303 + * inode_doinit with a dentry, before these inodes could
6304 + * be used again by userspace.
6305 + */
6306 +- goto out;
6307 ++ goto out_invalid;
6308 + }
6309 +
6310 + len = INITCONTEXTLEN;
6311 +@@ -1678,7 +1678,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
6312 + * could be used again by userspace.
6313 + */
6314 + if (!dentry)
6315 +- goto out;
6316 ++ goto out_invalid;
6317 + rc = selinux_genfs_get_sid(dentry, sclass,
6318 + sbsec->flags, &sid);
6319 + dput(dentry);
6320 +@@ -1691,11 +1691,10 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
6321 + out:
6322 + spin_lock(&isec->lock);
6323 + if (isec->initialized == LABEL_PENDING) {
6324 +- if (!sid || rc) {
6325 ++ if (rc) {
6326 + isec->initialized = LABEL_INVALID;
6327 + goto out_unlock;
6328 + }
6329 +-
6330 + isec->initialized = LABEL_INITIALIZED;
6331 + isec->sid = sid;
6332 + }
6333 +@@ -1703,6 +1702,15 @@ out:
6334 + out_unlock:
6335 + spin_unlock(&isec->lock);
6336 + return rc;
6337 ++
6338 ++out_invalid:
6339 ++ spin_lock(&isec->lock);
6340 ++ if (isec->initialized == LABEL_PENDING) {
6341 ++ isec->initialized = LABEL_INVALID;
6342 ++ isec->sid = sid;
6343 ++ }
6344 ++ spin_unlock(&isec->lock);
6345 ++ return 0;
6346 + }
6347 +
6348 + /* Convert a Linux signal to an access vector. */
6349 +diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
6350 +index bb0ab0f6ce9df..f855c40b05677 100644
6351 +--- a/sound/core/oss/pcm_oss.c
6352 ++++ b/sound/core/oss/pcm_oss.c
6353 +@@ -708,6 +708,8 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
6354 +
6355 + oss_buffer_size = snd_pcm_plug_client_size(substream,
6356 + snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, NULL)) * oss_frame_size;
6357 ++ if (!oss_buffer_size)
6358 ++ return -EINVAL;
6359 + oss_buffer_size = rounddown_pow_of_two(oss_buffer_size);
6360 + if (atomic_read(&substream->mmap_count)) {
6361 + if (oss_buffer_size > runtime->oss.mmap_bytes)
6362 +@@ -743,17 +745,21 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
6363 +
6364 + min_period_size = snd_pcm_plug_client_size(substream,
6365 + snd_pcm_hw_param_value_min(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
6366 +- min_period_size *= oss_frame_size;
6367 +- min_period_size = roundup_pow_of_two(min_period_size);
6368 +- if (oss_period_size < min_period_size)
6369 +- oss_period_size = min_period_size;
6370 ++ if (min_period_size) {
6371 ++ min_period_size *= oss_frame_size;
6372 ++ min_period_size = roundup_pow_of_two(min_period_size);
6373 ++ if (oss_period_size < min_period_size)
6374 ++ oss_period_size = min_period_size;
6375 ++ }
6376 +
6377 + max_period_size = snd_pcm_plug_client_size(substream,
6378 + snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
6379 +- max_period_size *= oss_frame_size;
6380 +- max_period_size = rounddown_pow_of_two(max_period_size);
6381 +- if (oss_period_size > max_period_size)
6382 +- oss_period_size = max_period_size;
6383 ++ if (max_period_size) {
6384 ++ max_period_size *= oss_frame_size;
6385 ++ max_period_size = rounddown_pow_of_two(max_period_size);
6386 ++ if (oss_period_size > max_period_size)
6387 ++ oss_period_size = max_period_size;
6388 ++ }
6389 +
6390 + oss_periods = oss_buffer_size / oss_period_size;
6391 +
6392 +@@ -1949,11 +1955,15 @@ static int snd_pcm_oss_set_subdivide(struct snd_pcm_oss_file *pcm_oss_file, int
6393 + static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val)
6394 + {
6395 + struct snd_pcm_runtime *runtime;
6396 ++ int fragshift;
6397 +
6398 + runtime = substream->runtime;
6399 + if (runtime->oss.subdivision || runtime->oss.fragshift)
6400 + return -EINVAL;
6401 +- runtime->oss.fragshift = val & 0xffff;
6402 ++ fragshift = val & 0xffff;
6403 ++ if (fragshift >= 31)
6404 ++ return -EINVAL;
6405 ++ runtime->oss.fragshift = fragshift;
6406 + runtime->oss.maxfrags = (val >> 16) & 0xffff;
6407 + if (runtime->oss.fragshift < 4) /* < 16 */
6408 + runtime->oss.fragshift = 4;
6409 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
6410 +index 331a62b859876..a18be8394715e 100644
6411 +--- a/sound/pci/hda/patch_realtek.c
6412 ++++ b/sound/pci/hda/patch_realtek.c
6413 +@@ -6590,6 +6590,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6414 + SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
6415 + SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6416 + SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
6417 ++ SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6418 + SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
6419 + SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
6420 + SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6421 +diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c
6422 +index 49401a8aae64a..19c963801e264 100644
6423 +--- a/sound/soc/codecs/wm8997.c
6424 ++++ b/sound/soc/codecs/wm8997.c
6425 +@@ -1179,6 +1179,8 @@ static int wm8997_probe(struct platform_device *pdev)
6426 + goto err_spk_irqs;
6427 + }
6428 +
6429 ++ return ret;
6430 ++
6431 + err_spk_irqs:
6432 + arizona_free_spk_irqs(arizona);
6433 +
6434 +diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c
6435 +index 44f447136e224..a94e0aeb2e198 100644
6436 +--- a/sound/soc/codecs/wm8998.c
6437 ++++ b/sound/soc/codecs/wm8998.c
6438 +@@ -1425,7 +1425,7 @@ static int wm8998_probe(struct platform_device *pdev)
6439 +
6440 + ret = arizona_init_spk_irqs(arizona);
6441 + if (ret < 0)
6442 +- return ret;
6443 ++ goto err_pm_disable;
6444 +
6445 + ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8998,
6446 + wm8998_dai, ARRAY_SIZE(wm8998_dai));
6447 +@@ -1438,6 +1438,8 @@ static int wm8998_probe(struct platform_device *pdev)
6448 +
6449 + err_spk_irqs:
6450 + arizona_free_spk_irqs(arizona);
6451 ++err_pm_disable:
6452 ++ pm_runtime_disable(&pdev->dev);
6453 +
6454 + return ret;
6455 + }
6456 +diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
6457 +index 158ce68bc9bf3..1516252aa0a53 100644
6458 +--- a/sound/soc/codecs/wm_adsp.c
6459 ++++ b/sound/soc/codecs/wm_adsp.c
6460 +@@ -1391,7 +1391,7 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
6461 + ctl_work = kzalloc(sizeof(*ctl_work), GFP_KERNEL);
6462 + if (!ctl_work) {
6463 + ret = -ENOMEM;
6464 +- goto err_ctl_cache;
6465 ++ goto err_list_del;
6466 + }
6467 +
6468 + ctl_work->dsp = dsp;
6469 +@@ -1401,7 +1401,8 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
6470 +
6471 + return 0;
6472 +
6473 +-err_ctl_cache:
6474 ++err_list_del:
6475 ++ list_del(&ctl->list);
6476 + kfree(ctl->cache);
6477 + err_ctl_name:
6478 + kfree(ctl->name);
6479 +diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c
6480 +index e099c0505b765..2c6b0ac97c684 100644
6481 +--- a/sound/soc/jz4740/jz4740-i2s.c
6482 ++++ b/sound/soc/jz4740/jz4740-i2s.c
6483 +@@ -318,10 +318,14 @@ static int jz4740_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id,
6484 + switch (clk_id) {
6485 + case JZ4740_I2S_CLKSRC_EXT:
6486 + parent = clk_get(NULL, "ext");
6487 ++ if (IS_ERR(parent))
6488 ++ return PTR_ERR(parent);
6489 + clk_set_parent(i2s->clk_i2s, parent);
6490 + break;
6491 + case JZ4740_I2S_CLKSRC_PLL:
6492 + parent = clk_get(NULL, "pll half");
6493 ++ if (IS_ERR(parent))
6494 ++ return PTR_ERR(parent);
6495 + clk_set_parent(i2s->clk_i2s, parent);
6496 + ret = clk_set_rate(i2s->clk_i2s, freq);
6497 + break;
6498 +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
6499 +index fd4b71729eedd..e995e96ab9030 100644
6500 +--- a/sound/soc/soc-pcm.c
6501 ++++ b/sound/soc/soc-pcm.c
6502 +@@ -2172,6 +2172,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
6503 + case SNDRV_PCM_TRIGGER_START:
6504 + case SNDRV_PCM_TRIGGER_RESUME:
6505 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
6506 ++ case SNDRV_PCM_TRIGGER_DRAIN:
6507 + ret = dpcm_dai_trigger_fe_be(substream, cmd, true);
6508 + break;
6509 + case SNDRV_PCM_TRIGGER_STOP:
6510 +@@ -2189,6 +2190,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
6511 + case SNDRV_PCM_TRIGGER_START:
6512 + case SNDRV_PCM_TRIGGER_RESUME:
6513 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
6514 ++ case SNDRV_PCM_TRIGGER_DRAIN:
6515 + ret = dpcm_dai_trigger_fe_be(substream, cmd, false);
6516 + break;
6517 + case SNDRV_PCM_TRIGGER_STOP:
6518 +diff --git a/sound/usb/clock.c b/sound/usb/clock.c
6519 +index eb3396ffba4c4..70e74895b1136 100644
6520 +--- a/sound/usb/clock.c
6521 ++++ b/sound/usb/clock.c
6522 +@@ -327,6 +327,12 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
6523 + }
6524 +
6525 + crate = data[0] | (data[1] << 8) | (data[2] << 16);
6526 ++ if (!crate) {
6527 ++ dev_info(&dev->dev, "failed to read current rate; disabling the check\n");
6528 ++ chip->sample_rate_read_error = 3; /* three strikes, see above */
6529 ++ return 0;
6530 ++ }
6531 ++
6532 + if (crate != rate) {
6533 + dev_warn(&dev->dev, "current rate %d is different from the runtime rate %d\n", crate, rate);
6534 + // runtime->rate = crate;
6535 +diff --git a/sound/usb/format.c b/sound/usb/format.c
6536 +index eeb56d6fe8aa8..06190e3fd9194 100644
6537 +--- a/sound/usb/format.c
6538 ++++ b/sound/usb/format.c
6539 +@@ -52,6 +52,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
6540 + case UAC_VERSION_1:
6541 + default: {
6542 + struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
6543 ++ if (format >= 64)
6544 ++ return 0; /* invalid format */
6545 + sample_width = fmt->bBitResolution;
6546 + sample_bytes = fmt->bSubframeSize;
6547 + format = 1 << format;
6548 +diff --git a/sound/usb/stream.c b/sound/usb/stream.c
6549 +index 452646959586e..7b86bf38f10e7 100644
6550 +--- a/sound/usb/stream.c
6551 ++++ b/sound/usb/stream.c
6552 +@@ -185,16 +185,16 @@ static int usb_chmap_ctl_get(struct snd_kcontrol *kcontrol,
6553 + struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
6554 + struct snd_usb_substream *subs = info->private_data;
6555 + struct snd_pcm_chmap_elem *chmap = NULL;
6556 +- int i;
6557 ++ int i = 0;
6558 +
6559 +- memset(ucontrol->value.integer.value, 0,
6560 +- sizeof(ucontrol->value.integer.value));
6561 + if (subs->cur_audiofmt)
6562 + chmap = subs->cur_audiofmt->chmap;
6563 + if (chmap) {
6564 + for (i = 0; i < chmap->channels; i++)
6565 + ucontrol->value.integer.value[i] = chmap->map[i];
6566 + }
6567 ++ for (; i < subs->channels_max; i++)
6568 ++ ucontrol->value.integer.value[i] = 0;
6569 + return 0;
6570 + }
6571 +
6572 +diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c
6573 +index e6599e290f467..e5ad120e7f69a 100644
6574 +--- a/tools/perf/util/parse-regs-options.c
6575 ++++ b/tools/perf/util/parse-regs-options.c
6576 +@@ -41,7 +41,7 @@ parse_regs(const struct option *opt, const char *str, int unset)
6577 + }
6578 + fputc('\n', stderr);
6579 + /* just printing available regs */
6580 +- return -1;
6581 ++ goto error;
6582 + }
6583 + for (r = sample_reg_masks; r->name; r++) {
6584 + if (!strcasecmp(s, r->name))