Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Tue, 29 Dec 2020 14:18:19
Message-Id: 1609251484.8e8845458748f3c71dfebb46ce53bd6305b2f034.mpagano@gentoo
1 commit: 8e8845458748f3c71dfebb46ce53bd6305b2f034
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Tue Dec 29 14:18:04 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 29 14:18:04 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=8e884545
7
8 Linux patch 4.9.249
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1248_linux-4.9.249.patch | 4035 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 4039 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index e3ccddb..bfcfe3d 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -1035,6 +1035,10 @@ Patch: 1247_linux-4.9.248.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.9.248
23
24 +Patch: 1248_linux-4.9.249.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.9.249
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/1248_linux-4.9.249.patch b/1248_linux-4.9.249.patch
33 new file mode 100644
34 index 0000000..aaa2e55
35 --- /dev/null
36 +++ b/1248_linux-4.9.249.patch
37 @@ -0,0 +1,4035 @@
38 +diff --git a/Makefile b/Makefile
39 +index f6680569c0008..ef1c9929cdcc7 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 9
45 +-SUBLEVEL = 248
46 ++SUBLEVEL = 249
47 + EXTRAVERSION =
48 + NAME = Roaring Lionus
49 +
50 +diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c
51 +index 165158735aa6b..3ee19b1e79be5 100644
52 +--- a/arch/arc/kernel/stacktrace.c
53 ++++ b/arch/arc/kernel/stacktrace.c
54 +@@ -39,15 +39,15 @@
55 +
56 + #ifdef CONFIG_ARC_DW2_UNWIND
57 +
58 +-static void seed_unwind_frame_info(struct task_struct *tsk,
59 +- struct pt_regs *regs,
60 +- struct unwind_frame_info *frame_info)
61 ++static int
62 ++seed_unwind_frame_info(struct task_struct *tsk, struct pt_regs *regs,
63 ++ struct unwind_frame_info *frame_info)
64 + {
65 + /*
66 + * synchronous unwinding (e.g. dump_stack)
67 + * - uses current values of SP and friends
68 + */
69 +- if (tsk == NULL && regs == NULL) {
70 ++ if (regs == NULL && (tsk == NULL || tsk == current)) {
71 + unsigned long fp, sp, blink, ret;
72 + frame_info->task = current;
73 +
74 +@@ -66,11 +66,15 @@ static void seed_unwind_frame_info(struct task_struct *tsk,
75 + frame_info->call_frame = 0;
76 + } else if (regs == NULL) {
77 + /*
78 +- * Asynchronous unwinding of sleeping task
79 +- * - Gets SP etc from task's pt_regs (saved bottom of kernel
80 +- * mode stack of task)
81 ++ * Asynchronous unwinding of a likely sleeping task
82 ++ * - first ensure it is actually sleeping
83 ++ * - if so, it will be in __switch_to, kernel mode SP of task
84 ++ * is safe-kept and BLINK at a well known location in there
85 + */
86 +
87 ++ if (tsk->state == TASK_RUNNING)
88 ++ return -1;
89 ++
90 + frame_info->task = tsk;
91 +
92 + frame_info->regs.r27 = TSK_K_FP(tsk);
93 +@@ -104,6 +108,8 @@ static void seed_unwind_frame_info(struct task_struct *tsk,
94 + frame_info->regs.r63 = regs->ret;
95 + frame_info->call_frame = 0;
96 + }
97 ++
98 ++ return 0;
99 + }
100 +
101 + #endif
102 +@@ -117,7 +123,8 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
103 + unsigned int address;
104 + struct unwind_frame_info frame_info;
105 +
106 +- seed_unwind_frame_info(tsk, regs, &frame_info);
107 ++ if (seed_unwind_frame_info(tsk, regs, &frame_info))
108 ++ return 0;
109 +
110 + while (1) {
111 + address = UNW_PC(&frame_info);
112 +diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
113 +index 5a53fcf542abb..07133c5ad2944 100644
114 +--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
115 ++++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
116 +@@ -231,6 +231,11 @@
117 + atmel,pins =
118 + <AT91_PIOE 9 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PE9, conflicts with A9 */
119 + };
120 ++ pinctrl_usb_default: usb_default {
121 ++ atmel,pins =
122 ++ <AT91_PIOE 3 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
123 ++ AT91_PIOE 4 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
124 ++ };
125 + };
126 + };
127 + };
128 +@@ -288,6 +293,8 @@
129 + &pioE 3 GPIO_ACTIVE_LOW
130 + &pioE 4 GPIO_ACTIVE_LOW
131 + >;
132 ++ pinctrl-names = "default";
133 ++ pinctrl-0 = <&pinctrl_usb_default>;
134 + status = "okay";
135 + };
136 +
137 +diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
138 +index 44d1171c7fc04..4ce8656293837 100644
139 +--- a/arch/arm/boot/dts/at91-sama5d4_xplained.dts
140 ++++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
141 +@@ -152,6 +152,11 @@
142 + atmel,pins =
143 + <AT91_PIOE 31 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>;
144 + };
145 ++ pinctrl_usb_default: usb_default {
146 ++ atmel,pins =
147 ++ <AT91_PIOE 11 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
148 ++ AT91_PIOE 14 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
149 ++ };
150 + pinctrl_key_gpio: key_gpio_0 {
151 + atmel,pins =
152 + <AT91_PIOE 8 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
153 +@@ -177,6 +182,8 @@
154 + &pioE 11 GPIO_ACTIVE_HIGH
155 + &pioE 14 GPIO_ACTIVE_HIGH
156 + >;
157 ++ pinctrl-names = "default";
158 ++ pinctrl-0 = <&pinctrl_usb_default>;
159 + status = "okay";
160 + };
161 +
162 +diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi b/arch/arm/boot/dts/at91sam9rl.dtsi
163 +index 70adf940d98c0..620aa3f555f8a 100644
164 +--- a/arch/arm/boot/dts/at91sam9rl.dtsi
165 ++++ b/arch/arm/boot/dts/at91sam9rl.dtsi
166 +@@ -266,23 +266,26 @@
167 + atmel,adc-use-res = "highres";
168 +
169 + trigger0 {
170 +- trigger-name = "timer-counter-0";
171 ++ trigger-name = "external-rising";
172 + trigger-value = <0x1>;
173 ++ trigger-external;
174 + };
175 ++
176 + trigger1 {
177 +- trigger-name = "timer-counter-1";
178 +- trigger-value = <0x3>;
179 ++ trigger-name = "external-falling";
180 ++ trigger-value = <0x2>;
181 ++ trigger-external;
182 + };
183 +
184 + trigger2 {
185 +- trigger-name = "timer-counter-2";
186 +- trigger-value = <0x5>;
187 ++ trigger-name = "external-any";
188 ++ trigger-value = <0x3>;
189 ++ trigger-external;
190 + };
191 +
192 + trigger3 {
193 +- trigger-name = "external";
194 +- trigger-value = <0x13>;
195 +- trigger-external;
196 ++ trigger-name = "continuous";
197 ++ trigger-value = <0x6>;
198 + };
199 + };
200 +
201 +diff --git a/arch/arm/boot/dts/exynos5410-odroidxu.dts b/arch/arm/boot/dts/exynos5410-odroidxu.dts
202 +index 3c271cb4b2be3..a2f94cb2ded8e 100644
203 +--- a/arch/arm/boot/dts/exynos5410-odroidxu.dts
204 ++++ b/arch/arm/boot/dts/exynos5410-odroidxu.dts
205 +@@ -271,6 +271,8 @@
206 + regulator-name = "vddq_lcd";
207 + regulator-min-microvolt = <1800000>;
208 + regulator-max-microvolt = <1800000>;
209 ++ /* Supplies also GPK and GPJ */
210 ++ regulator-always-on;
211 + };
212 +
213 + ldo8_reg: LDO8 {
214 +@@ -560,11 +562,11 @@
215 + };
216 +
217 + &usbdrd_dwc3_0 {
218 +- dr_mode = "host";
219 ++ dr_mode = "peripheral";
220 + };
221 +
222 + &usbdrd_dwc3_1 {
223 +- dr_mode = "peripheral";
224 ++ dr_mode = "host";
225 + };
226 +
227 + &usbdrd3_0 {
228 +diff --git a/arch/arm/boot/dts/exynos5410-pinctrl.dtsi b/arch/arm/boot/dts/exynos5410-pinctrl.dtsi
229 +index a083d23fdee30..872096edd77fd 100644
230 +--- a/arch/arm/boot/dts/exynos5410-pinctrl.dtsi
231 ++++ b/arch/arm/boot/dts/exynos5410-pinctrl.dtsi
232 +@@ -563,6 +563,34 @@
233 + interrupt-controller;
234 + #interrupt-cells = <2>;
235 + };
236 ++
237 ++ usb3_1_oc: usb3-1-oc {
238 ++ samsung,pins = "gpk2-4", "gpk2-5";
239 ++ samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
240 ++ samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
241 ++ samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
242 ++ };
243 ++
244 ++ usb3_1_vbusctrl: usb3-1-vbusctrl {
245 ++ samsung,pins = "gpk2-6", "gpk2-7";
246 ++ samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
247 ++ samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
248 ++ samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
249 ++ };
250 ++
251 ++ usb3_0_oc: usb3-0-oc {
252 ++ samsung,pins = "gpk3-0", "gpk3-1";
253 ++ samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
254 ++ samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
255 ++ samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
256 ++ };
257 ++
258 ++ usb3_0_vbusctrl: usb3-0-vbusctrl {
259 ++ samsung,pins = "gpk3-2", "gpk3-3";
260 ++ samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
261 ++ samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
262 ++ samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
263 ++ };
264 + };
265 +
266 + &pinctrl_2 {
267 +diff --git a/arch/arm/boot/dts/exynos5410.dtsi b/arch/arm/boot/dts/exynos5410.dtsi
268 +index bb59fee072c0a..132b830524392 100644
269 +--- a/arch/arm/boot/dts/exynos5410.dtsi
270 ++++ b/arch/arm/boot/dts/exynos5410.dtsi
271 +@@ -314,6 +314,8 @@
272 + &usbdrd3_0 {
273 + clocks = <&clock CLK_USBD300>;
274 + clock-names = "usbdrd30";
275 ++ pinctrl-names = "default";
276 ++ pinctrl-0 = <&usb3_0_oc>, <&usb3_0_vbusctrl>;
277 + };
278 +
279 + &usbdrd_phy0 {
280 +@@ -325,6 +327,8 @@
281 + &usbdrd3_1 {
282 + clocks = <&clock CLK_USBD301>;
283 + clock-names = "usbdrd30";
284 ++ pinctrl-names = "default";
285 ++ pinctrl-0 = <&usb3_1_oc>, <&usb3_1_vbusctrl>;
286 + };
287 +
288 + &usbdrd_dwc3_1 {
289 +diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
290 +index 04286fd9e09ce..2e336acd68b0a 100644
291 +--- a/arch/arm/kernel/head.S
292 ++++ b/arch/arm/kernel/head.S
293 +@@ -673,12 +673,8 @@ ARM_BE8(rev16 ip, ip)
294 + ldrcc r7, [r4], #4 @ use branch for delay slot
295 + bcc 1b
296 + bx lr
297 +-#else
298 +-#ifdef CONFIG_CPU_ENDIAN_BE8
299 +- moveq r0, #0x00004000 @ set bit 22, mov to mvn instruction
300 + #else
301 + moveq r0, #0x400000 @ set bit 22, mov to mvn instruction
302 +-#endif
303 + b 2f
304 + 1: ldr ip, [r7, r3]
305 + #ifdef CONFIG_CPU_ENDIAN_BE8
306 +@@ -687,7 +683,7 @@ ARM_BE8(rev16 ip, ip)
307 + tst ip, #0x000f0000 @ check the rotation field
308 + orrne ip, ip, r6, lsl #24 @ mask in offset bits 31-24
309 + biceq ip, ip, #0x00004000 @ clear bit 22
310 +- orreq ip, ip, r0 @ mask in offset bits 7-0
311 ++ orreq ip, ip, r0, ror #8 @ mask in offset bits 7-0
312 + #else
313 + bic ip, ip, #0x000000ff
314 + tst ip, #0xf00 @ check the rotation field
315 +diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi
316 +index 6328a66ed97e4..4c7c40ce50662 100644
317 +--- a/arch/arm64/boot/dts/exynos/exynos7.dtsi
318 ++++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi
319 +@@ -65,8 +65,10 @@
320 + };
321 +
322 + psci {
323 +- compatible = "arm,psci-0.2";
324 ++ compatible = "arm,psci";
325 + method = "smc";
326 ++ cpu_off = <0x84000002>;
327 ++ cpu_on = <0xC4000003>;
328 + };
329 +
330 + soc: soc {
331 +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
332 +index 7afbfb0f96a3c..dd211dbdaaae0 100644
333 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
334 ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
335 +@@ -65,6 +65,9 @@
336 + i2c6 = &i2c6;
337 + i2c7 = &i2c7;
338 + i2c8 = &i2c8;
339 ++ mmc0 = &sdio0;
340 ++ mmc1 = &sdmmc;
341 ++ mmc2 = &sdhci;
342 + serial0 = &uart0;
343 + serial1 = &uart1;
344 + serial2 = &uart2;
345 +diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
346 +index 86c0ef23157c2..a152a7bbc85ab 100644
347 +--- a/arch/arm64/include/asm/kvm_host.h
348 ++++ b/arch/arm64/include/asm/kvm_host.h
349 +@@ -161,6 +161,7 @@ enum vcpu_sysreg {
350 + #define c2_TTBR1 (TTBR1_EL1 * 2) /* Translation Table Base Register 1 */
351 + #define c2_TTBR1_high (c2_TTBR1 + 1) /* TTBR1 top 32 bits */
352 + #define c2_TTBCR (TCR_EL1 * 2) /* Translation Table Base Control R. */
353 ++#define c2_TTBCR2 (c2_TTBCR + 1) /* Translation Table Base Control R. 2 */
354 + #define c3_DACR (DACR32_EL2 * 2)/* Domain Access Control Register */
355 + #define c5_DFSR (ESR_EL1 * 2) /* Data Fault Status Register */
356 + #define c5_IFSR (IFSR32_EL2 * 2)/* Instruction Fault Status Register */
357 +diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
358 +index dce732f51e50e..0ad81fa13688f 100644
359 +--- a/arch/arm64/kvm/sys_regs.c
360 ++++ b/arch/arm64/kvm/sys_regs.c
361 +@@ -1315,6 +1315,7 @@ static const struct sys_reg_desc cp15_regs[] = {
362 + { Op1( 0), CRn( 2), CRm( 0), Op2( 0), access_vm_reg, NULL, c2_TTBR0 },
363 + { Op1( 0), CRn( 2), CRm( 0), Op2( 1), access_vm_reg, NULL, c2_TTBR1 },
364 + { Op1( 0), CRn( 2), CRm( 0), Op2( 2), access_vm_reg, NULL, c2_TTBCR },
365 ++ { Op1( 0), CRn( 2), CRm( 0), Op2( 3), access_vm_reg, NULL, c2_TTBCR2 },
366 + { Op1( 0), CRn( 3), CRm( 0), Op2( 0), access_vm_reg, NULL, c3_DACR },
367 + { Op1( 0), CRn( 5), CRm( 0), Op2( 0), access_vm_reg, NULL, c5_DFSR },
368 + { Op1( 0), CRn( 5), CRm( 0), Op2( 1), access_vm_reg, NULL, c5_IFSR },
369 +diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig
370 +index e970fd9cf7693..7ca7384fd5c9d 100644
371 +--- a/arch/mips/bcm47xx/Kconfig
372 ++++ b/arch/mips/bcm47xx/Kconfig
373 +@@ -26,6 +26,7 @@ config BCM47XX_BCMA
374 + select BCMA
375 + select BCMA_HOST_SOC
376 + select BCMA_DRIVER_MIPS
377 ++ select BCMA_DRIVER_PCI if PCI
378 + select BCMA_DRIVER_PCI_HOSTMODE if PCI
379 + select BCMA_DRIVER_GPIO
380 + default y
381 +diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
382 +index cf51aea47510c..090edefe125da 100644
383 +--- a/arch/powerpc/include/asm/cputable.h
384 ++++ b/arch/powerpc/include/asm/cputable.h
385 +@@ -419,7 +419,6 @@ enum {
386 + CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
387 + CPU_FTR_DEBUG_LVL_EXC | CPU_FTR_EMB_HV | CPU_FTR_ALTIVEC_COMP | \
388 + CPU_FTR_CELL_TB_BUG | CPU_FTR_SMT)
389 +-#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
390 +
391 + /* 64-bit CPUs */
392 + #define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
393 +@@ -510,8 +509,6 @@ enum {
394 + CPU_FTRS_7447 | CPU_FTRS_7447A | CPU_FTRS_82XX |
395 + CPU_FTRS_G2_LE | CPU_FTRS_E300 | CPU_FTRS_E300C2 |
396 + CPU_FTRS_CLASSIC32 |
397 +-#else
398 +- CPU_FTRS_GENERIC_32 |
399 + #endif
400 + #ifdef CONFIG_8xx
401 + CPU_FTRS_8XX |
402 +@@ -562,8 +559,6 @@ enum {
403 + CPU_FTRS_7447 & CPU_FTRS_7447A & CPU_FTRS_82XX &
404 + CPU_FTRS_G2_LE & CPU_FTRS_E300 & CPU_FTRS_E300C2 &
405 + CPU_FTRS_CLASSIC32 &
406 +-#else
407 +- CPU_FTRS_GENERIC_32 &
408 + #endif
409 + #ifdef CONFIG_8xx
410 + CPU_FTRS_8XX &
411 +diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
412 +index a10b67df83bae..1f1ac446ace9a 100644
413 +--- a/arch/powerpc/perf/core-book3s.c
414 ++++ b/arch/powerpc/perf/core-book3s.c
415 +@@ -2022,6 +2022,16 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
416 + local64_set(&event->hw.period_left, left);
417 + perf_event_update_userpage(event);
418 +
419 ++ /*
420 ++ * Due to hardware limitation, sometimes SIAR could sample a kernel
421 ++ * address even when freeze on supervisor state (kernel) is set in
422 ++ * MMCR2. Check attr.exclude_kernel and address to drop the sample in
423 ++ * these cases.
424 ++ */
425 ++ if (event->attr.exclude_kernel && record)
426 ++ if (is_kernel_addr(mfspr(SPRN_SIAR)))
427 ++ record = 0;
428 ++
429 + /*
430 + * Finally record data if requested.
431 + */
432 +diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
433 +index e76aefae2aa2b..0a0e0c8256f67 100644
434 +--- a/arch/powerpc/platforms/pseries/suspend.c
435 ++++ b/arch/powerpc/platforms/pseries/suspend.c
436 +@@ -224,7 +224,6 @@ static struct bus_type suspend_subsys = {
437 +
438 + static const struct platform_suspend_ops pseries_suspend_ops = {
439 + .valid = suspend_valid_only_mem,
440 +- .begin = pseries_suspend_begin,
441 + .prepare_late = pseries_prepare_late,
442 + .enter = pseries_suspend_enter,
443 + };
444 +diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c
445 +index d00123421e007..eefe1b94e0aad 100644
446 +--- a/arch/powerpc/xmon/nonstdio.c
447 ++++ b/arch/powerpc/xmon/nonstdio.c
448 +@@ -182,7 +182,7 @@ void xmon_printf(const char *format, ...)
449 +
450 + if (n && rc == 0) {
451 + /* No udbg hooks, fallback to printk() - dangerous */
452 +- printk("%s", xmon_outbuf);
453 ++ pr_cont("%s", xmon_outbuf);
454 + }
455 + }
456 +
457 +diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
458 +index 20e30be44795b..e3b422ebce09f 100644
459 +--- a/arch/um/drivers/xterm.c
460 ++++ b/arch/um/drivers/xterm.c
461 +@@ -18,6 +18,7 @@
462 + struct xterm_chan {
463 + int pid;
464 + int helper_pid;
465 ++ int chan_fd;
466 + char *title;
467 + int device;
468 + int raw;
469 +@@ -33,6 +34,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts)
470 + return NULL;
471 + *data = ((struct xterm_chan) { .pid = -1,
472 + .helper_pid = -1,
473 ++ .chan_fd = -1,
474 + .device = device,
475 + .title = opts->xterm_title,
476 + .raw = opts->raw } );
477 +@@ -149,6 +151,7 @@ static int xterm_open(int input, int output, int primary, void *d,
478 + goto out_kill;
479 + }
480 +
481 ++ data->chan_fd = fd;
482 + new = xterm_fd(fd, &data->helper_pid);
483 + if (new < 0) {
484 + err = new;
485 +@@ -206,6 +209,8 @@ static void xterm_close(int fd, void *d)
486 + os_kill_process(data->helper_pid, 0);
487 + data->helper_pid = -1;
488 +
489 ++ if (data->chan_fd != -1)
490 ++ os_close_file(data->chan_fd);
491 + os_close_file(fd);
492 + }
493 +
494 +diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
495 +index 86aec286e4f22..3da08881a0104 100644
496 +--- a/arch/x86/kernel/kprobes/core.c
497 ++++ b/arch/x86/kernel/kprobes/core.c
498 +@@ -1018,6 +1018,11 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
499 + * So clear it by resetting the current kprobe:
500 + */
501 + regs->flags &= ~X86_EFLAGS_TF;
502 ++ /*
503 ++ * Since the single step (trap) has been cancelled,
504 ++ * we need to restore BTF here.
505 ++ */
506 ++ restore_btf();
507 +
508 + /*
509 + * If the TF flag was set before the kprobe hit,
510 +diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
511 +index 67d97c0090a27..5d72baf60ac83 100644
512 +--- a/drivers/acpi/acpi_pnp.c
513 ++++ b/drivers/acpi/acpi_pnp.c
514 +@@ -320,6 +320,9 @@ static bool matching_id(const char *idstr, const char *list_id)
515 + {
516 + int i;
517 +
518 ++ if (strlen(idstr) != strlen(list_id))
519 ++ return false;
520 ++
521 + if (memcmp(idstr, list_id, 3))
522 + return false;
523 +
524 +diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
525 +index 56241eb341f4b..76cc11b3b49fb 100644
526 +--- a/drivers/acpi/resource.c
527 ++++ b/drivers/acpi/resource.c
528 +@@ -532,7 +532,7 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
529 + ret = c->preproc(ares, c->preproc_data);
530 + if (ret < 0) {
531 + c->error = ret;
532 +- return AE_CTRL_TERMINATE;
533 ++ return AE_ABORT_METHOD;
534 + } else if (ret > 0) {
535 + return AE_OK;
536 + }
537 +diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
538 +index 702ebfc4face5..9a4ac6fd262ac 100644
539 +--- a/drivers/block/xen-blkback/xenbus.c
540 ++++ b/drivers/block/xen-blkback/xenbus.c
541 +@@ -262,6 +262,7 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
542 +
543 + if (ring->xenblkd) {
544 + kthread_stop(ring->xenblkd);
545 ++ ring->xenblkd = NULL;
546 + wake_up(&ring->shutdown_wq);
547 + }
548 +
549 +diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c
550 +index 1b14256376d24..7c1da45be166e 100644
551 +--- a/drivers/bus/mips_cdmm.c
552 ++++ b/drivers/bus/mips_cdmm.c
553 +@@ -544,10 +544,8 @@ static void mips_cdmm_bus_discover(struct mips_cdmm_bus *bus)
554 + dev_set_name(&dev->dev, "cdmm%u-%u", cpu, id);
555 + ++id;
556 + ret = device_register(&dev->dev);
557 +- if (ret) {
558 ++ if (ret)
559 + put_device(&dev->dev);
560 +- kfree(dev);
561 +- }
562 + }
563 + }
564 +
565 +diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
566 +index f5d74e8db4327..1803af6230b27 100644
567 +--- a/drivers/clk/clk-s2mps11.c
568 ++++ b/drivers/clk/clk-s2mps11.c
569 +@@ -211,6 +211,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
570 + return ret;
571 +
572 + err_reg:
573 ++ of_node_put(s2mps11_clks[0].clk_np);
574 + while (--i >= 0)
575 + clkdev_drop(s2mps11_clks[i].lookup);
576 +
577 +diff --git a/drivers/clk/mvebu/armada-37xx-xtal.c b/drivers/clk/mvebu/armada-37xx-xtal.c
578 +index 612d65ede10a0..5370514959e15 100644
579 +--- a/drivers/clk/mvebu/armada-37xx-xtal.c
580 ++++ b/drivers/clk/mvebu/armada-37xx-xtal.c
581 +@@ -15,8 +15,8 @@
582 + #include <linux/platform_device.h>
583 + #include <linux/regmap.h>
584 +
585 +-#define NB_GPIO1_LATCH 0xC
586 +-#define XTAL_MODE BIT(31)
587 ++#define NB_GPIO1_LATCH 0x8
588 ++#define XTAL_MODE BIT(9)
589 +
590 + static int armada_3700_xtal_clock_probe(struct platform_device *pdev)
591 + {
592 +diff --git a/drivers/clk/tegra/clk-id.h b/drivers/clk/tegra/clk-id.h
593 +index 5738635c52741..9f8397c696e6c 100644
594 +--- a/drivers/clk/tegra/clk-id.h
595 ++++ b/drivers/clk/tegra/clk-id.h
596 +@@ -233,6 +233,7 @@ enum clk_id {
597 + tegra_clk_sdmmc4_8,
598 + tegra_clk_sdmmc4_9,
599 + tegra_clk_se,
600 ++ tegra_clk_se_10,
601 + tegra_clk_soc_therm,
602 + tegra_clk_soc_therm_8,
603 + tegra_clk_sor0,
604 +diff --git a/drivers/clk/tegra/clk-tegra-periph.c b/drivers/clk/tegra/clk-tegra-periph.c
605 +index d9c1f229c644b..bf88f90e6c438 100644
606 +--- a/drivers/clk/tegra/clk-tegra-periph.c
607 ++++ b/drivers/clk/tegra/clk-tegra-periph.c
608 +@@ -648,7 +648,7 @@ static struct tegra_periph_init_data periph_clks[] = {
609 + INT8("host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_8),
610 + INT8("host1x", mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_9),
611 + INT8("se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se),
612 +- INT8("se", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se),
613 ++ INT8("se", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se_10),
614 + INT8("2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, 0, tegra_clk_gr2d_8),
615 + INT8("3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, 0, tegra_clk_gr3d_8),
616 + INT8("vic03", mux_pllm_pllc_pllp_plla_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03),
617 +diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c
618 +index 66a0d0ed8b550..02ff499e36536 100644
619 +--- a/drivers/clk/ti/fapll.c
620 ++++ b/drivers/clk/ti/fapll.c
621 +@@ -497,6 +497,7 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd,
622 + {
623 + struct clk_init_data *init;
624 + struct fapll_synth *synth;
625 ++ struct clk *clk = ERR_PTR(-ENOMEM);
626 +
627 + init = kzalloc(sizeof(*init), GFP_KERNEL);
628 + if (!init)
629 +@@ -519,13 +520,19 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd,
630 + synth->hw.init = init;
631 + synth->clk_pll = pll_clk;
632 +
633 +- return clk_register(NULL, &synth->hw);
634 ++ clk = clk_register(NULL, &synth->hw);
635 ++ if (IS_ERR(clk)) {
636 ++ pr_err("failed to register clock\n");
637 ++ goto free;
638 ++ }
639 ++
640 ++ return clk;
641 +
642 + free:
643 + kfree(synth);
644 + kfree(init);
645 +
646 +- return ERR_PTR(-ENOMEM);
647 ++ return clk;
648 + }
649 +
650 + static void __init ti_fapll_setup(struct device_node *node)
651 +diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
652 +index a2503db7e533e..5d7f83d27093f 100644
653 +--- a/drivers/clocksource/arm_arch_timer.c
654 ++++ b/drivers/clocksource/arm_arch_timer.c
655 +@@ -426,15 +426,24 @@ static void arch_timer_evtstrm_enable(int divider)
656 +
657 + static void arch_timer_configure_evtstream(void)
658 + {
659 +- int evt_stream_div, pos;
660 ++ int evt_stream_div, lsb;
661 ++
662 ++ /*
663 ++ * As the event stream can at most be generated at half the frequency
664 ++ * of the counter, use half the frequency when computing the divider.
665 ++ */
666 ++ evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ / 2;
667 ++
668 ++ /*
669 ++ * Find the closest power of two to the divisor. If the adjacent bit
670 ++ * of lsb (last set bit, starts from 0) is set, then we use (lsb + 1).
671 ++ */
672 ++ lsb = fls(evt_stream_div) - 1;
673 ++ if (lsb > 0 && (evt_stream_div & BIT(lsb - 1)))
674 ++ lsb++;
675 +
676 +- /* Find the closest power of two to the divisor */
677 +- evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ;
678 +- pos = fls(evt_stream_div);
679 +- if (pos > 1 && !(evt_stream_div & (1 << (pos - 2))))
680 +- pos--;
681 + /* enable event stream */
682 +- arch_timer_evtstrm_enable(min(pos, 15));
683 ++ arch_timer_evtstrm_enable(max(0, min(lsb, 15)));
684 + }
685 +
686 + static void arch_counter_set_user_access(void)
687 +diff --git a/drivers/clocksource/cadence_ttc_timer.c b/drivers/clocksource/cadence_ttc_timer.c
688 +index fbfbdec13b081..7cddc54be96cc 100644
689 +--- a/drivers/clocksource/cadence_ttc_timer.c
690 ++++ b/drivers/clocksource/cadence_ttc_timer.c
691 +@@ -418,10 +418,8 @@ static int __init ttc_setup_clockevent(struct clk *clk,
692 + ttcce->ttc.clk = clk;
693 +
694 + err = clk_prepare_enable(ttcce->ttc.clk);
695 +- if (err) {
696 +- kfree(ttcce);
697 +- return err;
698 +- }
699 ++ if (err)
700 ++ goto out_kfree;
701 +
702 + ttcce->ttc.clk_rate_change_nb.notifier_call =
703 + ttc_rate_change_clockevent_cb;
704 +@@ -431,7 +429,7 @@ static int __init ttc_setup_clockevent(struct clk *clk,
705 + &ttcce->ttc.clk_rate_change_nb);
706 + if (err) {
707 + pr_warn("Unable to register clock notifier.\n");
708 +- return err;
709 ++ goto out_kfree;
710 + }
711 +
712 + ttcce->ttc.freq = clk_get_rate(ttcce->ttc.clk);
713 +@@ -460,15 +458,17 @@ static int __init ttc_setup_clockevent(struct clk *clk,
714 +
715 + err = request_irq(irq, ttc_clock_event_interrupt,
716 + IRQF_TIMER, ttcce->ce.name, ttcce);
717 +- if (err) {
718 +- kfree(ttcce);
719 +- return err;
720 +- }
721 ++ if (err)
722 ++ goto out_kfree;
723 +
724 + clockevents_config_and_register(&ttcce->ce,
725 + ttcce->ttc.freq / PRESCALE, 1, 0xfffe);
726 +
727 + return 0;
728 ++
729 ++out_kfree:
730 ++ kfree(ttcce);
731 ++ return err;
732 + }
733 +
734 + /**
735 +diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c
736 +index 1608f7105c9f8..ad743f2f31e78 100644
737 +--- a/drivers/cpufreq/highbank-cpufreq.c
738 ++++ b/drivers/cpufreq/highbank-cpufreq.c
739 +@@ -104,6 +104,13 @@ out_put_node:
740 + }
741 + module_init(hb_cpufreq_driver_init);
742 +
743 ++static const struct of_device_id __maybe_unused hb_cpufreq_of_match[] = {
744 ++ { .compatible = "calxeda,highbank" },
745 ++ { .compatible = "calxeda,ecx-2000" },
746 ++ { },
747 ++};
748 ++MODULE_DEVICE_TABLE(of, hb_cpufreq_of_match);
749 ++
750 + MODULE_AUTHOR("Mark Langsdorf <mark.langsdorf@×××××××.com>");
751 + MODULE_DESCRIPTION("Calxeda Highbank cpufreq driver");
752 + MODULE_LICENSE("GPL");
753 +diff --git a/drivers/cpufreq/loongson1-cpufreq.c b/drivers/cpufreq/loongson1-cpufreq.c
754 +index be89416e2358f..9d902f67f8716 100644
755 +--- a/drivers/cpufreq/loongson1-cpufreq.c
756 ++++ b/drivers/cpufreq/loongson1-cpufreq.c
757 +@@ -217,6 +217,7 @@ static struct platform_driver ls1x_cpufreq_platdrv = {
758 +
759 + module_platform_driver(ls1x_cpufreq_platdrv);
760 +
761 ++MODULE_ALIAS("platform:ls1x-cpufreq");
762 + MODULE_AUTHOR("Kelvin Cheung <keguang.zhang@×××××.com>");
763 + MODULE_DESCRIPTION("Loongson1 CPUFreq driver");
764 + MODULE_LICENSE("GPL");
765 +diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c
766 +index ea7a4e1b68c26..1a45fbb00d877 100644
767 +--- a/drivers/cpufreq/scpi-cpufreq.c
768 ++++ b/drivers/cpufreq/scpi-cpufreq.c
769 +@@ -111,6 +111,7 @@ static struct platform_driver scpi_cpufreq_platdrv = {
770 + };
771 + module_platform_driver(scpi_cpufreq_platdrv);
772 +
773 ++MODULE_ALIAS("platform:scpi-cpufreq");
774 + MODULE_AUTHOR("Sudeep Holla <sudeep.holla@×××.com>");
775 + MODULE_DESCRIPTION("ARM SCPI CPUFreq interface driver");
776 + MODULE_LICENSE("GPL v2");
777 +diff --git a/drivers/cpufreq/sti-cpufreq.c b/drivers/cpufreq/sti-cpufreq.c
778 +index 2cb3346e82d35..c7f0b2df15cdd 100644
779 +--- a/drivers/cpufreq/sti-cpufreq.c
780 ++++ b/drivers/cpufreq/sti-cpufreq.c
781 +@@ -294,6 +294,13 @@ register_cpufreq_dt:
782 + }
783 + module_init(sti_cpufreq_init);
784 +
785 ++static const struct of_device_id __maybe_unused sti_cpufreq_of_match[] = {
786 ++ { .compatible = "st,stih407" },
787 ++ { .compatible = "st,stih410" },
788 ++ { },
789 ++};
790 ++MODULE_DEVICE_TABLE(of, sti_cpufreq_of_match);
791 ++
792 + MODULE_DESCRIPTION("STMicroelectronics CPUFreq/OPP driver");
793 + MODULE_AUTHOR("Ajitpal Singh <ajitpal.singh@××.com>");
794 + MODULE_AUTHOR("Lee Jones <lee.jones@××××××.org>");
795 +diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
796 +index fe32dd95ae4ff..a2d5ba0a0d5a0 100644
797 +--- a/drivers/crypto/omap-aes.c
798 ++++ b/drivers/crypto/omap-aes.c
799 +@@ -1172,7 +1172,7 @@ static int omap_aes_probe(struct platform_device *pdev)
800 + if (err < 0) {
801 + dev_err(dev, "%s: failed to get_sync(%d)\n",
802 + __func__, err);
803 +- goto err_res;
804 ++ goto err_pm_disable;
805 + }
806 +
807 + omap_aes_dma_stop(dd);
808 +@@ -1257,6 +1257,7 @@ err_engine:
809 + omap_aes_dma_cleanup(dd);
810 + err_irq:
811 + tasklet_kill(&dd->done_task);
812 ++err_pm_disable:
813 + pm_runtime_disable(dev);
814 + err_res:
815 + dd = NULL;
816 +diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
817 +index 059c2d4ad18fb..f4a6be76468d5 100644
818 +--- a/drivers/crypto/talitos.c
819 ++++ b/drivers/crypto/talitos.c
820 +@@ -447,7 +447,7 @@ DEF_TALITOS2_DONE(ch1_3, TALITOS2_ISR_CH_1_3_DONE)
821 + /*
822 + * locate current (offending) descriptor
823 + */
824 +-static u32 current_desc_hdr(struct device *dev, int ch)
825 ++static __be32 current_desc_hdr(struct device *dev, int ch)
826 + {
827 + struct talitos_private *priv = dev_get_drvdata(dev);
828 + int tail, iter;
829 +@@ -478,13 +478,13 @@ static u32 current_desc_hdr(struct device *dev, int ch)
830 + /*
831 + * user diagnostics; report root cause of error based on execution unit status
832 + */
833 +-static void report_eu_error(struct device *dev, int ch, u32 desc_hdr)
834 ++static void report_eu_error(struct device *dev, int ch, __be32 desc_hdr)
835 + {
836 + struct talitos_private *priv = dev_get_drvdata(dev);
837 + int i;
838 +
839 + if (!desc_hdr)
840 +- desc_hdr = in_be32(priv->chan[ch].reg + TALITOS_DESCBUF);
841 ++ desc_hdr = cpu_to_be32(in_be32(priv->chan[ch].reg + TALITOS_DESCBUF));
842 +
843 + switch (desc_hdr & DESC_HDR_SEL0_MASK) {
844 + case DESC_HDR_SEL0_AFEU:
845 +diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
846 +index 68dbcb814b2ff..4cf72487381e3 100644
847 +--- a/drivers/extcon/extcon-max77693.c
848 ++++ b/drivers/extcon/extcon-max77693.c
849 +@@ -1272,4 +1272,4 @@ module_platform_driver(max77693_muic_driver);
850 + MODULE_DESCRIPTION("Maxim MAX77693 Extcon driver");
851 + MODULE_AUTHOR("Chanwoo Choi <cw00.choi@×××××××.com>");
852 + MODULE_LICENSE("GPL");
853 +-MODULE_ALIAS("platform:extcon-max77693");
854 ++MODULE_ALIAS("platform:max77693-muic");
855 +diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c b/drivers/gpu/drm/drm_dp_aux_dev.c
856 +index ec1ed94b23902..19c85c50e2d17 100644
857 +--- a/drivers/gpu/drm/drm_dp_aux_dev.c
858 ++++ b/drivers/gpu/drm/drm_dp_aux_dev.c
859 +@@ -59,7 +59,7 @@ static struct drm_dp_aux_dev *drm_dp_aux_dev_get_by_minor(unsigned index)
860 +
861 + mutex_lock(&aux_idr_mutex);
862 + aux_dev = idr_find(&aux_idr, index);
863 +- if (!kref_get_unless_zero(&aux_dev->refcount))
864 ++ if (aux_dev && !kref_get_unless_zero(&aux_dev->refcount))
865 + aux_dev = NULL;
866 + mutex_unlock(&aux_idr_mutex);
867 +
868 +diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
869 +index 7ec4e3fbafd8c..ec6ea202cf5de 100644
870 +--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
871 ++++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
872 +@@ -2126,7 +2126,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
873 + DRM_INFO("failed to retrieve link info, disabling eDP\n");
874 + cdv_intel_dp_encoder_destroy(encoder);
875 + cdv_intel_dp_destroy(connector);
876 +- goto err_priv;
877 ++ goto err_connector;
878 + } else {
879 + DRM_DEBUG_KMS("DPCD: Rev=%x LN_Rate=%x LN_CNT=%x LN_DOWNSP=%x\n",
880 + intel_dp->dpcd[0], intel_dp->dpcd[1],
881 +diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
882 +index 6a0b25e0823fa..6b64a1e07c017 100644
883 +--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
884 ++++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
885 +@@ -747,6 +747,7 @@ static int omap_dmm_probe(struct platform_device *dev)
886 + &omap_dmm->refill_pa, GFP_KERNEL);
887 + if (!omap_dmm->refill_va) {
888 + dev_err(&dev->dev, "could not allocate refill memory\n");
889 ++ ret = -ENOMEM;
890 + goto fail;
891 + }
892 +
893 +diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
894 +index 74d0540b8d4c7..76717d2f51e74 100644
895 +--- a/drivers/gpu/drm/tegra/sor.c
896 ++++ b/drivers/gpu/drm/tegra/sor.c
897 +@@ -2375,17 +2375,23 @@ static int tegra_sor_init(struct host1x_client *client)
898 + if (err < 0) {
899 + dev_err(sor->dev, "failed to deassert SOR reset: %d\n",
900 + err);
901 ++ clk_disable_unprepare(sor->clk);
902 + return err;
903 + }
904 + }
905 +
906 + err = clk_prepare_enable(sor->clk_safe);
907 +- if (err < 0)
908 ++ if (err < 0) {
909 ++ clk_disable_unprepare(sor->clk);
910 + return err;
911 ++ }
912 +
913 + err = clk_prepare_enable(sor->clk_dp);
914 +- if (err < 0)
915 ++ if (err < 0) {
916 ++ clk_disable_unprepare(sor->clk_safe);
917 ++ clk_disable_unprepare(sor->clk);
918 + return err;
919 ++ }
920 +
921 + return 0;
922 + }
923 +diff --git a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
924 +index f98c1e1b1dbdc..58a753ef27175 100644
925 +--- a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
926 ++++ b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
927 +@@ -397,6 +397,14 @@ static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = {
928 + },
929 + .driver_data = (void *)&sipodev_desc
930 + },
931 ++ {
932 ++ .ident = "Vero K147",
933 ++ .matches = {
934 ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VERO"),
935 ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "K147"),
936 ++ },
937 ++ .driver_data = (void *)&sipodev_desc
938 ++ },
939 + { } /* Terminate list */
940 + };
941 +
942 +diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
943 +index 9a29b34ed2c82..22cd7169011d1 100644
944 +--- a/drivers/hsi/controllers/omap_ssi_core.c
945 ++++ b/drivers/hsi/controllers/omap_ssi_core.c
946 +@@ -391,7 +391,7 @@ static int ssi_add_controller(struct hsi_controller *ssi,
947 +
948 + err = ida_simple_get(&platform_omap_ssi_ida, 0, 0, GFP_KERNEL);
949 + if (err < 0)
950 +- goto out_err;
951 ++ return err;
952 + ssi->id = err;
953 +
954 + ssi->owner = THIS_MODULE;
955 +diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
956 +index 85d7012916540..7e72dab459321 100644
957 +--- a/drivers/iio/adc/rockchip_saradc.c
958 ++++ b/drivers/iio/adc/rockchip_saradc.c
959 +@@ -378,7 +378,7 @@ static int rockchip_saradc_resume(struct device *dev)
960 +
961 + ret = clk_prepare_enable(info->clk);
962 + if (ret)
963 +- return ret;
964 ++ clk_disable_unprepare(info->pclk);
965 +
966 + return ret;
967 + }
968 +diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
969 +index 2f037cd59d53c..b0fdce0b95633 100644
970 +--- a/drivers/iio/industrialio-buffer.c
971 ++++ b/drivers/iio/industrialio-buffer.c
972 +@@ -1335,12 +1335,12 @@ static int iio_buffer_update_demux(struct iio_dev *indio_dev,
973 + indio_dev->masklength,
974 + in_ind + 1);
975 + while (in_ind != out_ind) {
976 +- in_ind = find_next_bit(indio_dev->active_scan_mask,
977 +- indio_dev->masklength,
978 +- in_ind + 1);
979 + length = iio_storage_bytes_for_si(indio_dev, in_ind);
980 + /* Make sure we are aligned */
981 + in_loc = roundup(in_loc, length) + length;
982 ++ in_ind = find_next_bit(indio_dev->active_scan_mask,
983 ++ indio_dev->masklength,
984 ++ in_ind + 1);
985 + }
986 + length = iio_storage_bytes_for_si(indio_dev, in_ind);
987 + out_loc = roundup(out_loc, length);
988 +diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c
989 +index eb87948fc5596..d6c919cfa4166 100644
990 +--- a/drivers/iio/pressure/mpl3115.c
991 ++++ b/drivers/iio/pressure/mpl3115.c
992 +@@ -139,7 +139,14 @@ static irqreturn_t mpl3115_trigger_handler(int irq, void *p)
993 + struct iio_poll_func *pf = p;
994 + struct iio_dev *indio_dev = pf->indio_dev;
995 + struct mpl3115_data *data = iio_priv(indio_dev);
996 +- u8 buffer[16]; /* 32-bit channel + 16-bit channel + padding + ts */
997 ++ /*
998 ++ * 32-bit channel + 16-bit channel + padding + ts
999 ++ * Note that it is possible for only one of the first 2
1000 ++ * channels to be enabled. If that happens, the first element
1001 ++ * of the buffer may be either 16 or 32-bits. As such we cannot
1002 ++ * use a simple structure definition to express this data layout.
1003 ++ */
1004 ++ u8 buffer[16] __aligned(8);
1005 + int ret, pos = 0;
1006 +
1007 + mutex_lock(&data->lock);
1008 +diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
1009 +index 304429fd04ddb..97168b856606b 100644
1010 +--- a/drivers/infiniband/core/cm.c
1011 ++++ b/drivers/infiniband/core/cm.c
1012 +@@ -1252,6 +1252,7 @@ int ib_send_cm_req(struct ib_cm_id *cm_id,
1013 + id.local_id);
1014 + if (IS_ERR(cm_id_priv->timewait_info)) {
1015 + ret = PTR_ERR(cm_id_priv->timewait_info);
1016 ++ cm_id_priv->timewait_info = NULL;
1017 + goto out;
1018 + }
1019 +
1020 +@@ -1683,6 +1684,7 @@ static int cm_req_handler(struct cm_work *work)
1021 + id.local_id);
1022 + if (IS_ERR(cm_id_priv->timewait_info)) {
1023 + ret = PTR_ERR(cm_id_priv->timewait_info);
1024 ++ cm_id_priv->timewait_info = NULL;
1025 + goto destroy;
1026 + }
1027 + cm_id_priv->timewait_info->work.remote_id = req_msg->local_comm_id;
1028 +diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
1029 +index a856371bbe58c..7b38b9a280ba4 100644
1030 +--- a/drivers/infiniband/hw/cxgb4/cq.c
1031 ++++ b/drivers/infiniband/hw/cxgb4/cq.c
1032 +@@ -893,6 +893,9 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev,
1033 +
1034 + rhp = to_c4iw_dev(ibdev);
1035 +
1036 ++ if (entries < 1 || entries > ibdev->attrs.max_cqe)
1037 ++ return ERR_PTR(-EINVAL);
1038 ++
1039 + if (vector >= rhp->rdev.lldi.nciq)
1040 + return ERR_PTR(-EINVAL);
1041 +
1042 +diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
1043 +index a5694dec3f2ee..098653b8157ed 100644
1044 +--- a/drivers/infiniband/hw/mthca/mthca_cq.c
1045 ++++ b/drivers/infiniband/hw/mthca/mthca_cq.c
1046 +@@ -609,7 +609,7 @@ static inline int mthca_poll_one(struct mthca_dev *dev,
1047 + entry->byte_len = MTHCA_ATOMIC_BYTE_LEN;
1048 + break;
1049 + default:
1050 +- entry->opcode = MTHCA_OPCODE_INVALID;
1051 ++ entry->opcode = 0xFF;
1052 + break;
1053 + }
1054 + } else {
1055 +diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
1056 +index 4393a022867ba..e1fc67e73bf87 100644
1057 +--- a/drivers/infiniband/hw/mthca/mthca_dev.h
1058 ++++ b/drivers/infiniband/hw/mthca/mthca_dev.h
1059 +@@ -105,7 +105,6 @@ enum {
1060 + MTHCA_OPCODE_ATOMIC_CS = 0x11,
1061 + MTHCA_OPCODE_ATOMIC_FA = 0x12,
1062 + MTHCA_OPCODE_BIND_MW = 0x18,
1063 +- MTHCA_OPCODE_INVALID = 0xff
1064 + };
1065 +
1066 + enum {
1067 +diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
1068 +index 5a2d7b0050f4c..463c4b3e73661 100644
1069 +--- a/drivers/infiniband/sw/rxe/rxe_req.c
1070 ++++ b/drivers/infiniband/sw/rxe/rxe_req.c
1071 +@@ -661,7 +661,8 @@ next_wqe:
1072 + }
1073 +
1074 + if (unlikely(qp_type(qp) == IB_QPT_RC &&
1075 +- qp->req.psn > (qp->comp.psn + RXE_MAX_UNACKED_PSNS))) {
1076 ++ psn_compare(qp->req.psn, (qp->comp.psn +
1077 ++ RXE_MAX_UNACKED_PSNS)) > 0)) {
1078 + qp->req.wait_psn = 1;
1079 + goto exit;
1080 + }
1081 +diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
1082 +index 25943e9bc8bff..328792e26a9f6 100644
1083 +--- a/drivers/input/keyboard/cros_ec_keyb.c
1084 ++++ b/drivers/input/keyboard/cros_ec_keyb.c
1085 +@@ -140,6 +140,7 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
1086 + "changed: [r%d c%d]: byte %02x\n",
1087 + row, col, new_state);
1088 +
1089 ++ input_event(idev, EV_MSC, MSC_SCAN, pos);
1090 + input_report_key(idev, keycodes[pos],
1091 + new_state);
1092 + }
1093 +diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
1094 +index 23c191a2a0715..cf4d507efaf6d 100644
1095 +--- a/drivers/input/misc/cm109.c
1096 ++++ b/drivers/input/misc/cm109.c
1097 +@@ -571,12 +571,15 @@ static int cm109_input_open(struct input_dev *idev)
1098 + dev->ctl_data->byte[HID_OR2] = dev->keybit;
1099 + dev->ctl_data->byte[HID_OR3] = 0x00;
1100 +
1101 ++ dev->ctl_urb_pending = 1;
1102 + error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL);
1103 +- if (error)
1104 ++ if (error) {
1105 ++ dev->ctl_urb_pending = 0;
1106 + dev_err(&dev->intf->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n",
1107 + __func__, error);
1108 +- else
1109 ++ } else {
1110 + dev->open = 1;
1111 ++ }
1112 +
1113 + mutex_unlock(&dev->pm_mutex);
1114 +
1115 +diff --git a/drivers/input/mouse/cyapa_gen6.c b/drivers/input/mouse/cyapa_gen6.c
1116 +index 016397850b1b0..9c1f10491ab1a 100644
1117 +--- a/drivers/input/mouse/cyapa_gen6.c
1118 ++++ b/drivers/input/mouse/cyapa_gen6.c
1119 +@@ -573,7 +573,7 @@ static int cyapa_pip_retrieve_data_structure(struct cyapa *cyapa,
1120 +
1121 + memset(&cmd, 0, sizeof(cmd));
1122 + put_unaligned_le16(PIP_OUTPUT_REPORT_ADDR, &cmd.head.addr);
1123 +- put_unaligned_le16(sizeof(cmd), &cmd.head.length - 2);
1124 ++ put_unaligned_le16(sizeof(cmd) - 2, &cmd.head.length);
1125 + cmd.head.report_id = PIP_APP_CMD_REPORT_ID;
1126 + cmd.head.cmd_code = PIP_RETRIEVE_DATA_STRUCTURE;
1127 + put_unaligned_le16(read_offset, &cmd.read_offset);
1128 +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
1129 +index 1f45010a5b814..fa07be0b4500e 100644
1130 +--- a/drivers/input/serio/i8042-x86ia64io.h
1131 ++++ b/drivers/input/serio/i8042-x86ia64io.h
1132 +@@ -687,6 +687,48 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
1133 + DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
1134 + },
1135 + },
1136 ++ {
1137 ++ .matches = {
1138 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1139 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A114-31"),
1140 ++ },
1141 ++ },
1142 ++ {
1143 ++ .matches = {
1144 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1145 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A314-31"),
1146 ++ },
1147 ++ },
1148 ++ {
1149 ++ .matches = {
1150 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1151 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A315-31"),
1152 ++ },
1153 ++ },
1154 ++ {
1155 ++ .matches = {
1156 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1157 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-132"),
1158 ++ },
1159 ++ },
1160 ++ {
1161 ++ .matches = {
1162 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1163 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-332"),
1164 ++ },
1165 ++ },
1166 ++ {
1167 ++ .matches = {
1168 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1169 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-432"),
1170 ++ },
1171 ++ },
1172 ++ {
1173 ++ .matches = {
1174 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1175 ++ DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate Spin B118-RN"),
1176 ++ },
1177 ++ },
1178 + {
1179 + /* Advent 4211 */
1180 + .matches = {
1181 +diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
1182 +index 1ce3ecbe37f89..b77a2178fdec4 100644
1183 +--- a/drivers/input/touchscreen/ads7846.c
1184 ++++ b/drivers/input/touchscreen/ads7846.c
1185 +@@ -35,6 +35,7 @@
1186 + #include <linux/regulator/consumer.h>
1187 + #include <linux/module.h>
1188 + #include <asm/irq.h>
1189 ++#include <asm/unaligned.h>
1190 +
1191 + /*
1192 + * This code has been heavily tested on a Nokia 770, and lightly
1193 +@@ -410,7 +411,7 @@ static int ads7845_read12_ser(struct device *dev, unsigned command)
1194 +
1195 + if (status == 0) {
1196 + /* BE12 value, then padding */
1197 +- status = be16_to_cpu(*((u16 *)&req->sample[1]));
1198 ++ status = get_unaligned_be16(&req->sample[1]);
1199 + status = status >> 3;
1200 + status &= 0x0fff;
1201 + }
1202 +@@ -785,10 +786,11 @@ static void ads7846_report_state(struct ads7846 *ts)
1203 + /* compute touch pressure resistance using equation #2 */
1204 + Rt = z2;
1205 + Rt -= z1;
1206 +- Rt *= x;
1207 + Rt *= ts->x_plate_ohms;
1208 ++ Rt = DIV_ROUND_CLOSEST(Rt, 16);
1209 ++ Rt *= x;
1210 + Rt /= z1;
1211 +- Rt = (Rt + 2047) >> 12;
1212 ++ Rt = DIV_ROUND_CLOSEST(Rt, 256);
1213 + } else {
1214 + Rt = 0;
1215 + }
1216 +diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
1217 +index 6a02e7301297d..ba0ab9963f3cd 100644
1218 +--- a/drivers/input/touchscreen/goodix.c
1219 ++++ b/drivers/input/touchscreen/goodix.c
1220 +@@ -98,6 +98,18 @@ static const struct dmi_system_id rotated_screen[] = {
1221 + DMI_MATCH(DMI_BIOS_DATE, "12/19/2014"),
1222 + },
1223 + },
1224 ++ {
1225 ++ .ident = "Teclast X98 Pro",
1226 ++ .matches = {
1227 ++ /*
1228 ++ * Only match BIOS date, because the manufacturers
1229 ++ * BIOS does not report the board name at all
1230 ++ * (sometimes)...
1231 ++ */
1232 ++ DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"),
1233 ++ DMI_MATCH(DMI_BIOS_DATE, "10/28/2015"),
1234 ++ },
1235 ++ },
1236 + {
1237 + .ident = "WinBook TW100",
1238 + .matches = {
1239 +diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-alpine-msi.c
1240 +index 63d980995d17d..ac431697ebe1c 100644
1241 +--- a/drivers/irqchip/irq-alpine-msi.c
1242 ++++ b/drivers/irqchip/irq-alpine-msi.c
1243 +@@ -165,8 +165,7 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain,
1244 + return 0;
1245 +
1246 + err_sgi:
1247 +- while (--i >= 0)
1248 +- irq_domain_free_irqs_parent(domain, virq, i);
1249 ++ irq_domain_free_irqs_parent(domain, virq, i - 1);
1250 + alpine_msix_free_sgi(priv, sgi, nr_irqs);
1251 + return err;
1252 + }
1253 +diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
1254 +index 6964b252952a4..836a2808c0c71 100644
1255 +--- a/drivers/md/dm-ioctl.c
1256 ++++ b/drivers/md/dm-ioctl.c
1257 +@@ -1549,6 +1549,7 @@ static int target_message(struct dm_ioctl *param, size_t param_size)
1258 +
1259 + if (!argc) {
1260 + DMWARN("Empty message received.");
1261 ++ r = -EINVAL;
1262 + goto out_argv;
1263 + }
1264 +
1265 +diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
1266 +index 2d3ff028f50c9..62e3dc19b6099 100644
1267 +--- a/drivers/md/dm-table.c
1268 ++++ b/drivers/md/dm-table.c
1269 +@@ -1250,12 +1250,6 @@ void dm_table_event_callback(struct dm_table *t,
1270 +
1271 + void dm_table_event(struct dm_table *t)
1272 + {
1273 +- /*
1274 +- * You can no longer call dm_table_event() from interrupt
1275 +- * context, use a bottom half instead.
1276 +- */
1277 +- BUG_ON(in_interrupt());
1278 +-
1279 + mutex_lock(&_event_lock);
1280 + if (t->event_fn)
1281 + t->event_fn(t->event_context);
1282 +diff --git a/drivers/md/md.c b/drivers/md/md.c
1283 +index 3485d2a796000..0bfb77f8503d2 100644
1284 +--- a/drivers/md/md.c
1285 ++++ b/drivers/md/md.c
1286 +@@ -6857,8 +6857,11 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
1287 + err = -EBUSY;
1288 + goto out;
1289 + }
1290 +- WARN_ON_ONCE(test_bit(MD_CLOSING, &mddev->flags));
1291 +- set_bit(MD_CLOSING, &mddev->flags);
1292 ++ if (test_and_set_bit(MD_CLOSING, &mddev->flags)) {
1293 ++ mutex_unlock(&mddev->open_mutex);
1294 ++ err = -EBUSY;
1295 ++ goto out;
1296 ++ }
1297 + did_set_md_closing = true;
1298 + mutex_unlock(&mddev->open_mutex);
1299 + sync_blockdev(bdev);
1300 +diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c
1301 +index 9148e14c9d077..9d5eb8b6aede9 100644
1302 +--- a/drivers/media/common/siano/smsdvb-main.c
1303 ++++ b/drivers/media/common/siano/smsdvb-main.c
1304 +@@ -1180,12 +1180,15 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
1305 + rc = dvb_create_media_graph(&client->adapter, true);
1306 + if (rc < 0) {
1307 + pr_err("dvb_create_media_graph failed %d\n", rc);
1308 +- goto client_error;
1309 ++ goto media_graph_error;
1310 + }
1311 +
1312 + pr_info("DVB interface registered.\n");
1313 + return 0;
1314 +
1315 ++media_graph_error:
1316 ++ smsdvb_debugfs_release(client);
1317 ++
1318 + client_error:
1319 + dvb_unregister_frontend(&client->frontend);
1320 +
1321 +diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
1322 +index f33c0de3e8490..019bbc18cede6 100644
1323 +--- a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
1324 ++++ b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
1325 +@@ -184,7 +184,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
1326 + struct spi_master *master;
1327 + struct netup_spi *nspi;
1328 +
1329 +- master = spi_alloc_master(&ndev->pci_dev->dev,
1330 ++ master = devm_spi_alloc_master(&ndev->pci_dev->dev,
1331 + sizeof(struct netup_spi));
1332 + if (!master) {
1333 + dev_err(&ndev->pci_dev->dev,
1334 +@@ -217,6 +217,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
1335 + ndev->pci_slot,
1336 + ndev->pci_func);
1337 + if (!spi_new_device(master, &netup_spi_board)) {
1338 ++ spi_unregister_master(master);
1339 + ndev->spi = NULL;
1340 + dev_err(&ndev->pci_dev->dev,
1341 + "%s(): unable to create SPI device\n", __func__);
1342 +@@ -235,13 +236,13 @@ void netup_spi_release(struct netup_unidvb_dev *ndev)
1343 + if (!spi)
1344 + return;
1345 +
1346 ++ spi_unregister_master(spi->master);
1347 + spin_lock_irqsave(&spi->lock, flags);
1348 + reg = readw(&spi->regs->control_stat);
1349 + writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat);
1350 + reg = readw(&spi->regs->control_stat);
1351 + writew(reg & ~NETUP_SPI_CTRL_IMASK, &spi->regs->control_stat);
1352 + spin_unlock_irqrestore(&spi->lock, flags);
1353 +- spi_unregister_master(spi->master);
1354 + ndev->spi = NULL;
1355 + }
1356 +
1357 +diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c
1358 +index 504d788076392..3e8753c9e1e47 100644
1359 +--- a/drivers/media/pci/saa7146/mxb.c
1360 ++++ b/drivers/media/pci/saa7146/mxb.c
1361 +@@ -652,16 +652,17 @@ static int vidioc_s_audio(struct file *file, void *fh, const struct v4l2_audio *
1362 + struct mxb *mxb = (struct mxb *)dev->ext_priv;
1363 +
1364 + DEB_D("VIDIOC_S_AUDIO %d\n", a->index);
1365 +- if (mxb_inputs[mxb->cur_input].audioset & (1 << a->index)) {
1366 +- if (mxb->cur_audinput != a->index) {
1367 +- mxb->cur_audinput = a->index;
1368 +- tea6420_route(mxb, a->index);
1369 +- if (mxb->cur_audinput == 0)
1370 +- mxb_update_audmode(mxb);
1371 +- }
1372 +- return 0;
1373 ++ if (a->index >= 32 ||
1374 ++ !(mxb_inputs[mxb->cur_input].audioset & (1 << a->index)))
1375 ++ return -EINVAL;
1376 ++
1377 ++ if (mxb->cur_audinput != a->index) {
1378 ++ mxb->cur_audinput = a->index;
1379 ++ tea6420_route(mxb, a->index);
1380 ++ if (mxb->cur_audinput == 0)
1381 ++ mxb_update_audmode(mxb);
1382 + }
1383 +- return -EINVAL;
1384 ++ return 0;
1385 + }
1386 +
1387 + #ifdef CONFIG_VIDEO_ADV_DEBUG
1388 +diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c
1389 +index 6a35107aca255..0fe69e71331db 100644
1390 +--- a/drivers/media/pci/solo6x10/solo6x10-g723.c
1391 ++++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
1392 +@@ -385,7 +385,7 @@ int solo_g723_init(struct solo_dev *solo_dev)
1393 +
1394 + ret = snd_ctl_add(card, snd_ctl_new1(&kctl, solo_dev));
1395 + if (ret < 0)
1396 +- return ret;
1397 ++ goto snd_error;
1398 +
1399 + ret = solo_snd_pcm_init(solo_dev);
1400 + if (ret < 0)
1401 +diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c
1402 +index eaadc081760ae..3256bf46a3766 100644
1403 +--- a/drivers/media/rc/sunxi-cir.c
1404 ++++ b/drivers/media/rc/sunxi-cir.c
1405 +@@ -132,6 +132,8 @@ static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id)
1406 + } else if (status & REG_RXINT_RPEI_EN) {
1407 + ir_raw_event_set_idle(ir->rc, true);
1408 + ir_raw_event_handle(ir->rc);
1409 ++ } else {
1410 ++ ir_raw_event_handle(ir->rc);
1411 + }
1412 +
1413 + spin_unlock(&ir->ir_lock);
1414 +diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
1415 +index 2cba2e1acdc68..d239075a6a65f 100644
1416 +--- a/drivers/media/usb/gspca/gspca.c
1417 ++++ b/drivers/media/usb/gspca/gspca.c
1418 +@@ -2145,6 +2145,7 @@ out:
1419 + input_unregister_device(gspca_dev->input_dev);
1420 + #endif
1421 + v4l2_ctrl_handler_free(gspca_dev->vdev.ctrl_handler);
1422 ++ v4l2_device_unregister(&gspca_dev->v4l2_dev);
1423 + kfree(gspca_dev->usb_buf);
1424 + kfree(gspca_dev);
1425 + return ret;
1426 +diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c
1427 +index bb3d31e2a0b55..12bc8cfd9b0dc 100644
1428 +--- a/drivers/media/usb/msi2500/msi2500.c
1429 ++++ b/drivers/media/usb/msi2500/msi2500.c
1430 +@@ -1250,7 +1250,7 @@ static int msi2500_probe(struct usb_interface *intf,
1431 + }
1432 +
1433 + dev->master = master;
1434 +- master->bus_num = 0;
1435 ++ master->bus_num = -1;
1436 + master->num_chipselect = 1;
1437 + master->transfer_one_message = msi2500_transfer_one_message;
1438 + spi_master_set_devdata(master, dev);
1439 +diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
1440 +index 1041eb7a61672..2cae85a7ca6de 100644
1441 +--- a/drivers/memstick/core/memstick.c
1442 ++++ b/drivers/memstick/core/memstick.c
1443 +@@ -469,7 +469,6 @@ static void memstick_check(struct work_struct *work)
1444 + host->card = card;
1445 + if (device_register(&card->dev)) {
1446 + put_device(&card->dev);
1447 +- kfree(host->card);
1448 + host->card = NULL;
1449 + }
1450 + } else
1451 +diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c
1452 +index d5cfb503b9d69..2539984c1db1c 100644
1453 +--- a/drivers/memstick/host/r592.c
1454 ++++ b/drivers/memstick/host/r592.c
1455 +@@ -762,8 +762,10 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1456 + goto error3;
1457 +
1458 + dev->mmio = pci_ioremap_bar(pdev, 0);
1459 +- if (!dev->mmio)
1460 ++ if (!dev->mmio) {
1461 ++ error = -ENOMEM;
1462 + goto error4;
1463 ++ }
1464 +
1465 + dev->irq = pdev->irq;
1466 + spin_lock_init(&dev->irq_lock);
1467 +@@ -790,12 +792,14 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1468 + &dev->dummy_dma_page_physical_address, GFP_KERNEL);
1469 + r592_stop_dma(dev , 0);
1470 +
1471 +- if (request_irq(dev->irq, &r592_irq, IRQF_SHARED,
1472 +- DRV_NAME, dev))
1473 ++ error = request_irq(dev->irq, &r592_irq, IRQF_SHARED,
1474 ++ DRV_NAME, dev);
1475 ++ if (error)
1476 + goto error6;
1477 +
1478 + r592_update_card_detect(dev);
1479 +- if (memstick_add_host(host))
1480 ++ error = memstick_add_host(host);
1481 ++ if (error)
1482 + goto error7;
1483 +
1484 + message("driver successfully loaded");
1485 +diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
1486 +index 04fd845de05fb..67b71c476c5b4 100644
1487 +--- a/drivers/mtd/cmdlinepart.c
1488 ++++ b/drivers/mtd/cmdlinepart.c
1489 +@@ -228,7 +228,7 @@ static int mtdpart_setup_real(char *s)
1490 + struct cmdline_mtd_partition *this_mtd;
1491 + struct mtd_partition *parts;
1492 + int mtd_id_len, num_parts;
1493 +- char *p, *mtd_id, *semicol;
1494 ++ char *p, *mtd_id, *semicol, *open_parenth;
1495 +
1496 + /*
1497 + * Replace the first ';' by a NULL char so strrchr can work
1498 +@@ -238,6 +238,14 @@ static int mtdpart_setup_real(char *s)
1499 + if (semicol)
1500 + *semicol = '\0';
1501 +
1502 ++ /*
1503 ++ * make sure that part-names with ":" will not be handled as
1504 ++ * part of the mtd-id with an ":"
1505 ++ */
1506 ++ open_parenth = strchr(s, '(');
1507 ++ if (open_parenth)
1508 ++ *open_parenth = '\0';
1509 ++
1510 + mtd_id = s;
1511 +
1512 + /*
1513 +@@ -247,6 +255,10 @@ static int mtdpart_setup_real(char *s)
1514 + */
1515 + p = strrchr(s, ':');
1516 +
1517 ++ /* Restore the '(' now. */
1518 ++ if (open_parenth)
1519 ++ *open_parenth = '(';
1520 ++
1521 + /* Restore the ';' now. */
1522 + if (semicol)
1523 + *semicol = ';';
1524 +diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
1525 +index 7621f91a8a209..fd48770ba7920 100644
1526 +--- a/drivers/net/can/softing/softing_main.c
1527 ++++ b/drivers/net/can/softing/softing_main.c
1528 +@@ -393,8 +393,13 @@ static int softing_netdev_open(struct net_device *ndev)
1529 +
1530 + /* check or determine and set bittime */
1531 + ret = open_candev(ndev);
1532 +- if (!ret)
1533 +- ret = softing_startstop(ndev, 1);
1534 ++ if (ret)
1535 ++ return ret;
1536 ++
1537 ++ ret = softing_startstop(ndev, 1);
1538 ++ if (ret < 0)
1539 ++ close_candev(ndev);
1540 ++
1541 + return ret;
1542 + }
1543 +
1544 +diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
1545 +index 672a8212c8d96..3dc101f7d6bd8 100644
1546 +--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
1547 ++++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
1548 +@@ -827,13 +827,13 @@ static int emac_probe(struct platform_device *pdev)
1549 + db->clk = devm_clk_get(&pdev->dev, NULL);
1550 + if (IS_ERR(db->clk)) {
1551 + ret = PTR_ERR(db->clk);
1552 +- goto out_iounmap;
1553 ++ goto out_dispose_mapping;
1554 + }
1555 +
1556 + ret = clk_prepare_enable(db->clk);
1557 + if (ret) {
1558 + dev_err(&pdev->dev, "Error couldn't enable clock (%d)\n", ret);
1559 +- goto out_iounmap;
1560 ++ goto out_dispose_mapping;
1561 + }
1562 +
1563 + ret = sunxi_sram_claim(&pdev->dev);
1564 +@@ -890,6 +890,8 @@ out_release_sram:
1565 + sunxi_sram_release(&pdev->dev);
1566 + out_clk_disable_unprepare:
1567 + clk_disable_unprepare(db->clk);
1568 ++out_dispose_mapping:
1569 ++ irq_dispose_mapping(ndev->irq);
1570 + out_iounmap:
1571 + iounmap(db->membase);
1572 + out:
1573 +@@ -908,6 +910,7 @@ static int emac_remove(struct platform_device *pdev)
1574 + unregister_netdev(ndev);
1575 + sunxi_sram_release(&pdev->dev);
1576 + clk_disable_unprepare(db->clk);
1577 ++ irq_dispose_mapping(ndev->irq);
1578 + iounmap(db->membase);
1579 + free_netdev(ndev);
1580 +
1581 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1582 +index 5d4189c94718c..2921ae13db283 100644
1583 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1584 ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1585 +@@ -3433,8 +3433,10 @@ static int bcmgenet_probe(struct platform_device *pdev)
1586 + clk_disable_unprepare(priv->clk);
1587 +
1588 + err = register_netdev(dev);
1589 +- if (err)
1590 ++ if (err) {
1591 ++ bcmgenet_mii_exit(dev);
1592 + goto err;
1593 ++ }
1594 +
1595 + return err;
1596 +
1597 +diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
1598 +index cd8895838a04c..4cf1fc89df3c6 100644
1599 +--- a/drivers/net/ethernet/korina.c
1600 ++++ b/drivers/net/ethernet/korina.c
1601 +@@ -216,7 +216,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
1602 + dev_kfree_skb_any(skb);
1603 + spin_unlock_irqrestore(&lp->lock, flags);
1604 +
1605 +- return NETDEV_TX_BUSY;
1606 ++ return NETDEV_TX_OK;
1607 + }
1608 + }
1609 +
1610 +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1611 +index 0160c93de6d3d..1cfa30e86328f 100644
1612 +--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1613 ++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1614 +@@ -1311,8 +1311,10 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
1615 + }
1616 +
1617 + priv->port_stats.tx_timeout++;
1618 +- en_dbg(DRV, priv, "Scheduling watchdog\n");
1619 +- queue_work(mdev->workqueue, &priv->watchdog_task);
1620 ++ if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state)) {
1621 ++ en_dbg(DRV, priv, "Scheduling port restart\n");
1622 ++ queue_work(mdev->workqueue, &priv->restart_task);
1623 ++ }
1624 + }
1625 +
1626 +
1627 +@@ -1746,6 +1748,7 @@ int mlx4_en_start_port(struct net_device *dev)
1628 + local_bh_enable();
1629 + }
1630 +
1631 ++ clear_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state);
1632 + netif_tx_start_all_queues(dev);
1633 + netif_device_attach(dev);
1634 +
1635 +@@ -1900,7 +1903,7 @@ void mlx4_en_stop_port(struct net_device *dev, int detach)
1636 + static void mlx4_en_restart(struct work_struct *work)
1637 + {
1638 + struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
1639 +- watchdog_task);
1640 ++ restart_task);
1641 + struct mlx4_en_dev *mdev = priv->mdev;
1642 + struct net_device *dev = priv->dev;
1643 +
1644 +@@ -2220,7 +2223,7 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
1645 + if (netif_running(dev)) {
1646 + mutex_lock(&mdev->state_lock);
1647 + if (!mdev->device_up) {
1648 +- /* NIC is probably restarting - let watchdog task reset
1649 ++ /* NIC is probably restarting - let restart task reset
1650 + * the port */
1651 + en_dbg(DRV, priv, "Change MTU called with card down!?\n");
1652 + } else {
1653 +@@ -2229,7 +2232,9 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
1654 + if (err) {
1655 + en_err(priv, "Failed restarting port:%d\n",
1656 + priv->port);
1657 +- queue_work(mdev->workqueue, &priv->watchdog_task);
1658 ++ if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING,
1659 ++ &priv->state))
1660 ++ queue_work(mdev->workqueue, &priv->restart_task);
1661 + }
1662 + }
1663 + mutex_unlock(&mdev->state_lock);
1664 +@@ -2701,7 +2706,8 @@ static int mlx4_xdp_set(struct net_device *dev, struct bpf_prog *prog)
1665 + if (err) {
1666 + en_err(priv, "Failed starting port %d for XDP change\n",
1667 + priv->port);
1668 +- queue_work(mdev->workqueue, &priv->watchdog_task);
1669 ++ if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state))
1670 ++ queue_work(mdev->workqueue, &priv->restart_task);
1671 + }
1672 + }
1673 +
1674 +@@ -3080,7 +3086,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
1675 + priv->counter_index = MLX4_SINK_COUNTER_INDEX(mdev->dev);
1676 + spin_lock_init(&priv->stats_lock);
1677 + INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode);
1678 +- INIT_WORK(&priv->watchdog_task, mlx4_en_restart);
1679 ++ INIT_WORK(&priv->restart_task, mlx4_en_restart);
1680 + INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate);
1681 + INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats);
1682 + INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task);
1683 +diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
1684 +index 247d340be7436..93780f63192af 100644
1685 +--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
1686 ++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
1687 +@@ -522,6 +522,10 @@ struct mlx4_en_stats_bitmap {
1688 + struct mutex mutex; /* for mutual access to stats bitmap */
1689 + };
1690 +
1691 ++enum {
1692 ++ MLX4_EN_STATE_FLAG_RESTARTING,
1693 ++};
1694 ++
1695 + struct mlx4_en_priv {
1696 + struct mlx4_en_dev *mdev;
1697 + struct mlx4_en_port_profile *prof;
1698 +@@ -586,7 +590,7 @@ struct mlx4_en_priv {
1699 + struct mlx4_en_cq *rx_cq[MAX_RX_RINGS];
1700 + struct mlx4_qp drop_qp;
1701 + struct work_struct rx_mode_task;
1702 +- struct work_struct watchdog_task;
1703 ++ struct work_struct restart_task;
1704 + struct work_struct linkstate_task;
1705 + struct delayed_work stats_task;
1706 + struct delayed_work service_task;
1707 +@@ -632,6 +636,7 @@ struct mlx4_en_priv {
1708 + u32 pflags;
1709 + u8 rss_key[MLX4_EN_RSS_KEY_SIZE];
1710 + u8 rss_hash_fn;
1711 ++ unsigned long state;
1712 + };
1713 +
1714 + enum mlx4_en_wol {
1715 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
1716 +index ebf5ead16939a..0928da21efd04 100644
1717 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
1718 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
1719 +@@ -2507,6 +2507,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1720 + qlcnic_sriov_vf_register_map(ahw);
1721 + break;
1722 + default:
1723 ++ err = -EINVAL;
1724 + goto err_out_free_hw_res;
1725 + }
1726 +
1727 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
1728 +index 6704d3e0392dc..afc68cbca4e2a 100644
1729 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
1730 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
1731 +@@ -30,7 +30,6 @@
1732 + #define PRG_ETH0_RGMII_MODE BIT(0)
1733 +
1734 + /* mux to choose between fclk_div2 (bit unset) and mpll2 (bit set) */
1735 +-#define PRG_ETH0_CLK_M250_SEL_SHIFT 4
1736 + #define PRG_ETH0_CLK_M250_SEL_MASK GENMASK(4, 4)
1737 +
1738 + #define PRG_ETH0_TXDLY_SHIFT 5
1739 +@@ -123,8 +122,9 @@ static int meson8b_init_clk(struct meson8b_dwmac *dwmac)
1740 + init.num_parents = MUX_CLK_NUM_PARENTS;
1741 +
1742 + dwmac->m250_mux.reg = dwmac->regs + PRG_ETH0;
1743 +- dwmac->m250_mux.shift = PRG_ETH0_CLK_M250_SEL_SHIFT;
1744 +- dwmac->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK;
1745 ++ dwmac->m250_mux.shift = __ffs(PRG_ETH0_CLK_M250_SEL_MASK);
1746 ++ dwmac->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK >>
1747 ++ dwmac->m250_mux.shift;
1748 + dwmac->m250_mux.flags = 0;
1749 + dwmac->m250_mux.table = NULL;
1750 + dwmac->m250_mux.hw.init = &init;
1751 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1752 +index 8c1a5361f661d..dbd56fefa2f3f 100644
1753 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1754 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1755 +@@ -1901,9 +1901,6 @@ static int stmmac_release(struct net_device *dev)
1756 + {
1757 + struct stmmac_priv *priv = netdev_priv(dev);
1758 +
1759 +- if (priv->eee_enabled)
1760 +- del_timer_sync(&priv->eee_ctrl_timer);
1761 +-
1762 + /* Stop and disconnect the PHY */
1763 + if (priv->phydev) {
1764 + phy_stop(priv->phydev);
1765 +@@ -1924,6 +1921,11 @@ static int stmmac_release(struct net_device *dev)
1766 + if (priv->lpi_irq > 0)
1767 + free_irq(priv->lpi_irq, dev);
1768 +
1769 ++ if (priv->eee_enabled) {
1770 ++ priv->tx_path_in_lpi_mode = false;
1771 ++ del_timer_sync(&priv->eee_ctrl_timer);
1772 ++ }
1773 ++
1774 + /* Stop TX/RX DMA and clear the descriptors */
1775 + priv->hw->dma->stop_tx(priv->ioaddr);
1776 + priv->hw->dma->stop_rx(priv->ioaddr);
1777 +@@ -3503,6 +3505,11 @@ int stmmac_suspend(struct device *dev)
1778 +
1779 + napi_disable(&priv->napi);
1780 +
1781 ++ if (priv->eee_enabled) {
1782 ++ priv->tx_path_in_lpi_mode = false;
1783 ++ del_timer_sync(&priv->eee_ctrl_timer);
1784 ++ }
1785 ++
1786 + /* Stop TX/RX DMA */
1787 + priv->hw->dma->stop_tx(priv->ioaddr);
1788 + priv->hw->dma->stop_rx(priv->ioaddr);
1789 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
1790 +index e7b873018dca6..e1287c3421165 100644
1791 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
1792 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
1793 +@@ -1904,18 +1904,36 @@ static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr,
1794 + void *buf, int dwords)
1795 + {
1796 + unsigned long flags;
1797 +- int offs, ret = 0;
1798 ++ int offs = 0;
1799 + u32 *vals = buf;
1800 +
1801 +- if (iwl_trans_grab_nic_access(trans, &flags)) {
1802 +- iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr);
1803 +- for (offs = 0; offs < dwords; offs++)
1804 +- vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT);
1805 +- iwl_trans_release_nic_access(trans, &flags);
1806 +- } else {
1807 +- ret = -EBUSY;
1808 ++ while (offs < dwords) {
1809 ++ /* limit the time we spin here under lock to 1/2s */
1810 ++ ktime_t timeout = ktime_add_us(ktime_get(), 500 * USEC_PER_MSEC);
1811 ++
1812 ++ if (iwl_trans_grab_nic_access(trans, &flags)) {
1813 ++ iwl_write32(trans, HBUS_TARG_MEM_RADDR,
1814 ++ addr + 4 * offs);
1815 ++
1816 ++ while (offs < dwords) {
1817 ++ vals[offs] = iwl_read32(trans,
1818 ++ HBUS_TARG_MEM_RDAT);
1819 ++ offs++;
1820 ++
1821 ++ /* calling ktime_get is expensive so
1822 ++ * do it once in 128 reads
1823 ++ */
1824 ++ if (offs % 128 == 0 && ktime_after(ktime_get(),
1825 ++ timeout))
1826 ++ break;
1827 ++ }
1828 ++ iwl_trans_release_nic_access(trans, &flags);
1829 ++ } else {
1830 ++ return -EBUSY;
1831 ++ }
1832 + }
1833 +- return ret;
1834 ++
1835 ++ return 0;
1836 + }
1837 +
1838 + static int iwl_trans_pcie_write_mem(struct iwl_trans *trans, u32 addr,
1839 +diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
1840 +index 4e91c74fcfad9..de928938c7a1c 100644
1841 +--- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
1842 ++++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
1843 +@@ -1224,13 +1224,6 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
1844 + if (skb->len < ETH_HLEN)
1845 + goto drop;
1846 +
1847 +- ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0);
1848 +- if (!ctx)
1849 +- goto busy;
1850 +-
1851 +- memset(ctx->buf, 0, BULK_BUF_SIZE);
1852 +- buf = ctx->buf->data;
1853 +-
1854 + tx_control = 0;
1855 +
1856 + err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control,
1857 +@@ -1238,6 +1231,13 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
1858 + if (err)
1859 + goto drop;
1860 +
1861 ++ ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0);
1862 ++ if (!ctx)
1863 ++ goto drop;
1864 ++
1865 ++ memset(ctx->buf, 0, BULK_BUF_SIZE);
1866 ++ buf = ctx->buf->data;
1867 ++
1868 + {
1869 + __le16 *tx_cntl = (__le16 *)buf;
1870 + *tx_cntl = cpu_to_le16(tx_control);
1871 +diff --git a/drivers/net/wireless/st/cw1200/main.c b/drivers/net/wireless/st/cw1200/main.c
1872 +index 84624c812a15f..f4338bce78f4a 100644
1873 +--- a/drivers/net/wireless/st/cw1200/main.c
1874 ++++ b/drivers/net/wireless/st/cw1200/main.c
1875 +@@ -385,6 +385,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,
1876 + CW1200_LINK_ID_MAX,
1877 + cw1200_skb_dtor,
1878 + priv)) {
1879 ++ destroy_workqueue(priv->workqueue);
1880 + ieee80211_free_hw(hw);
1881 + return NULL;
1882 + }
1883 +@@ -396,6 +397,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,
1884 + for (; i > 0; i--)
1885 + cw1200_queue_deinit(&priv->tx_queue[i - 1]);
1886 + cw1200_queue_stats_deinit(&priv->tx_queue_stats);
1887 ++ destroy_workqueue(priv->workqueue);
1888 + ieee80211_free_hw(hw);
1889 + return NULL;
1890 + }
1891 +diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c
1892 +index 5f97da1947e39..e6ca1f9a7f63e 100644
1893 +--- a/drivers/nfc/s3fwrn5/firmware.c
1894 ++++ b/drivers/nfc/s3fwrn5/firmware.c
1895 +@@ -304,8 +304,10 @@ static int s3fwrn5_fw_request_firmware(struct s3fwrn5_fw_info *fw_info)
1896 + if (ret < 0)
1897 + return ret;
1898 +
1899 +- if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE)
1900 ++ if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE) {
1901 ++ release_firmware(fw->fw);
1902 + return -EINVAL;
1903 ++ }
1904 +
1905 + memcpy(fw->date, fw->fw->data + 0x00, 12);
1906 + fw->date[12] = '\0';
1907 +diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
1908 +index 01a343ad7155c..14d84d5a0f581 100644
1909 +--- a/drivers/pci/slot.c
1910 ++++ b/drivers/pci/slot.c
1911 +@@ -307,6 +307,9 @@ placeholder:
1912 + goto err;
1913 + }
1914 +
1915 ++ INIT_LIST_HEAD(&slot->list);
1916 ++ list_add(&slot->list, &parent->slots);
1917 ++
1918 + err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL,
1919 + "%s", slot_name);
1920 + if (err) {
1921 +@@ -314,9 +317,6 @@ placeholder:
1922 + goto err;
1923 + }
1924 +
1925 +- INIT_LIST_HEAD(&slot->list);
1926 +- list_add(&slot->list, &parent->slots);
1927 +-
1928 + down_read(&pci_bus_sem);
1929 + list_for_each_entry(dev, &parent->devices, bus_list)
1930 + if (PCI_SLOT(dev->devfn) == slot_nr)
1931 +diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
1932 +index fc51922839f82..73d3c4122eb89 100644
1933 +--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
1934 ++++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
1935 +@@ -1266,7 +1266,6 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
1936 + break;
1937 + case PIN_CONFIG_INPUT_DEBOUNCE:
1938 + debounce = readl(db_reg);
1939 +- debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
1940 +
1941 + if (arg)
1942 + conf |= BYT_DEBOUNCE_EN;
1943 +@@ -1275,24 +1274,31 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
1944 +
1945 + switch (arg) {
1946 + case 375:
1947 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
1948 + debounce |= BYT_DEBOUNCE_PULSE_375US;
1949 + break;
1950 + case 750:
1951 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
1952 + debounce |= BYT_DEBOUNCE_PULSE_750US;
1953 + break;
1954 + case 1500:
1955 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
1956 + debounce |= BYT_DEBOUNCE_PULSE_1500US;
1957 + break;
1958 + case 3000:
1959 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
1960 + debounce |= BYT_DEBOUNCE_PULSE_3MS;
1961 + break;
1962 + case 6000:
1963 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
1964 + debounce |= BYT_DEBOUNCE_PULSE_6MS;
1965 + break;
1966 + case 12000:
1967 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
1968 + debounce |= BYT_DEBOUNCE_PULSE_12MS;
1969 + break;
1970 + case 24000:
1971 ++ debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
1972 + debounce |= BYT_DEBOUNCE_PULSE_24MS;
1973 + break;
1974 + default:
1975 +diff --git a/drivers/pinctrl/intel/pinctrl-merrifield.c b/drivers/pinctrl/intel/pinctrl-merrifield.c
1976 +index 04d6fd2be08cc..8d0cff3146b87 100644
1977 +--- a/drivers/pinctrl/intel/pinctrl-merrifield.c
1978 ++++ b/drivers/pinctrl/intel/pinctrl-merrifield.c
1979 +@@ -731,6 +731,10 @@ static int mrfld_config_set_pin(struct mrfld_pinctrl *mp, unsigned int pin,
1980 + mask |= BUFCFG_Px_EN_MASK | BUFCFG_PUPD_VAL_MASK;
1981 + bits |= BUFCFG_PU_EN;
1982 +
1983 ++ /* Set default strength value in case none is given */
1984 ++ if (arg == 1)
1985 ++ arg = 20000;
1986 ++
1987 + switch (arg) {
1988 + case 50000:
1989 + bits |= BUFCFG_PUPD_VAL_50K << BUFCFG_PUPD_VAL_SHIFT;
1990 +@@ -751,6 +755,10 @@ static int mrfld_config_set_pin(struct mrfld_pinctrl *mp, unsigned int pin,
1991 + mask |= BUFCFG_Px_EN_MASK | BUFCFG_PUPD_VAL_MASK;
1992 + bits |= BUFCFG_PD_EN;
1993 +
1994 ++ /* Set default strength value in case none is given */
1995 ++ if (arg == 1)
1996 ++ arg = 20000;
1997 ++
1998 + switch (arg) {
1999 + case 50000:
2000 + bits |= BUFCFG_PUPD_VAL_50K << BUFCFG_PUPD_VAL_SHIFT;
2001 +diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
2002 +index 82fac6261efa1..1bb2493ad1d03 100644
2003 +--- a/drivers/pinctrl/pinctrl-amd.c
2004 ++++ b/drivers/pinctrl/pinctrl-amd.c
2005 +@@ -404,7 +404,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
2006 + pin_reg &= ~BIT(LEVEL_TRIG_OFF);
2007 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
2008 + pin_reg |= ACTIVE_HIGH << ACTIVE_LEVEL_OFF;
2009 +- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF;
2010 + irq_set_handler_locked(d, handle_edge_irq);
2011 + break;
2012 +
2013 +@@ -412,7 +411,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
2014 + pin_reg &= ~BIT(LEVEL_TRIG_OFF);
2015 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
2016 + pin_reg |= ACTIVE_LOW << ACTIVE_LEVEL_OFF;
2017 +- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF;
2018 + irq_set_handler_locked(d, handle_edge_irq);
2019 + break;
2020 +
2021 +@@ -420,7 +418,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
2022 + pin_reg &= ~BIT(LEVEL_TRIG_OFF);
2023 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
2024 + pin_reg |= BOTH_EADGE << ACTIVE_LEVEL_OFF;
2025 +- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF;
2026 + irq_set_handler_locked(d, handle_edge_irq);
2027 + break;
2028 +
2029 +@@ -428,8 +425,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
2030 + pin_reg |= LEVEL_TRIGGER << LEVEL_TRIG_OFF;
2031 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
2032 + pin_reg |= ACTIVE_HIGH << ACTIVE_LEVEL_OFF;
2033 +- pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF);
2034 +- pin_reg |= DB_TYPE_PRESERVE_LOW_GLITCH << DB_CNTRL_OFF;
2035 + irq_set_handler_locked(d, handle_level_irq);
2036 + break;
2037 +
2038 +@@ -437,8 +432,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
2039 + pin_reg |= LEVEL_TRIGGER << LEVEL_TRIG_OFF;
2040 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
2041 + pin_reg |= ACTIVE_LOW << ACTIVE_LEVEL_OFF;
2042 +- pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF);
2043 +- pin_reg |= DB_TYPE_PRESERVE_HIGH_GLITCH << DB_CNTRL_OFF;
2044 + irq_set_handler_locked(d, handle_level_irq);
2045 + break;
2046 +
2047 +diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c
2048 +index 0b0fc2eb48e0b..adcdb0585d398 100644
2049 +--- a/drivers/pinctrl/pinctrl-falcon.c
2050 ++++ b/drivers/pinctrl/pinctrl-falcon.c
2051 +@@ -438,24 +438,28 @@ static int pinctrl_falcon_probe(struct platform_device *pdev)
2052 +
2053 + /* load and remap the pad resources of the different banks */
2054 + for_each_compatible_node(np, NULL, "lantiq,pad-falcon") {
2055 +- struct platform_device *ppdev = of_find_device_by_node(np);
2056 + const __be32 *bank = of_get_property(np, "lantiq,bank", NULL);
2057 + struct resource res;
2058 ++ struct platform_device *ppdev;
2059 + u32 avail;
2060 + int pins;
2061 +
2062 + if (!of_device_is_available(np))
2063 + continue;
2064 +
2065 +- if (!ppdev) {
2066 +- dev_err(&pdev->dev, "failed to find pad pdev\n");
2067 +- continue;
2068 +- }
2069 + if (!bank || *bank >= PORTS)
2070 + continue;
2071 + if (of_address_to_resource(np, 0, &res))
2072 + continue;
2073 ++
2074 ++ ppdev = of_find_device_by_node(np);
2075 ++ if (!ppdev) {
2076 ++ dev_err(&pdev->dev, "failed to find pad pdev\n");
2077 ++ continue;
2078 ++ }
2079 ++
2080 + falcon_info.clk[*bank] = clk_get(&ppdev->dev, NULL);
2081 ++ put_device(&ppdev->dev);
2082 + if (IS_ERR(falcon_info.clk[*bank])) {
2083 + dev_err(&ppdev->dev, "failed to get clock\n");
2084 + return PTR_ERR(falcon_info.clk[*bank]);
2085 +diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
2086 +index 1515c9480f89f..90015e2cce9bf 100644
2087 +--- a/drivers/platform/x86/acer-wmi.c
2088 ++++ b/drivers/platform/x86/acer-wmi.c
2089 +@@ -124,6 +124,7 @@ static const struct key_entry acer_wmi_keymap[] __initconst = {
2090 + {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */
2091 + {KE_IGNORE, 0x81, {KEY_SLEEP} },
2092 + {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad Toggle */
2093 ++ {KE_IGNORE, 0x84, {KEY_KBDILLUMTOGGLE} }, /* Automatic Keyboard background light toggle */
2094 + {KE_KEY, KEY_TOUCHPAD_ON, {KEY_TOUCHPAD_ON} },
2095 + {KE_KEY, KEY_TOUCHPAD_OFF, {KEY_TOUCHPAD_OFF} },
2096 + {KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} },
2097 +diff --git a/drivers/ps3/ps3stor_lib.c b/drivers/ps3/ps3stor_lib.c
2098 +index 8c3f5adf1bc65..2d76183756626 100644
2099 +--- a/drivers/ps3/ps3stor_lib.c
2100 ++++ b/drivers/ps3/ps3stor_lib.c
2101 +@@ -201,7 +201,7 @@ int ps3stor_setup(struct ps3_storage_device *dev, irq_handler_t handler)
2102 + dev->bounce_lpar = ps3_mm_phys_to_lpar(__pa(dev->bounce_buf));
2103 + dev->bounce_dma = dma_map_single(&dev->sbd.core, dev->bounce_buf,
2104 + dev->bounce_size, DMA_BIDIRECTIONAL);
2105 +- if (!dev->bounce_dma) {
2106 ++ if (dma_mapping_error(&dev->sbd.core, dev->bounce_dma)) {
2107 + dev_err(&dev->sbd.core, "%s:%u: map DMA region failed\n",
2108 + __func__, __LINE__);
2109 + error = -ENODEV;
2110 +diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c
2111 +index f40d606f86c98..0569c15fddfe4 100644
2112 +--- a/drivers/s390/block/dasd_alias.c
2113 ++++ b/drivers/s390/block/dasd_alias.c
2114 +@@ -255,7 +255,6 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device)
2115 + return;
2116 + device->discipline->get_uid(device, &uid);
2117 + spin_lock_irqsave(&lcu->lock, flags);
2118 +- list_del_init(&device->alias_list);
2119 + /* make sure that the workers don't use this device */
2120 + if (device == lcu->suc_data.device) {
2121 + spin_unlock_irqrestore(&lcu->lock, flags);
2122 +@@ -282,6 +281,7 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device)
2123 +
2124 + spin_lock_irqsave(&aliastree.lock, flags);
2125 + spin_lock(&lcu->lock);
2126 ++ list_del_init(&device->alias_list);
2127 + if (list_empty(&lcu->grouplist) &&
2128 + list_empty(&lcu->active_devices) &&
2129 + list_empty(&lcu->inactive_devices)) {
2130 +@@ -502,6 +502,14 @@ static int _lcu_update(struct dasd_device *refdev, struct alias_lcu *lcu)
2131 + return rc;
2132 +
2133 + spin_lock_irqsave(&lcu->lock, flags);
2134 ++ /*
2135 ++ * there is another update needed skip the remaining handling
2136 ++ * the data might already be outdated
2137 ++ * but especially do not add the device to an LCU with pending
2138 ++ * update
2139 ++ */
2140 ++ if (lcu->flags & NEED_UAC_UPDATE)
2141 ++ goto out;
2142 + lcu->pav = NO_PAV;
2143 + for (i = 0; i < MAX_DEVICES_PER_LCU; ++i) {
2144 + switch (lcu->uac->unit[i].ua_type) {
2145 +@@ -520,6 +528,7 @@ static int _lcu_update(struct dasd_device *refdev, struct alias_lcu *lcu)
2146 + alias_list) {
2147 + _add_device_to_lcu(lcu, device, refdev);
2148 + }
2149 ++out:
2150 + spin_unlock_irqrestore(&lcu->lock, flags);
2151 + return 0;
2152 + }
2153 +@@ -624,6 +633,7 @@ int dasd_alias_add_device(struct dasd_device *device)
2154 + }
2155 + if (lcu->flags & UPDATE_PENDING) {
2156 + list_move(&device->alias_list, &lcu->active_devices);
2157 ++ private->pavgroup = NULL;
2158 + _schedule_lcu_update(lcu, device);
2159 + }
2160 + spin_unlock_irqrestore(&lcu->lock, flags);
2161 +diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
2162 +index 04788e0b90236..741cc96379cb7 100644
2163 +--- a/drivers/scsi/be2iscsi/be_main.c
2164 ++++ b/drivers/scsi/be2iscsi/be_main.c
2165 +@@ -3052,7 +3052,6 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
2166 + if (!eq_vaddress)
2167 + goto create_eq_error;
2168 +
2169 +- mem->dma = paddr;
2170 + mem->va = eq_vaddress;
2171 + ret = be_fill_queue(eq, phba->params.num_eq_entries,
2172 + sizeof(struct be_eq_entry), eq_vaddress);
2173 +@@ -3062,6 +3061,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
2174 + goto create_eq_error;
2175 + }
2176 +
2177 ++ mem->dma = paddr;
2178 + ret = beiscsi_cmd_eq_create(&phba->ctrl, eq,
2179 + phwi_context->cur_eqd);
2180 + if (ret) {
2181 +@@ -3116,7 +3116,6 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
2182 + if (!cq_vaddress)
2183 + goto create_cq_error;
2184 +
2185 +- mem->dma = paddr;
2186 + ret = be_fill_queue(cq, phba->params.num_cq_entries,
2187 + sizeof(struct sol_cqe), cq_vaddress);
2188 + if (ret) {
2189 +@@ -3126,6 +3125,7 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
2190 + goto create_cq_error;
2191 + }
2192 +
2193 ++ mem->dma = paddr;
2194 + ret = beiscsi_cmd_cq_create(&phba->ctrl, cq, eq, false,
2195 + false, 0);
2196 + if (ret) {
2197 +diff --git a/drivers/scsi/bnx2i/Kconfig b/drivers/scsi/bnx2i/Kconfig
2198 +index ba30ff86d5818..b27a3738d940c 100644
2199 +--- a/drivers/scsi/bnx2i/Kconfig
2200 ++++ b/drivers/scsi/bnx2i/Kconfig
2201 +@@ -3,6 +3,7 @@ config SCSI_BNX2_ISCSI
2202 + depends on NET
2203 + depends on PCI
2204 + depends on (IPV6 || IPV6=n)
2205 ++ depends on MMU
2206 + select SCSI_ISCSI_ATTRS
2207 + select NETDEVICES
2208 + select ETHERNET
2209 +diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
2210 +index 58ce9020d69c5..389c13e1c9788 100644
2211 +--- a/drivers/scsi/fnic/fnic_main.c
2212 ++++ b/drivers/scsi/fnic/fnic_main.c
2213 +@@ -735,6 +735,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2214 + for (i = 0; i < FNIC_IO_LOCKS; i++)
2215 + spin_lock_init(&fnic->io_req_lock[i]);
2216 +
2217 ++ err = -ENOMEM;
2218 + fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache);
2219 + if (!fnic->io_req_pool)
2220 + goto err_out_free_resources;
2221 +diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
2222 +index 601a93953307d..16716b2644020 100644
2223 +--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
2224 ++++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
2225 +@@ -4477,7 +4477,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc)
2226 +
2227 + r = _base_handshake_req_reply_wait(ioc,
2228 + sizeof(Mpi2IOCInitRequest_t), (u32 *)&mpi_request,
2229 +- sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 10);
2230 ++ sizeof(Mpi2IOCInitReply_t), (u16 *)&mpi_reply, 30);
2231 +
2232 + if (r != 0) {
2233 + pr_err(MPT3SAS_FMT "%s: handshake failed (r=%d)\n",
2234 +diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
2235 +index 9fc675f57e336..f54115d74f519 100644
2236 +--- a/drivers/scsi/pm8001/pm8001_init.c
2237 ++++ b/drivers/scsi/pm8001/pm8001_init.c
2238 +@@ -1061,7 +1061,8 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
2239 +
2240 + pm8001_init_sas_add(pm8001_ha);
2241 + /* phy setting support for motherboard controller */
2242 +- if (pm8001_configure_phy_settings(pm8001_ha))
2243 ++ rc = pm8001_configure_phy_settings(pm8001_ha);
2244 ++ if (rc)
2245 + goto err_out_shost;
2246 +
2247 + pm8001_post_sas_ha_init(shost, chip);
2248 +diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c
2249 +index f51fb2ea72001..4c5767c73b7a8 100644
2250 +--- a/drivers/soc/qcom/smp2p.c
2251 ++++ b/drivers/soc/qcom/smp2p.c
2252 +@@ -314,15 +314,16 @@ static int qcom_smp2p_inbound_entry(struct qcom_smp2p *smp2p,
2253 + static int smp2p_update_bits(void *data, u32 mask, u32 value)
2254 + {
2255 + struct smp2p_entry *entry = data;
2256 ++ unsigned long flags;
2257 + u32 orig;
2258 + u32 val;
2259 +
2260 +- spin_lock(&entry->lock);
2261 ++ spin_lock_irqsave(&entry->lock, flags);
2262 + val = orig = readl(entry->value);
2263 + val &= ~mask;
2264 + val |= value;
2265 + writel(val, entry->value);
2266 +- spin_unlock(&entry->lock);
2267 ++ spin_unlock_irqrestore(&entry->lock, flags);
2268 +
2269 + if (val != orig)
2270 + qcom_smp2p_kick(entry->smp2p);
2271 +diff --git a/drivers/soc/tegra/fuse/speedo-tegra210.c b/drivers/soc/tegra/fuse/speedo-tegra210.c
2272 +index 5373f4c16b54c..4403b89561fd6 100644
2273 +--- a/drivers/soc/tegra/fuse/speedo-tegra210.c
2274 ++++ b/drivers/soc/tegra/fuse/speedo-tegra210.c
2275 +@@ -105,7 +105,7 @@ static int get_process_id(int value, const u32 *speedos, unsigned int num)
2276 + unsigned int i;
2277 +
2278 + for (i = 0; i < num; i++)
2279 +- if (value < speedos[num])
2280 ++ if (value < speedos[i])
2281 + return i;
2282 +
2283 + return -EINVAL;
2284 +diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c
2285 +index 1a7b5caa127b5..b86bea4537325 100644
2286 +--- a/drivers/soc/ti/knav_dma.c
2287 ++++ b/drivers/soc/ti/knav_dma.c
2288 +@@ -752,8 +752,9 @@ static int knav_dma_probe(struct platform_device *pdev)
2289 + pm_runtime_enable(kdev->dev);
2290 + ret = pm_runtime_get_sync(kdev->dev);
2291 + if (ret < 0) {
2292 ++ pm_runtime_put_noidle(kdev->dev);
2293 + dev_err(kdev->dev, "unable to enable pktdma, err %d\n", ret);
2294 +- return ret;
2295 ++ goto err_pm_disable;
2296 + }
2297 +
2298 + /* Initialise all packet dmas */
2299 +@@ -767,13 +768,21 @@ static int knav_dma_probe(struct platform_device *pdev)
2300 +
2301 + if (list_empty(&kdev->list)) {
2302 + dev_err(dev, "no valid dma instance\n");
2303 +- return -ENODEV;
2304 ++ ret = -ENODEV;
2305 ++ goto err_put_sync;
2306 + }
2307 +
2308 + debugfs_create_file("knav_dma", S_IFREG | S_IRUGO, NULL, NULL,
2309 + &knav_dma_debug_ops);
2310 +
2311 + return ret;
2312 ++
2313 ++err_put_sync:
2314 ++ pm_runtime_put_sync(kdev->dev);
2315 ++err_pm_disable:
2316 ++ pm_runtime_disable(kdev->dev);
2317 ++
2318 ++ return ret;
2319 + }
2320 +
2321 + static int knav_dma_remove(struct platform_device *pdev)
2322 +diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
2323 +index b73e3534f67b2..5248649b0b41e 100644
2324 +--- a/drivers/soc/ti/knav_qmss_queue.c
2325 ++++ b/drivers/soc/ti/knav_qmss_queue.c
2326 +@@ -1717,6 +1717,7 @@ static int knav_queue_probe(struct platform_device *pdev)
2327 + pm_runtime_enable(&pdev->dev);
2328 + ret = pm_runtime_get_sync(&pdev->dev);
2329 + if (ret < 0) {
2330 ++ pm_runtime_put_noidle(&pdev->dev);
2331 + dev_err(dev, "Failed to enable QMSS\n");
2332 + return ret;
2333 + }
2334 +@@ -1784,9 +1785,10 @@ static int knav_queue_probe(struct platform_device *pdev)
2335 + if (ret)
2336 + goto err;
2337 +
2338 +- regions = of_get_child_by_name(node, "descriptor-regions");
2339 ++ regions = of_get_child_by_name(node, "descriptor-regions");
2340 + if (!regions) {
2341 + dev_err(dev, "descriptor-regions not specified\n");
2342 ++ ret = -ENODEV;
2343 + goto err;
2344 + }
2345 + ret = knav_queue_setup_regions(kdev, regions);
2346 +diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
2347 +index b7995474148c7..e9576658ff3f9 100644
2348 +--- a/drivers/spi/Kconfig
2349 ++++ b/drivers/spi/Kconfig
2350 +@@ -763,4 +763,7 @@ endif # SPI_MASTER
2351 +
2352 + # (slave support would go here)
2353 +
2354 ++config SPI_DYNAMIC
2355 ++ def_bool ACPI || OF_DYNAMIC || SPI_SLAVE
2356 ++
2357 + endif # SPI
2358 +diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c
2359 +index b7f78e6d9bec6..88772efda8304 100644
2360 +--- a/drivers/spi/spi-bcm2835aux.c
2361 ++++ b/drivers/spi/spi-bcm2835aux.c
2362 +@@ -407,7 +407,7 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
2363 + unsigned long clk_hz;
2364 + int err;
2365 +
2366 +- master = spi_alloc_master(&pdev->dev, sizeof(*bs));
2367 ++ master = devm_spi_alloc_master(&pdev->dev, sizeof(*bs));
2368 + if (!master) {
2369 + dev_err(&pdev->dev, "spi_alloc_master() failed\n");
2370 + return -ENOMEM;
2371 +@@ -439,30 +439,27 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
2372 + /* the main area */
2373 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2374 + bs->regs = devm_ioremap_resource(&pdev->dev, res);
2375 +- if (IS_ERR(bs->regs)) {
2376 +- err = PTR_ERR(bs->regs);
2377 +- goto out_master_put;
2378 +- }
2379 ++ if (IS_ERR(bs->regs))
2380 ++ return PTR_ERR(bs->regs);
2381 +
2382 + bs->clk = devm_clk_get(&pdev->dev, NULL);
2383 + if ((!bs->clk) || (IS_ERR(bs->clk))) {
2384 + err = PTR_ERR(bs->clk);
2385 + dev_err(&pdev->dev, "could not get clk: %d\n", err);
2386 +- goto out_master_put;
2387 ++ return err;
2388 + }
2389 +
2390 + bs->irq = platform_get_irq(pdev, 0);
2391 + if (bs->irq <= 0) {
2392 + dev_err(&pdev->dev, "could not get IRQ: %d\n", bs->irq);
2393 +- err = bs->irq ? bs->irq : -ENODEV;
2394 +- goto out_master_put;
2395 ++ return bs->irq ? bs->irq : -ENODEV;
2396 + }
2397 +
2398 + /* this also enables the HW block */
2399 + err = clk_prepare_enable(bs->clk);
2400 + if (err) {
2401 + dev_err(&pdev->dev, "could not prepare clock: %d\n", err);
2402 +- goto out_master_put;
2403 ++ return err;
2404 + }
2405 +
2406 + /* just checking if the clock returns a sane value */
2407 +@@ -495,8 +492,6 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
2408 +
2409 + out_clk_disable:
2410 + clk_disable_unprepare(bs->clk);
2411 +-out_master_put:
2412 +- spi_master_put(master);
2413 + return err;
2414 + }
2415 +
2416 +diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
2417 +index 1905d20c229f0..62ff6130727bf 100644
2418 +--- a/drivers/spi/spi-davinci.c
2419 ++++ b/drivers/spi/spi-davinci.c
2420 +@@ -1099,13 +1099,13 @@ static int davinci_spi_remove(struct platform_device *pdev)
2421 + spi_bitbang_stop(&dspi->bitbang);
2422 +
2423 + clk_disable_unprepare(dspi->clk);
2424 +- spi_master_put(master);
2425 +
2426 + if (dspi->dma_rx) {
2427 + dma_release_channel(dspi->dma_rx);
2428 + dma_release_channel(dspi->dma_tx);
2429 + }
2430 +
2431 ++ spi_master_put(master);
2432 + return 0;
2433 + }
2434 +
2435 +diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
2436 +index 2e65b70c78792..2a340234c85c1 100644
2437 +--- a/drivers/spi/spi-img-spfi.c
2438 ++++ b/drivers/spi/spi-img-spfi.c
2439 +@@ -771,8 +771,10 @@ static int img_spfi_resume(struct device *dev)
2440 + int ret;
2441 +
2442 + ret = pm_runtime_get_sync(dev);
2443 +- if (ret)
2444 ++ if (ret) {
2445 ++ pm_runtime_put_noidle(dev);
2446 + return ret;
2447 ++ }
2448 + spfi_reset(spfi);
2449 + pm_runtime_put(dev);
2450 +
2451 +diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
2452 +index 2f4df804c4d80..9a97ad973c416 100644
2453 +--- a/drivers/spi/spi-pic32.c
2454 ++++ b/drivers/spi/spi-pic32.c
2455 +@@ -839,6 +839,7 @@ static int pic32_spi_probe(struct platform_device *pdev)
2456 + return 0;
2457 +
2458 + err_bailout:
2459 ++ pic32_spi_dma_unprep(pic32s);
2460 + clk_disable_unprepare(pic32s->clk);
2461 + err_master:
2462 + spi_master_put(master);
2463 +diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
2464 +index 3641d0e20135b..1d7fd6dbaf876 100644
2465 +--- a/drivers/spi/spi-rb4xx.c
2466 ++++ b/drivers/spi/spi-rb4xx.c
2467 +@@ -148,7 +148,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
2468 + if (IS_ERR(spi_base))
2469 + return PTR_ERR(spi_base);
2470 +
2471 +- master = spi_alloc_master(&pdev->dev, sizeof(*rbspi));
2472 ++ master = devm_spi_alloc_master(&pdev->dev, sizeof(*rbspi));
2473 + if (!master)
2474 + return -ENOMEM;
2475 +
2476 +diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c
2477 +index f63714ffb62f4..e4306a0f7f173 100644
2478 +--- a/drivers/spi/spi-sc18is602.c
2479 ++++ b/drivers/spi/spi-sc18is602.c
2480 +@@ -247,13 +247,12 @@ static int sc18is602_probe(struct i2c_client *client,
2481 + struct sc18is602_platform_data *pdata = dev_get_platdata(dev);
2482 + struct sc18is602 *hw;
2483 + struct spi_master *master;
2484 +- int error;
2485 +
2486 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C |
2487 + I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
2488 + return -EINVAL;
2489 +
2490 +- master = spi_alloc_master(dev, sizeof(struct sc18is602));
2491 ++ master = devm_spi_alloc_master(dev, sizeof(struct sc18is602));
2492 + if (!master)
2493 + return -ENOMEM;
2494 +
2495 +@@ -304,15 +303,7 @@ static int sc18is602_probe(struct i2c_client *client,
2496 + master->min_speed_hz = hw->freq / 128;
2497 + master->max_speed_hz = hw->freq / 4;
2498 +
2499 +- error = devm_spi_register_master(dev, master);
2500 +- if (error)
2501 +- goto error_reg;
2502 +-
2503 +- return 0;
2504 +-
2505 +-error_reg:
2506 +- spi_master_put(master);
2507 +- return error;
2508 ++ return devm_spi_register_master(dev, master);
2509 + }
2510 +
2511 + static const struct i2c_device_id sc18is602_id[] = {
2512 +diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c
2513 +index 2bf53f0e27d9e..e1fd29068777d 100644
2514 +--- a/drivers/spi/spi-sh.c
2515 ++++ b/drivers/spi/spi-sh.c
2516 +@@ -450,7 +450,7 @@ static int spi_sh_probe(struct platform_device *pdev)
2517 + return -ENODEV;
2518 + }
2519 +
2520 +- master = spi_alloc_master(&pdev->dev, sizeof(struct spi_sh_data));
2521 ++ master = devm_spi_alloc_master(&pdev->dev, sizeof(struct spi_sh_data));
2522 + if (master == NULL) {
2523 + dev_err(&pdev->dev, "spi_alloc_master error.\n");
2524 + return -ENOMEM;
2525 +@@ -468,16 +468,14 @@ static int spi_sh_probe(struct platform_device *pdev)
2526 + break;
2527 + default:
2528 + dev_err(&pdev->dev, "No support width\n");
2529 +- ret = -ENODEV;
2530 +- goto error1;
2531 ++ return -ENODEV;
2532 + }
2533 + ss->irq = irq;
2534 + ss->master = master;
2535 + ss->addr = devm_ioremap(&pdev->dev, res->start, resource_size(res));
2536 + if (ss->addr == NULL) {
2537 + dev_err(&pdev->dev, "ioremap error.\n");
2538 +- ret = -ENOMEM;
2539 +- goto error1;
2540 ++ return -ENOMEM;
2541 + }
2542 + INIT_LIST_HEAD(&ss->queue);
2543 + spin_lock_init(&ss->lock);
2544 +@@ -487,7 +485,7 @@ static int spi_sh_probe(struct platform_device *pdev)
2545 + ret = request_irq(irq, spi_sh_irq, 0, "spi_sh", ss);
2546 + if (ret < 0) {
2547 + dev_err(&pdev->dev, "request_irq error\n");
2548 +- goto error1;
2549 ++ return ret;
2550 + }
2551 +
2552 + master->num_chipselect = 2;
2553 +@@ -506,9 +504,6 @@ static int spi_sh_probe(struct platform_device *pdev)
2554 +
2555 + error3:
2556 + free_irq(irq, ss);
2557 +- error1:
2558 +- spi_master_put(master);
2559 +-
2560 + return ret;
2561 + }
2562 +
2563 +diff --git a/drivers/spi/spi-st-ssc4.c b/drivers/spi/spi-st-ssc4.c
2564 +index 710adbc2485f5..05f7316d5a522 100644
2565 +--- a/drivers/spi/spi-st-ssc4.c
2566 ++++ b/drivers/spi/spi-st-ssc4.c
2567 +@@ -379,13 +379,14 @@ static int spi_st_probe(struct platform_device *pdev)
2568 + ret = devm_spi_register_master(&pdev->dev, master);
2569 + if (ret) {
2570 + dev_err(&pdev->dev, "Failed to register master\n");
2571 +- goto clk_disable;
2572 ++ goto rpm_disable;
2573 + }
2574 +
2575 + return 0;
2576 +
2577 +-clk_disable:
2578 ++rpm_disable:
2579 + pm_runtime_disable(&pdev->dev);
2580 ++clk_disable:
2581 + clk_disable_unprepare(spi_st->clk);
2582 + put_master:
2583 + spi_master_put(master);
2584 +diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
2585 +index e37712bed0b2d..d1ca8f619b828 100644
2586 +--- a/drivers/spi/spi-tegra114.c
2587 ++++ b/drivers/spi/spi-tegra114.c
2588 +@@ -801,6 +801,7 @@ static int tegra_spi_setup(struct spi_device *spi)
2589 +
2590 + ret = pm_runtime_get_sync(tspi->dev);
2591 + if (ret < 0) {
2592 ++ pm_runtime_put_noidle(tspi->dev);
2593 + dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
2594 + return ret;
2595 + }
2596 +@@ -1214,6 +1215,7 @@ static int tegra_spi_resume(struct device *dev)
2597 +
2598 + ret = pm_runtime_get_sync(dev);
2599 + if (ret < 0) {
2600 ++ pm_runtime_put_noidle(dev);
2601 + dev_err(dev, "pm runtime failed, e = %d\n", ret);
2602 + return ret;
2603 + }
2604 +diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
2605 +index b6558bb6f9dfc..4b9541e1726a5 100644
2606 +--- a/drivers/spi/spi-tegra20-sflash.c
2607 ++++ b/drivers/spi/spi-tegra20-sflash.c
2608 +@@ -564,6 +564,7 @@ static int tegra_sflash_resume(struct device *dev)
2609 +
2610 + ret = pm_runtime_get_sync(dev);
2611 + if (ret < 0) {
2612 ++ pm_runtime_put_noidle(dev);
2613 + dev_err(dev, "pm runtime failed, e = %d\n", ret);
2614 + return ret;
2615 + }
2616 +diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
2617 +index cf2a329fd8958..9f14560686b68 100644
2618 +--- a/drivers/spi/spi-tegra20-slink.c
2619 ++++ b/drivers/spi/spi-tegra20-slink.c
2620 +@@ -761,6 +761,7 @@ static int tegra_slink_setup(struct spi_device *spi)
2621 +
2622 + ret = pm_runtime_get_sync(tspi->dev);
2623 + if (ret < 0) {
2624 ++ pm_runtime_put_noidle(tspi->dev);
2625 + dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
2626 + return ret;
2627 + }
2628 +@@ -1197,6 +1198,7 @@ static int tegra_slink_resume(struct device *dev)
2629 +
2630 + ret = pm_runtime_get_sync(dev);
2631 + if (ret < 0) {
2632 ++ pm_runtime_put_noidle(dev);
2633 + dev_err(dev, "pm runtime failed, e = %d\n", ret);
2634 + return ret;
2635 + }
2636 +diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
2637 +index 4cb72a8e46460..b0a5486936c01 100644
2638 +--- a/drivers/spi/spi-ti-qspi.c
2639 ++++ b/drivers/spi/spi-ti-qspi.c
2640 +@@ -175,6 +175,7 @@ static int ti_qspi_setup(struct spi_device *spi)
2641 +
2642 + ret = pm_runtime_get_sync(qspi->dev);
2643 + if (ret < 0) {
2644 ++ pm_runtime_put_noidle(qspi->dev);
2645 + dev_err(qspi->dev, "pm_runtime_get_sync() failed\n");
2646 + return ret;
2647 + }
2648 +diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
2649 +index e0632ee1723b0..f0ba5eb26128b 100644
2650 +--- a/drivers/spi/spi.c
2651 ++++ b/drivers/spi/spi.c
2652 +@@ -422,6 +422,12 @@ static LIST_HEAD(spi_master_list);
2653 + */
2654 + static DEFINE_MUTEX(board_lock);
2655 +
2656 ++/*
2657 ++ * Prevents addition of devices with same chip select and
2658 ++ * addition of devices below an unregistering controller.
2659 ++ */
2660 ++static DEFINE_MUTEX(spi_add_lock);
2661 ++
2662 + /**
2663 + * spi_alloc_device - Allocate a new SPI device
2664 + * @master: Controller to which device is connected
2665 +@@ -500,7 +506,6 @@ static int spi_dev_check(struct device *dev, void *data)
2666 + */
2667 + int spi_add_device(struct spi_device *spi)
2668 + {
2669 +- static DEFINE_MUTEX(spi_add_lock);
2670 + struct spi_master *master = spi->master;
2671 + struct device *dev = master->dev.parent;
2672 + int status;
2673 +@@ -529,6 +534,13 @@ int spi_add_device(struct spi_device *spi)
2674 + goto done;
2675 + }
2676 +
2677 ++ /* Controller may unregister concurrently */
2678 ++ if (IS_ENABLED(CONFIG_SPI_DYNAMIC) &&
2679 ++ !device_is_registered(&master->dev)) {
2680 ++ status = -ENODEV;
2681 ++ goto done;
2682 ++ }
2683 ++
2684 + if (master->cs_gpios)
2685 + spi->cs_gpio = master->cs_gpios[spi->chip_select];
2686 +
2687 +@@ -2070,6 +2082,10 @@ static int __unregister(struct device *dev, void *null)
2688 + */
2689 + void spi_unregister_master(struct spi_master *master)
2690 + {
2691 ++ /* Prevent addition of new devices, unregister existing ones */
2692 ++ if (IS_ENABLED(CONFIG_SPI_DYNAMIC))
2693 ++ mutex_lock(&spi_add_lock);
2694 ++
2695 + device_for_each_child(&master->dev, NULL, __unregister);
2696 +
2697 + if (master->queued) {
2698 +@@ -2089,6 +2105,9 @@ void spi_unregister_master(struct spi_master *master)
2699 + if (!devres_find(master->dev.parent, devm_spi_release_master,
2700 + devm_spi_match_master, master))
2701 + put_device(&master->dev);
2702 ++
2703 ++ if (IS_ENABLED(CONFIG_SPI_DYNAMIC))
2704 ++ mutex_unlock(&spi_add_lock);
2705 + }
2706 + EXPORT_SYMBOL_GPL(spi_unregister_master);
2707 +
2708 +diff --git a/drivers/staging/comedi/drivers/mf6x4.c b/drivers/staging/comedi/drivers/mf6x4.c
2709 +index fbdf181d8cccc..40aa24a9b2c30 100644
2710 +--- a/drivers/staging/comedi/drivers/mf6x4.c
2711 ++++ b/drivers/staging/comedi/drivers/mf6x4.c
2712 +@@ -121,8 +121,9 @@ static int mf6x4_ai_eoc(struct comedi_device *dev,
2713 + struct mf6x4_private *devpriv = dev->private;
2714 + unsigned int status;
2715 +
2716 ++ /* EOLC goes low at end of conversion. */
2717 + status = ioread32(devpriv->gpioc_reg);
2718 +- if (status & MF6X4_GPIOC_EOLC)
2719 ++ if ((status & MF6X4_GPIOC_EOLC) == 0)
2720 + return 0;
2721 + return -EBUSY;
2722 + }
2723 +diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
2724 +index 8a0744b58a329..4c2d6c2d4fb41 100644
2725 +--- a/drivers/staging/greybus/audio_codec.c
2726 ++++ b/drivers/staging/greybus/audio_codec.c
2727 +@@ -491,6 +491,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream *substream,
2728 + if (ret) {
2729 + dev_err_ratelimited(dai->dev, "%d: Error during set_config\n",
2730 + ret);
2731 ++ gb_pm_runtime_put_noidle(bundle);
2732 + mutex_unlock(&codec->lock);
2733 + return ret;
2734 + }
2735 +@@ -562,6 +563,7 @@ static int gbcodec_prepare(struct snd_pcm_substream *substream,
2736 + break;
2737 + }
2738 + if (ret) {
2739 ++ gb_pm_runtime_put_noidle(bundle);
2740 + mutex_unlock(&codec->lock);
2741 + dev_err_ratelimited(dai->dev, "set_data_size failed:%d\n",
2742 + ret);
2743 +diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c
2744 +index 764656759fbf4..1079b11fff4bc 100644
2745 +--- a/drivers/staging/speakup/speakup_dectlk.c
2746 ++++ b/drivers/staging/speakup/speakup_dectlk.c
2747 +@@ -47,7 +47,7 @@ static unsigned char get_index(void);
2748 + static int in_escape;
2749 + static int is_flushing;
2750 +
2751 +-static spinlock_t flush_lock;
2752 ++static DEFINE_SPINLOCK(flush_lock);
2753 + static DECLARE_WAIT_QUEUE_HEAD(flush);
2754 +
2755 + static struct var_t vars[] = {
2756 +diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
2757 +index d41be02abced2..c551407bee07b 100644
2758 +--- a/drivers/tty/serial/8250/8250_omap.c
2759 ++++ b/drivers/tty/serial/8250/8250_omap.c
2760 +@@ -161,11 +161,6 @@ static void omap_8250_mdr1_errataset(struct uart_8250_port *up,
2761 + struct omap8250_priv *priv)
2762 + {
2763 + u8 timeout = 255;
2764 +- u8 old_mdr1;
2765 +-
2766 +- old_mdr1 = serial_in(up, UART_OMAP_MDR1);
2767 +- if (old_mdr1 == priv->mdr1)
2768 +- return;
2769 +
2770 + serial_out(up, UART_OMAP_MDR1, priv->mdr1);
2771 + udelay(2);
2772 +diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
2773 +index 3701b240fcb30..74a1a97a77b28 100644
2774 +--- a/drivers/tty/serial/serial_core.c
2775 ++++ b/drivers/tty/serial/serial_core.c
2776 +@@ -1415,6 +1415,10 @@ static void uart_set_ldisc(struct tty_struct *tty)
2777 + {
2778 + struct uart_state *state = tty->driver_data;
2779 + struct uart_port *uport;
2780 ++ struct tty_port *port = &state->port;
2781 ++
2782 ++ if (!tty_port_initialized(port))
2783 ++ return;
2784 +
2785 + mutex_lock(&state->port.mutex);
2786 + uport = uart_port_check(state);
2787 +diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
2788 +index 099179457f60c..7ea84e6c85bb8 100644
2789 +--- a/drivers/usb/chipidea/ci_hdrc_imx.c
2790 ++++ b/drivers/usb/chipidea/ci_hdrc_imx.c
2791 +@@ -63,7 +63,8 @@ static const struct ci_hdrc_imx_platform_flag imx6sx_usb_data = {
2792 +
2793 + static const struct ci_hdrc_imx_platform_flag imx6ul_usb_data = {
2794 + .flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
2795 +- CI_HDRC_TURN_VBUS_EARLY_ON,
2796 ++ CI_HDRC_TURN_VBUS_EARLY_ON |
2797 ++ CI_HDRC_DISABLE_DEVICE_STREAMING,
2798 + };
2799 +
2800 + static const struct ci_hdrc_imx_platform_flag imx7d_usb_data = {
2801 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
2802 +index 34d8cece6dd3b..5d109717ac4e3 100644
2803 +--- a/drivers/usb/core/quirks.c
2804 ++++ b/drivers/usb/core/quirks.c
2805 +@@ -189,6 +189,9 @@ static const struct usb_device_id usb_quirk_list[] = {
2806 + { USB_DEVICE(0x06a3, 0x0006), .driver_info =
2807 + USB_QUIRK_CONFIG_INTF_STRINGS },
2808 +
2809 ++ /* Agfa SNAPSCAN 1212U */
2810 ++ { USB_DEVICE(0x06bd, 0x0001), .driver_info = USB_QUIRK_RESET_RESUME },
2811 ++
2812 + /* Guillemot Webcam Hercules Dualpix Exchange (2nd ID) */
2813 + { USB_DEVICE(0x06f8, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME },
2814 +
2815 +diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c
2816 +index 5e3828d9dac7f..7a135a36d1a2f 100644
2817 +--- a/drivers/usb/gadget/function/f_acm.c
2818 ++++ b/drivers/usb/gadget/function/f_acm.c
2819 +@@ -687,7 +687,7 @@ acm_bind(struct usb_configuration *c, struct usb_function *f)
2820 + acm_ss_out_desc.bEndpointAddress = acm_fs_out_desc.bEndpointAddress;
2821 +
2822 + status = usb_assign_descriptors(f, acm_fs_function, acm_hs_function,
2823 +- acm_ss_function, NULL);
2824 ++ acm_ss_function, acm_ss_function);
2825 + if (status)
2826 + goto fail;
2827 +
2828 +diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
2829 +index 68489557752da..26fcbb92c4ba7 100644
2830 +--- a/drivers/usb/gadget/function/f_fs.c
2831 ++++ b/drivers/usb/gadget/function/f_fs.c
2832 +@@ -1228,6 +1228,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
2833 +
2834 + switch (epfile->ffs->gadget->speed) {
2835 + case USB_SPEED_SUPER:
2836 ++ case USB_SPEED_SUPER_PLUS:
2837 + desc_idx = 2;
2838 + break;
2839 + case USB_SPEED_HIGH:
2840 +@@ -3067,7 +3068,8 @@ static int _ffs_func_bind(struct usb_configuration *c,
2841 + }
2842 +
2843 + if (likely(super)) {
2844 +- func->function.ss_descriptors = vla_ptr(vlabuf, d, ss_descs);
2845 ++ func->function.ss_descriptors = func->function.ssp_descriptors =
2846 ++ vla_ptr(vlabuf, d, ss_descs);
2847 + ss_len = ffs_do_descs(ffs->ss_descs_count,
2848 + vla_ptr(vlabuf, d, raw_descs) + fs_len + hs_len,
2849 + d_raw_descs__sz - fs_len - hs_len,
2850 +@@ -3507,6 +3509,7 @@ static void ffs_func_unbind(struct usb_configuration *c,
2851 + func->function.fs_descriptors = NULL;
2852 + func->function.hs_descriptors = NULL;
2853 + func->function.ss_descriptors = NULL;
2854 ++ func->function.ssp_descriptors = NULL;
2855 + func->interfaces_nums = NULL;
2856 +
2857 + ffs_event_add(ffs, FUNCTIONFS_UNBIND);
2858 +diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
2859 +index cab5fbd5b9557..58e82082d8228 100644
2860 +--- a/drivers/usb/gadget/function/f_midi.c
2861 ++++ b/drivers/usb/gadget/function/f_midi.c
2862 +@@ -1008,6 +1008,12 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
2863 + f->hs_descriptors = usb_copy_descriptors(midi_function);
2864 + if (!f->hs_descriptors)
2865 + goto fail_f_midi;
2866 ++
2867 ++ if (gadget_is_superspeed_plus(c->cdev->gadget)) {
2868 ++ f->ssp_descriptors = usb_copy_descriptors(midi_function);
2869 ++ if (!f->ssp_descriptors)
2870 ++ goto fail_f_midi;
2871 ++ }
2872 + }
2873 +
2874 + kfree(midi_function);
2875 +diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
2876 +index 865cb070bf8b3..2f310973155a5 100644
2877 +--- a/drivers/usb/gadget/function/f_rndis.c
2878 ++++ b/drivers/usb/gadget/function/f_rndis.c
2879 +@@ -91,8 +91,10 @@ static inline struct f_rndis *func_to_rndis(struct usb_function *f)
2880 + /* peak (theoretical) bulk transfer rate in bits-per-second */
2881 + static unsigned int bitrate(struct usb_gadget *g)
2882 + {
2883 ++ if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER_PLUS)
2884 ++ return 4250000000U;
2885 + if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER)
2886 +- return 13 * 1024 * 8 * 1000 * 8;
2887 ++ return 3750000000U;
2888 + else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
2889 + return 13 * 512 * 8 * 1000 * 8;
2890 + else
2891 +diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
2892 +index 2f7023a289c94..9fdb567a09be6 100644
2893 +--- a/drivers/usb/gadget/udc/dummy_hcd.c
2894 ++++ b/drivers/usb/gadget/udc/dummy_hcd.c
2895 +@@ -2736,7 +2736,7 @@ static int __init init(void)
2896 + {
2897 + int retval = -ENOMEM;
2898 + int i;
2899 +- struct dummy *dum[MAX_NUM_UDC];
2900 ++ struct dummy *dum[MAX_NUM_UDC] = {};
2901 +
2902 + if (usb_disabled())
2903 + return -ENODEV;
2904 +diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
2905 +index 94ea9fff13e6d..9227a9ddac609 100644
2906 +--- a/drivers/usb/host/ehci-omap.c
2907 ++++ b/drivers/usb/host/ehci-omap.c
2908 +@@ -237,6 +237,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
2909 +
2910 + err_pm_runtime:
2911 + pm_runtime_put_sync(dev);
2912 ++ pm_runtime_disable(dev);
2913 +
2914 + err_phy:
2915 + for (i = 0; i < omap->nports; i++) {
2916 +diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
2917 +index 4e4d601af35c1..2f48da0c0bb39 100644
2918 +--- a/drivers/usb/host/oxu210hp-hcd.c
2919 ++++ b/drivers/usb/host/oxu210hp-hcd.c
2920 +@@ -3734,8 +3734,10 @@ static struct usb_hcd *oxu_create(struct platform_device *pdev,
2921 + oxu->is_otg = otg;
2922 +
2923 + ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
2924 +- if (ret < 0)
2925 ++ if (ret < 0) {
2926 ++ usb_put_hcd(hcd);
2927 + return ERR_PTR(ret);
2928 ++ }
2929 +
2930 + device_wakeup_enable(hcd->self.controller);
2931 + return hcd;
2932 +diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
2933 +index 194ea29d7a57e..4ad71479c4490 100644
2934 +--- a/drivers/usb/host/xhci-hub.c
2935 ++++ b/drivers/usb/host/xhci-hub.c
2936 +@@ -1424,6 +1424,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
2937 + hcd->state = HC_STATE_SUSPENDED;
2938 + bus_state->next_statechange = jiffies + msecs_to_jiffies(10);
2939 + spin_unlock_irqrestore(&xhci->lock, flags);
2940 ++
2941 ++ if (bus_state->bus_suspended)
2942 ++ usleep_range(5000, 10000);
2943 ++
2944 + return 0;
2945 + }
2946 +
2947 +diff --git a/drivers/usb/misc/sisusbvga/Kconfig b/drivers/usb/misc/sisusbvga/Kconfig
2948 +index 36bc28c884ad7..47dabccafef43 100644
2949 +--- a/drivers/usb/misc/sisusbvga/Kconfig
2950 ++++ b/drivers/usb/misc/sisusbvga/Kconfig
2951 +@@ -15,7 +15,7 @@ config USB_SISUSBVGA
2952 +
2953 + config USB_SISUSBVGA_CON
2954 + bool "Text console and mode switching support" if USB_SISUSBVGA
2955 +- depends on VT
2956 ++ depends on VT && BROKEN
2957 + select FONT_8x16
2958 + ---help---
2959 + Say Y here if you want a VGA text console via the USB dongle or
2960 +diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
2961 +index d17f7872f95ae..93a31ea8e210c 100644
2962 +--- a/drivers/usb/serial/keyspan_pda.c
2963 ++++ b/drivers/usb/serial/keyspan_pda.c
2964 +@@ -44,11 +44,12 @@
2965 + #define DRIVER_AUTHOR "Brian Warner <warner@××××××.com>"
2966 + #define DRIVER_DESC "USB Keyspan PDA Converter driver"
2967 +
2968 ++#define KEYSPAN_TX_THRESHOLD 16
2969 ++
2970 + struct keyspan_pda_private {
2971 + int tx_room;
2972 + int tx_throttled;
2973 +- struct work_struct wakeup_work;
2974 +- struct work_struct unthrottle_work;
2975 ++ struct work_struct unthrottle_work;
2976 + struct usb_serial *serial;
2977 + struct usb_serial_port *port;
2978 + };
2979 +@@ -101,15 +102,6 @@ static const struct usb_device_id id_table_fake_xircom[] = {
2980 + };
2981 + #endif
2982 +
2983 +-static void keyspan_pda_wakeup_write(struct work_struct *work)
2984 +-{
2985 +- struct keyspan_pda_private *priv =
2986 +- container_of(work, struct keyspan_pda_private, wakeup_work);
2987 +- struct usb_serial_port *port = priv->port;
2988 +-
2989 +- tty_port_tty_wakeup(&port->port);
2990 +-}
2991 +-
2992 + static void keyspan_pda_request_unthrottle(struct work_struct *work)
2993 + {
2994 + struct keyspan_pda_private *priv =
2995 +@@ -124,7 +116,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work)
2996 + 7, /* request_unthrottle */
2997 + USB_TYPE_VENDOR | USB_RECIP_INTERFACE
2998 + | USB_DIR_OUT,
2999 +- 16, /* value: threshold */
3000 ++ KEYSPAN_TX_THRESHOLD,
3001 + 0, /* index */
3002 + NULL,
3003 + 0,
3004 +@@ -143,6 +135,8 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
3005 + int retval;
3006 + int status = urb->status;
3007 + struct keyspan_pda_private *priv;
3008 ++ unsigned long flags;
3009 ++
3010 + priv = usb_get_serial_port_data(port);
3011 +
3012 + switch (status) {
3013 +@@ -176,18 +170,21 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
3014 + break;
3015 + case 1:
3016 + /* status interrupt */
3017 +- if (len < 3) {
3018 ++ if (len < 2) {
3019 + dev_warn(&port->dev, "short interrupt message received\n");
3020 + break;
3021 + }
3022 +- dev_dbg(&port->dev, "rx int, d1=%d, d2=%d\n", data[1], data[2]);
3023 ++ dev_dbg(&port->dev, "rx int, d1=%d\n", data[1]);
3024 + switch (data[1]) {
3025 + case 1: /* modemline change */
3026 + break;
3027 + case 2: /* tx unthrottle interrupt */
3028 ++ spin_lock_irqsave(&port->lock, flags);
3029 + priv->tx_throttled = 0;
3030 ++ priv->tx_room = max(priv->tx_room, KEYSPAN_TX_THRESHOLD);
3031 ++ spin_unlock_irqrestore(&port->lock, flags);
3032 + /* queue up a wakeup at scheduler time */
3033 +- schedule_work(&priv->wakeup_work);
3034 ++ usb_serial_port_softint(port);
3035 + break;
3036 + default:
3037 + break;
3038 +@@ -447,6 +444,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
3039 + int request_unthrottle = 0;
3040 + int rc = 0;
3041 + struct keyspan_pda_private *priv;
3042 ++ unsigned long flags;
3043 +
3044 + priv = usb_get_serial_port_data(port);
3045 + /* guess how much room is left in the device's ring buffer, and if we
3046 +@@ -466,13 +464,13 @@ static int keyspan_pda_write(struct tty_struct *tty,
3047 + the TX urb is in-flight (wait until it completes)
3048 + the device is full (wait until it says there is room)
3049 + */
3050 +- spin_lock_bh(&port->lock);
3051 ++ spin_lock_irqsave(&port->lock, flags);
3052 + if (!test_bit(0, &port->write_urbs_free) || priv->tx_throttled) {
3053 +- spin_unlock_bh(&port->lock);
3054 ++ spin_unlock_irqrestore(&port->lock, flags);
3055 + return 0;
3056 + }
3057 + clear_bit(0, &port->write_urbs_free);
3058 +- spin_unlock_bh(&port->lock);
3059 ++ spin_unlock_irqrestore(&port->lock, flags);
3060 +
3061 + /* At this point the URB is in our control, nobody else can submit it
3062 + again (the only sudden transition was the one from EINPROGRESS to
3063 +@@ -518,7 +516,8 @@ static int keyspan_pda_write(struct tty_struct *tty,
3064 + goto exit;
3065 + }
3066 + }
3067 +- if (count > priv->tx_room) {
3068 ++
3069 ++ if (count >= priv->tx_room) {
3070 + /* we're about to completely fill the Tx buffer, so
3071 + we'll be throttled afterwards. */
3072 + count = priv->tx_room;
3073 +@@ -551,7 +550,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
3074 +
3075 + rc = count;
3076 + exit:
3077 +- if (rc < 0)
3078 ++ if (rc <= 0)
3079 + set_bit(0, &port->write_urbs_free);
3080 + return rc;
3081 + }
3082 +@@ -566,21 +565,24 @@ static void keyspan_pda_write_bulk_callback(struct urb *urb)
3083 + priv = usb_get_serial_port_data(port);
3084 +
3085 + /* queue up a wakeup at scheduler time */
3086 +- schedule_work(&priv->wakeup_work);
3087 ++ usb_serial_port_softint(port);
3088 + }
3089 +
3090 +
3091 + static int keyspan_pda_write_room(struct tty_struct *tty)
3092 + {
3093 + struct usb_serial_port *port = tty->driver_data;
3094 +- struct keyspan_pda_private *priv;
3095 +- priv = usb_get_serial_port_data(port);
3096 +- /* used by n_tty.c for processing of tabs and such. Giving it our
3097 +- conservative guess is probably good enough, but needs testing by
3098 +- running a console through the device. */
3099 +- return priv->tx_room;
3100 +-}
3101 ++ struct keyspan_pda_private *priv = usb_get_serial_port_data(port);
3102 ++ unsigned long flags;
3103 ++ int room = 0;
3104 +
3105 ++ spin_lock_irqsave(&port->lock, flags);
3106 ++ if (test_bit(0, &port->write_urbs_free) && !priv->tx_throttled)
3107 ++ room = priv->tx_room;
3108 ++ spin_unlock_irqrestore(&port->lock, flags);
3109 ++
3110 ++ return room;
3111 ++}
3112 +
3113 + static int keyspan_pda_chars_in_buffer(struct tty_struct *tty)
3114 + {
3115 +@@ -660,8 +662,12 @@ error:
3116 + }
3117 + static void keyspan_pda_close(struct usb_serial_port *port)
3118 + {
3119 ++ struct keyspan_pda_private *priv = usb_get_serial_port_data(port);
3120 ++
3121 + usb_kill_urb(port->write_urb);
3122 + usb_kill_urb(port->interrupt_in_urb);
3123 ++
3124 ++ cancel_work_sync(&priv->unthrottle_work);
3125 + }
3126 +
3127 +
3128 +@@ -732,7 +738,6 @@ static int keyspan_pda_port_probe(struct usb_serial_port *port)
3129 + if (!priv)
3130 + return -ENOMEM;
3131 +
3132 +- INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write);
3133 + INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle);
3134 + priv->serial = port->serial;
3135 + priv->port = port;
3136 +diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
3137 +index 14b45f3e6388a..76c9276b2d75f 100644
3138 +--- a/drivers/usb/serial/mos7720.c
3139 ++++ b/drivers/usb/serial/mos7720.c
3140 +@@ -640,6 +640,8 @@ static void parport_mos7715_restore_state(struct parport *pp,
3141 + spin_unlock(&release_lock);
3142 + return;
3143 + }
3144 ++ mos_parport->shadowDCR = s->u.pc.ctr;
3145 ++ mos_parport->shadowECR = s->u.pc.ecr;
3146 + write_parport_reg_nonblock(mos_parport, MOS7720_DCR,
3147 + mos_parport->shadowDCR);
3148 + write_parport_reg_nonblock(mos_parport, MOS7720_ECR,
3149 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
3150 +index e8643612e9a39..6045a8e24068c 100644
3151 +--- a/drivers/usb/serial/option.c
3152 ++++ b/drivers/usb/serial/option.c
3153 +@@ -563,6 +563,9 @@ static void option_instat_callback(struct urb *urb);
3154 +
3155 + /* Device flags */
3156 +
3157 ++/* Highest interface number which can be used with NCTRL() and RSVD() */
3158 ++#define FLAG_IFNUM_MAX 7
3159 ++
3160 + /* Interface does not support modem-control requests */
3161 + #define NCTRL(ifnum) ((BIT(ifnum) & 0xff) << 8)
3162 +
3163 +@@ -2086,6 +2089,14 @@ static struct usb_serial_driver * const serial_drivers[] = {
3164 +
3165 + module_usb_serial_driver(serial_drivers, option_ids);
3166 +
3167 ++static bool iface_is_reserved(unsigned long device_flags, u8 ifnum)
3168 ++{
3169 ++ if (ifnum > FLAG_IFNUM_MAX)
3170 ++ return false;
3171 ++
3172 ++ return device_flags & RSVD(ifnum);
3173 ++}
3174 ++
3175 + static int option_probe(struct usb_serial *serial,
3176 + const struct usb_device_id *id)
3177 + {
3178 +@@ -2103,7 +2114,7 @@ static int option_probe(struct usb_serial *serial,
3179 + * the same class/subclass/protocol as the serial interfaces. Look at
3180 + * the Windows driver .INF files for reserved interface numbers.
3181 + */
3182 +- if (device_flags & RSVD(iface_desc->bInterfaceNumber))
3183 ++ if (iface_is_reserved(device_flags, iface_desc->bInterfaceNumber))
3184 + return -ENODEV;
3185 + /*
3186 + * Don't bind network interface on Samsung GT-B3730, it is handled by
3187 +@@ -2120,6 +2131,14 @@ static int option_probe(struct usb_serial *serial,
3188 + return 0;
3189 + }
3190 +
3191 ++static bool iface_no_modem_control(unsigned long device_flags, u8 ifnum)
3192 ++{
3193 ++ if (ifnum > FLAG_IFNUM_MAX)
3194 ++ return false;
3195 ++
3196 ++ return device_flags & NCTRL(ifnum);
3197 ++}
3198 ++
3199 + static int option_attach(struct usb_serial *serial)
3200 + {
3201 + struct usb_interface_descriptor *iface_desc;
3202 +@@ -2135,7 +2154,7 @@ static int option_attach(struct usb_serial *serial)
3203 +
3204 + iface_desc = &serial->interface->cur_altsetting->desc;
3205 +
3206 +- if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber)))
3207 ++ if (!iface_no_modem_control(device_flags, iface_desc->bInterfaceNumber))
3208 + data->use_send_setup = 1;
3209 +
3210 + if (device_flags & ZLP)
3211 +diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
3212 +index 237d5aceb302d..f9a3da02c631b 100644
3213 +--- a/drivers/vfio/pci/vfio_pci.c
3214 ++++ b/drivers/vfio/pci/vfio_pci.c
3215 +@@ -1403,8 +1403,8 @@ static int vfio_pci_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
3216 +
3217 + mutex_unlock(&vdev->vma_lock);
3218 +
3219 +- if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
3220 +- vma->vm_end - vma->vm_start, vma->vm_page_prot))
3221 ++ if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
3222 ++ vma->vm_end - vma->vm_start, vma->vm_page_prot))
3223 + ret = VM_FAULT_SIGBUS;
3224 +
3225 + up_out:
3226 +diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
3227 +index 4f47b5e909566..8b88824a88dc2 100644
3228 +--- a/drivers/watchdog/qcom-wdt.c
3229 ++++ b/drivers/watchdog/qcom-wdt.c
3230 +@@ -121,7 +121,7 @@ static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action,
3231 + */
3232 + wmb();
3233 +
3234 +- msleep(150);
3235 ++ mdelay(150);
3236 + return 0;
3237 + }
3238 +
3239 +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
3240 +index 6f8f37e37abb2..4b671e5c33cec 100644
3241 +--- a/fs/btrfs/inode.c
3242 ++++ b/fs/btrfs/inode.c
3243 +@@ -7000,7 +7000,7 @@ again:
3244 + found_type == BTRFS_FILE_EXTENT_PREALLOC) {
3245 + /* Only regular file could have regular/prealloc extent */
3246 + if (!S_ISREG(inode->i_mode)) {
3247 +- ret = -EUCLEAN;
3248 ++ err = -EUCLEAN;
3249 + btrfs_crit(root->fs_info,
3250 + "regular/prealloc extent found for non-regular inode %llu",
3251 + btrfs_ino(inode));
3252 +diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
3253 +index 154008e245a2f..d6795c6fdd666 100644
3254 +--- a/fs/btrfs/qgroup.c
3255 ++++ b/fs/btrfs/qgroup.c
3256 +@@ -2340,8 +2340,10 @@ out:
3257 + }
3258 + btrfs_put_tree_mod_seq(fs_info, &tree_mod_seq_elem);
3259 +
3260 +- if (done && !ret)
3261 ++ if (done && !ret) {
3262 + ret = 1;
3263 ++ fs_info->qgroup_rescan_progress.objectid = (u64)-1;
3264 ++ }
3265 + return ret;
3266 + }
3267 +
3268 +diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
3269 +index 16c0585cd81c8..9fd7bc699aae8 100644
3270 +--- a/fs/btrfs/scrub.c
3271 ++++ b/fs/btrfs/scrub.c
3272 +@@ -919,11 +919,6 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check)
3273 + have_csum = sblock_to_check->pagev[0]->have_csum;
3274 + dev = sblock_to_check->pagev[0]->dev;
3275 +
3276 +- if (sctx->is_dev_replace && !is_metadata && !have_csum) {
3277 +- sblocks_for_recheck = NULL;
3278 +- goto nodatasum_case;
3279 +- }
3280 +-
3281 + /*
3282 + * read all mirrors one after the other. This includes to
3283 + * re-read the extent or metadata block that failed (that was
3284 +@@ -1036,13 +1031,19 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check)
3285 + goto out;
3286 + }
3287 +
3288 +- if (!is_metadata && !have_csum) {
3289 ++ /*
3290 ++ * NOTE: Even for nodatasum case, it's still possible that it's a
3291 ++ * compressed data extent, thus scrub_fixup_nodatasum(), which write
3292 ++ * inode page cache onto disk, could cause serious data corruption.
3293 ++ *
3294 ++ * So here we could only read from disk, and hope our recovery could
3295 ++ * reach disk before the newer write.
3296 ++ */
3297 ++ if (0 && !is_metadata && !have_csum) {
3298 + struct scrub_fixup_nodatasum *fixup_nodatasum;
3299 +
3300 + WARN_ON(sctx->is_dev_replace);
3301 +
3302 +-nodatasum_case:
3303 +-
3304 + /*
3305 + * !is_metadata and !have_csum, this means that the data
3306 + * might not be COWed, that it might be modified
3307 +diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c
3308 +index 9edc2674b8a70..ace3209f3a392 100644
3309 +--- a/fs/btrfs/tests/btrfs-tests.c
3310 ++++ b/fs/btrfs/tests/btrfs-tests.c
3311 +@@ -51,7 +51,13 @@ static struct file_system_type test_type = {
3312 +
3313 + struct inode *btrfs_new_test_inode(void)
3314 + {
3315 +- return new_inode(test_mnt->mnt_sb);
3316 ++ struct inode *inode;
3317 ++
3318 ++ inode = new_inode(test_mnt->mnt_sb);
3319 ++ if (inode)
3320 ++ inode_init_owner(inode, NULL, S_IFREG);
3321 ++
3322 ++ return inode;
3323 + }
3324 +
3325 + static int btrfs_init_test_fs(void)
3326 +diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
3327 +index cbd92dd89de16..2a351821d8f32 100644
3328 +--- a/fs/ceph/caps.c
3329 ++++ b/fs/ceph/caps.c
3330 +@@ -927,12 +927,19 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
3331 + {
3332 + struct ceph_mds_session *session = cap->session;
3333 + struct ceph_inode_info *ci = cap->ci;
3334 +- struct ceph_mds_client *mdsc =
3335 +- ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
3336 ++ struct ceph_mds_client *mdsc;
3337 + int removed = 0;
3338 +
3339 ++ /* 'ci' being NULL means the remove have already occurred */
3340 ++ if (!ci) {
3341 ++ dout("%s: cap inode is NULL\n", __func__);
3342 ++ return;
3343 ++ }
3344 ++
3345 + dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);
3346 +
3347 ++ mdsc = ceph_inode_to_client(&ci->vfs_inode)->mdsc;
3348 ++
3349 + /* remove from inode's cap rbtree, and clear auth cap */
3350 + rb_erase(&cap->ci_node, &ci->i_caps);
3351 + if (ci->i_auth_cap == cap)
3352 +diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
3353 +index ac13de1a7e420..1d543f8b3814f 100644
3354 +--- a/fs/ext4/mballoc.c
3355 ++++ b/fs/ext4/mballoc.c
3356 +@@ -4650,6 +4650,7 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
3357 + ext4_group_first_block_no(sb, group) +
3358 + EXT4_C2B(sbi, cluster),
3359 + "Block already on to-be-freed list");
3360 ++ kmem_cache_free(ext4_free_data_cachep, new_entry);
3361 + return 0;
3362 + }
3363 + }
3364 +diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
3365 +index 2f236cca60951..64a55015d1269 100644
3366 +--- a/fs/jffs2/readinode.c
3367 ++++ b/fs/jffs2/readinode.c
3368 +@@ -672,6 +672,22 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r
3369 + jffs2_free_full_dirent(fd);
3370 + return -EIO;
3371 + }
3372 ++
3373 ++#ifdef CONFIG_JFFS2_SUMMARY
3374 ++ /*
3375 ++ * we use CONFIG_JFFS2_SUMMARY because without it, we
3376 ++ * have checked it while mounting
3377 ++ */
3378 ++ crc = crc32(0, fd->name, rd->nsize);
3379 ++ if (unlikely(crc != je32_to_cpu(rd->name_crc))) {
3380 ++ JFFS2_NOTICE("name CRC failed on dirent node at"
3381 ++ "%#08x: read %#08x,calculated %#08x\n",
3382 ++ ref_offset(ref), je32_to_cpu(rd->node_crc), crc);
3383 ++ jffs2_mark_node_obsolete(c, ref);
3384 ++ jffs2_free_full_dirent(fd);
3385 ++ return 0;
3386 ++ }
3387 ++#endif
3388 + }
3389 +
3390 + fd->nhash = full_name_hash(NULL, fd->name, rd->nsize);
3391 +diff --git a/fs/jfs/jfs_dmap.h b/fs/jfs/jfs_dmap.h
3392 +index 562b9a7e4311f..f502a15c6c987 100644
3393 +--- a/fs/jfs/jfs_dmap.h
3394 ++++ b/fs/jfs/jfs_dmap.h
3395 +@@ -196,7 +196,7 @@ typedef union dmtree {
3396 + #define dmt_leafidx t1.leafidx
3397 + #define dmt_height t1.height
3398 + #define dmt_budmin t1.budmin
3399 +-#define dmt_stree t1.stree
3400 ++#define dmt_stree t2.stree
3401 +
3402 + /*
3403 + * on-disk aggregate disk allocation map descriptor.
3404 +diff --git a/fs/lockd/host.c b/fs/lockd/host.c
3405 +index c7eb47f2fb6c3..603fa652b965d 100644
3406 +--- a/fs/lockd/host.c
3407 ++++ b/fs/lockd/host.c
3408 +@@ -430,12 +430,7 @@ nlm_bind_host(struct nlm_host *host)
3409 + * RPC rebind is required
3410 + */
3411 + if ((clnt = host->h_rpcclnt) != NULL) {
3412 +- if (time_after_eq(jiffies, host->h_nextrebind)) {
3413 +- rpc_force_rebind(clnt);
3414 +- host->h_nextrebind = jiffies + NLM_HOST_REBIND;
3415 +- dprintk("lockd: next rebind in %lu jiffies\n",
3416 +- host->h_nextrebind - jiffies);
3417 +- }
3418 ++ nlm_rebind_host(host);
3419 + } else {
3420 + unsigned long increment = nlmsvc_timeout;
3421 + struct rpc_timeout timeparms = {
3422 +@@ -483,13 +478,20 @@ nlm_bind_host(struct nlm_host *host)
3423 + return clnt;
3424 + }
3425 +
3426 +-/*
3427 +- * Force a portmap lookup of the remote lockd port
3428 ++/**
3429 ++ * nlm_rebind_host - If needed, force a portmap lookup of the peer's lockd port
3430 ++ * @host: NLM host handle for peer
3431 ++ *
3432 ++ * This is not needed when using a connection-oriented protocol, such as TCP.
3433 ++ * The existing autobind mechanism is sufficient to force a rebind when
3434 ++ * required, e.g. on connection state transitions.
3435 + */
3436 + void
3437 + nlm_rebind_host(struct nlm_host *host)
3438 + {
3439 +- dprintk("lockd: rebind host %s\n", host->h_name);
3440 ++ if (host->h_proto != IPPROTO_UDP)
3441 ++ return;
3442 ++
3443 + if (host->h_rpcclnt && time_after_eq(jiffies, host->h_nextrebind)) {
3444 + rpc_force_rebind(host->h_rpcclnt);
3445 + host->h_nextrebind = jiffies + NLM_HOST_REBIND;
3446 +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
3447 +index 851274b25d394..6c0035761d170 100644
3448 +--- a/fs/nfs/inode.c
3449 ++++ b/fs/nfs/inode.c
3450 +@@ -1995,7 +1995,7 @@ static int nfsiod_start(void)
3451 + {
3452 + struct workqueue_struct *wq;
3453 + dprintk("RPC: creating workqueue nfsiod\n");
3454 +- wq = alloc_workqueue("nfsiod", WQ_MEM_RECLAIM, 0);
3455 ++ wq = alloc_workqueue("nfsiod", WQ_MEM_RECLAIM | WQ_UNBOUND, 0);
3456 + if (wq == NULL)
3457 + return -ENOMEM;
3458 + nfsiod_workqueue = wq;
3459 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
3460 +index 4e2f18c26535d..2abdb2070c879 100644
3461 +--- a/fs/nfs/nfs4proc.c
3462 ++++ b/fs/nfs/nfs4proc.c
3463 +@@ -4334,12 +4334,12 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
3464 + u64 cookie, struct page **pages, unsigned int count, int plus)
3465 + {
3466 + struct inode *dir = d_inode(dentry);
3467 ++ struct nfs_server *server = NFS_SERVER(dir);
3468 + struct nfs4_readdir_arg args = {
3469 + .fh = NFS_FH(dir),
3470 + .pages = pages,
3471 + .pgbase = 0,
3472 + .count = count,
3473 +- .bitmask = NFS_SERVER(d_inode(dentry))->attr_bitmask,
3474 + .plus = plus,
3475 + };
3476 + struct nfs4_readdir_res res;
3477 +@@ -4354,9 +4354,15 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
3478 + dprintk("%s: dentry = %pd2, cookie = %Lu\n", __func__,
3479 + dentry,
3480 + (unsigned long long)cookie);
3481 ++ if (!(server->caps & NFS_CAP_SECURITY_LABEL))
3482 ++ args.bitmask = server->attr_bitmask_nl;
3483 ++ else
3484 ++ args.bitmask = server->attr_bitmask;
3485 ++
3486 + nfs4_setup_readdir(cookie, NFS_I(dir)->cookieverf, dentry, &args);
3487 + res.pgbase = args.pgbase;
3488 +- status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0);
3489 ++ status = nfs4_call_sync(server->client, server, &msg, &args.seq_args,
3490 ++ &res.seq_res, 0);
3491 + if (status >= 0) {
3492 + memcpy(NFS_I(dir)->cookieverf, res.verifier.data, NFS4_VERIFIER_SIZE);
3493 + status += args.pgbase;
3494 +diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
3495 +index 77d136ac89099..c21fca0dcba74 100644
3496 +--- a/fs/nfs_common/grace.c
3497 ++++ b/fs/nfs_common/grace.c
3498 +@@ -75,10 +75,14 @@ __state_in_grace(struct net *net, bool open)
3499 + if (!open)
3500 + return !list_empty(grace_list);
3501 +
3502 ++ spin_lock(&grace_lock);
3503 + list_for_each_entry(lm, grace_list, list) {
3504 +- if (lm->block_opens)
3505 ++ if (lm->block_opens) {
3506 ++ spin_unlock(&grace_lock);
3507 + return true;
3508 ++ }
3509 + }
3510 ++ spin_unlock(&grace_lock);
3511 + return false;
3512 + }
3513 +
3514 +diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
3515 +index 60291d10f8e4a..6bb3f3a98d7de 100644
3516 +--- a/fs/nfsd/nfssvc.c
3517 ++++ b/fs/nfsd/nfssvc.c
3518 +@@ -393,8 +393,7 @@ static void nfsd_last_thread(struct svc_serv *serv, struct net *net)
3519 + return;
3520 +
3521 + nfsd_shutdown_net(net);
3522 +- printk(KERN_WARNING "nfsd: last server has exited, flushing export "
3523 +- "cache\n");
3524 ++ pr_info("nfsd: last server has exited, flushing export cache\n");
3525 + nfsd_export_flush(net);
3526 + }
3527 +
3528 +diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h
3529 +index fb7eb9ccb1cd4..d4c3c9bab5826 100644
3530 +--- a/include/linux/seq_buf.h
3531 ++++ b/include/linux/seq_buf.h
3532 +@@ -29,7 +29,7 @@ static inline void seq_buf_clear(struct seq_buf *s)
3533 + }
3534 +
3535 + static inline void
3536 +-seq_buf_init(struct seq_buf *s, unsigned char *buf, unsigned int size)
3537 ++seq_buf_init(struct seq_buf *s, char *buf, unsigned int size)
3538 + {
3539 + s->buffer = buf;
3540 + s->size = size;
3541 +diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
3542 +index a5da60b24d83e..15bab51a3aef1 100644
3543 +--- a/include/linux/sunrpc/xprt.h
3544 ++++ b/include/linux/sunrpc/xprt.h
3545 +@@ -310,6 +310,7 @@ struct xprt_class {
3546 + struct rpc_xprt * (*setup)(struct xprt_create *);
3547 + struct module *owner;
3548 + char name[32];
3549 ++ const char * netid[];
3550 + };
3551 +
3552 + /*
3553 +diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
3554 +index cfaf5a1d4bad7..f5be2716b01c6 100644
3555 +--- a/include/linux/trace_seq.h
3556 ++++ b/include/linux/trace_seq.h
3557 +@@ -11,7 +11,7 @@
3558 + */
3559 +
3560 + struct trace_seq {
3561 +- unsigned char buffer[PAGE_SIZE];
3562 ++ char buffer[PAGE_SIZE];
3563 + struct seq_buf seq;
3564 + int full;
3565 + };
3566 +@@ -50,7 +50,7 @@ static inline int trace_seq_used(struct trace_seq *s)
3567 + * that is about to be written to and then return the result
3568 + * of that write.
3569 + */
3570 +-static inline unsigned char *
3571 ++static inline char *
3572 + trace_seq_buffer_ptr(struct trace_seq *s)
3573 + {
3574 + return s->buffer + seq_buf_used(&s->seq);
3575 +diff --git a/kernel/cpu.c b/kernel/cpu.c
3576 +index a542b5e583503..e005209f279e1 100644
3577 +--- a/kernel/cpu.c
3578 ++++ b/kernel/cpu.c
3579 +@@ -815,6 +815,10 @@ void __unregister_cpu_notifier(struct notifier_block *nb)
3580 + EXPORT_SYMBOL(__unregister_cpu_notifier);
3581 +
3582 + #ifdef CONFIG_HOTPLUG_CPU
3583 ++#ifndef arch_clear_mm_cpumask_cpu
3584 ++#define arch_clear_mm_cpumask_cpu(cpu, mm) cpumask_clear_cpu(cpu, mm_cpumask(mm))
3585 ++#endif
3586 ++
3587 + /**
3588 + * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU
3589 + * @cpu: a CPU id
3590 +@@ -850,7 +854,7 @@ void clear_tasks_mm_cpumask(int cpu)
3591 + t = find_lock_task_mm(p);
3592 + if (!t)
3593 + continue;
3594 +- cpumask_clear_cpu(cpu, mm_cpumask(t->mm));
3595 ++ arch_clear_mm_cpumask_cpu(cpu, t->mm);
3596 + task_unlock(t);
3597 + }
3598 + rcu_read_unlock();
3599 +diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
3600 +index 1f5c48d1493c9..d01bf6a111cee 100644
3601 +--- a/net/bluetooth/hci_event.c
3602 ++++ b/net/bluetooth/hci_event.c
3603 +@@ -4350,6 +4350,11 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev,
3604 + return;
3605 + }
3606 +
3607 ++ if (!hcon->amp_mgr) {
3608 ++ hci_dev_unlock(hdev);
3609 ++ return;
3610 ++ }
3611 ++
3612 + if (ev->status) {
3613 + hci_conn_del(hcon);
3614 + hci_dev_unlock(hdev);
3615 +@@ -5141,20 +5146,18 @@ static void hci_le_direct_adv_report_evt(struct hci_dev *hdev,
3616 + struct sk_buff *skb)
3617 + {
3618 + u8 num_reports = skb->data[0];
3619 +- void *ptr = &skb->data[1];
3620 ++ struct hci_ev_le_direct_adv_info *ev = (void *)&skb->data[1];
3621 +
3622 +- hci_dev_lock(hdev);
3623 ++ if (!num_reports || skb->len < num_reports * sizeof(*ev) + 1)
3624 ++ return;
3625 +
3626 +- while (num_reports--) {
3627 +- struct hci_ev_le_direct_adv_info *ev = ptr;
3628 ++ hci_dev_lock(hdev);
3629 +
3630 ++ for (; num_reports; num_reports--, ev++)
3631 + process_adv_report(hdev, ev->evt_type, &ev->bdaddr,
3632 + ev->bdaddr_type, &ev->direct_addr,
3633 + ev->direct_addr_type, ev->rssi, NULL, 0);
3634 +
3635 +- ptr += sizeof(*ev);
3636 +- }
3637 +-
3638 + hci_dev_unlock(hdev);
3639 + }
3640 +
3641 +diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
3642 +index 5172caac645c7..6ac7ad4f3547f 100644
3643 +--- a/net/bridge/br_vlan.c
3644 ++++ b/net/bridge/br_vlan.c
3645 +@@ -238,8 +238,10 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags)
3646 + }
3647 +
3648 + masterv = br_vlan_get_master(br, v->vid);
3649 +- if (!masterv)
3650 ++ if (!masterv) {
3651 ++ err = -ENOMEM;
3652 + goto out_filt;
3653 ++ }
3654 + v->brvlan = masterv;
3655 + v->stats = masterv->stats;
3656 + }
3657 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
3658 +index b730b994b1c79..b7909160692e3 100644
3659 +--- a/net/ipv4/tcp_output.c
3660 ++++ b/net/ipv4/tcp_output.c
3661 +@@ -1532,7 +1532,8 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited)
3662 + * window, and remember whether we were cwnd-limited then.
3663 + */
3664 + if (!before(tp->snd_una, tp->max_packets_seq) ||
3665 +- tp->packets_out > tp->max_packets_out) {
3666 ++ tp->packets_out > tp->max_packets_out ||
3667 ++ is_cwnd_limited) {
3668 + tp->max_packets_out = tp->packets_out;
3669 + tp->max_packets_seq = tp->snd_nxt;
3670 + tp->is_cwnd_limited = is_cwnd_limited;
3671 +@@ -2259,6 +2260,10 @@ repair:
3672 + break;
3673 + }
3674 +
3675 ++ is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd);
3676 ++ if (likely(sent_pkts || is_cwnd_limited))
3677 ++ tcp_cwnd_validate(sk, is_cwnd_limited);
3678 ++
3679 + if (likely(sent_pkts)) {
3680 + if (tcp_in_cwnd_reduction(sk))
3681 + tp->prr_out += sent_pkts;
3682 +@@ -2266,8 +2271,6 @@ repair:
3683 + /* Send one loss probe per tail loss episode. */
3684 + if (push_one != 2)
3685 + tcp_schedule_loss_probe(sk);
3686 +- is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd);
3687 +- tcp_cwnd_validate(sk, is_cwnd_limited);
3688 + return false;
3689 + }
3690 + return !tp->packets_out && tcp_send_head(sk);
3691 +diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
3692 +index 7c409ba1ddc74..30a95a2ff196a 100644
3693 +--- a/net/mac80211/mesh_pathtbl.c
3694 ++++ b/net/mac80211/mesh_pathtbl.c
3695 +@@ -61,6 +61,7 @@ static struct mesh_table *mesh_table_alloc(void)
3696 + INIT_HLIST_HEAD(&newtbl->known_gates);
3697 + atomic_set(&newtbl->entries, 0);
3698 + spin_lock_init(&newtbl->gates_lock);
3699 ++ rhashtable_init(&newtbl->rhead, &mesh_rht_params);
3700 +
3701 + return newtbl;
3702 + }
3703 +@@ -849,9 +850,6 @@ int mesh_pathtbl_init(struct ieee80211_sub_if_data *sdata)
3704 + goto free_path;
3705 + }
3706 +
3707 +- rhashtable_init(&tbl_path->rhead, &mesh_rht_params);
3708 +- rhashtable_init(&tbl_mpp->rhead, &mesh_rht_params);
3709 +-
3710 + sdata->u.mesh.mesh_paths = tbl_path;
3711 + sdata->u.mesh.mpp_paths = tbl_mpp;
3712 +
3713 +diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
3714 +index 1a8df242d26a1..9491fc81d50ad 100644
3715 +--- a/net/sunrpc/xprt.c
3716 ++++ b/net/sunrpc/xprt.c
3717 +@@ -143,31 +143,64 @@ out:
3718 + }
3719 + EXPORT_SYMBOL_GPL(xprt_unregister_transport);
3720 +
3721 ++static void
3722 ++xprt_class_release(const struct xprt_class *t)
3723 ++{
3724 ++ module_put(t->owner);
3725 ++}
3726 ++
3727 ++static const struct xprt_class *
3728 ++xprt_class_find_by_netid_locked(const char *netid)
3729 ++{
3730 ++ const struct xprt_class *t;
3731 ++ unsigned int i;
3732 ++
3733 ++ list_for_each_entry(t, &xprt_list, list) {
3734 ++ for (i = 0; t->netid[i][0] != '\0'; i++) {
3735 ++ if (strcmp(t->netid[i], netid) != 0)
3736 ++ continue;
3737 ++ if (!try_module_get(t->owner))
3738 ++ continue;
3739 ++ return t;
3740 ++ }
3741 ++ }
3742 ++ return NULL;
3743 ++}
3744 ++
3745 ++static const struct xprt_class *
3746 ++xprt_class_find_by_netid(const char *netid)
3747 ++{
3748 ++ const struct xprt_class *t;
3749 ++
3750 ++ spin_lock(&xprt_list_lock);
3751 ++ t = xprt_class_find_by_netid_locked(netid);
3752 ++ if (!t) {
3753 ++ spin_unlock(&xprt_list_lock);
3754 ++ request_module("rpc%s", netid);
3755 ++ spin_lock(&xprt_list_lock);
3756 ++ t = xprt_class_find_by_netid_locked(netid);
3757 ++ }
3758 ++ spin_unlock(&xprt_list_lock);
3759 ++ return t;
3760 ++}
3761 ++
3762 + /**
3763 + * xprt_load_transport - load a transport implementation
3764 +- * @transport_name: transport to load
3765 ++ * @netid: transport to load
3766 + *
3767 + * Returns:
3768 + * 0: transport successfully loaded
3769 + * -ENOENT: transport module not available
3770 + */
3771 +-int xprt_load_transport(const char *transport_name)
3772 ++int xprt_load_transport(const char *netid)
3773 + {
3774 +- struct xprt_class *t;
3775 +- int result;
3776 ++ const struct xprt_class *t;
3777 +
3778 +- result = 0;
3779 +- spin_lock(&xprt_list_lock);
3780 +- list_for_each_entry(t, &xprt_list, list) {
3781 +- if (strcmp(t->name, transport_name) == 0) {
3782 +- spin_unlock(&xprt_list_lock);
3783 +- goto out;
3784 +- }
3785 +- }
3786 +- spin_unlock(&xprt_list_lock);
3787 +- result = request_module("xprt%s", transport_name);
3788 +-out:
3789 +- return result;
3790 ++ t = xprt_class_find_by_netid(netid);
3791 ++ if (!t)
3792 ++ return -ENOENT;
3793 ++ xprt_class_release(t);
3794 ++ return 0;
3795 + }
3796 + EXPORT_SYMBOL_GPL(xprt_load_transport);
3797 +
3798 +diff --git a/net/sunrpc/xprtrdma/module.c b/net/sunrpc/xprtrdma/module.c
3799 +index 560712bd9fa2c..dd227de31a589 100644
3800 +--- a/net/sunrpc/xprtrdma/module.c
3801 ++++ b/net/sunrpc/xprtrdma/module.c
3802 +@@ -19,6 +19,7 @@ MODULE_DESCRIPTION("RPC/RDMA Transport");
3803 + MODULE_LICENSE("Dual BSD/GPL");
3804 + MODULE_ALIAS("svcrdma");
3805 + MODULE_ALIAS("xprtrdma");
3806 ++MODULE_ALIAS("rpcrdma6");
3807 +
3808 + static void __exit rpc_rdma_cleanup(void)
3809 + {
3810 +diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
3811 +index fa324fe739466..3ea3bb64b6d5c 100644
3812 +--- a/net/sunrpc/xprtrdma/transport.c
3813 ++++ b/net/sunrpc/xprtrdma/transport.c
3814 +@@ -777,6 +777,7 @@ static struct xprt_class xprt_rdma = {
3815 + .owner = THIS_MODULE,
3816 + .ident = XPRT_TRANSPORT_RDMA,
3817 + .setup = xprt_setup_rdma,
3818 ++ .netid = { "rdma", "rdma6", "" },
3819 + };
3820 +
3821 + void xprt_rdma_cleanup(void)
3822 +diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
3823 +index f3f05148922a1..bf20ea2606389 100644
3824 +--- a/net/sunrpc/xprtsock.c
3825 ++++ b/net/sunrpc/xprtsock.c
3826 +@@ -3147,6 +3147,7 @@ static struct xprt_class xs_local_transport = {
3827 + .owner = THIS_MODULE,
3828 + .ident = XPRT_TRANSPORT_LOCAL,
3829 + .setup = xs_setup_local,
3830 ++ .netid = { "" },
3831 + };
3832 +
3833 + static struct xprt_class xs_udp_transport = {
3834 +@@ -3155,6 +3156,7 @@ static struct xprt_class xs_udp_transport = {
3835 + .owner = THIS_MODULE,
3836 + .ident = XPRT_TRANSPORT_UDP,
3837 + .setup = xs_setup_udp,
3838 ++ .netid = { "udp", "udp6", "" },
3839 + };
3840 +
3841 + static struct xprt_class xs_tcp_transport = {
3842 +@@ -3163,6 +3165,7 @@ static struct xprt_class xs_tcp_transport = {
3843 + .owner = THIS_MODULE,
3844 + .ident = XPRT_TRANSPORT_TCP,
3845 + .setup = xs_setup_tcp,
3846 ++ .netid = { "tcp", "tcp6", "" },
3847 + };
3848 +
3849 + static struct xprt_class xs_bc_tcp_transport = {
3850 +@@ -3171,6 +3174,7 @@ static struct xprt_class xs_bc_tcp_transport = {
3851 + .owner = THIS_MODULE,
3852 + .ident = XPRT_TRANSPORT_BC_TCP,
3853 + .setup = xs_setup_bc_tcp,
3854 ++ .netid = { "" },
3855 + };
3856 +
3857 + /**
3858 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
3859 +index 5bd89f536720d..ab8bca39afa3f 100644
3860 +--- a/net/wireless/nl80211.c
3861 ++++ b/net/wireless/nl80211.c
3862 +@@ -10428,7 +10428,7 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)
3863 + struct net_device *dev = info->user_ptr[1];
3864 + struct wireless_dev *wdev = dev->ieee80211_ptr;
3865 + struct nlattr *tb[NUM_NL80211_REKEY_DATA];
3866 +- struct cfg80211_gtk_rekey_data rekey_data;
3867 ++ struct cfg80211_gtk_rekey_data rekey_data = {};
3868 + int err;
3869 +
3870 + if (!info->attrs[NL80211_ATTR_REKEY_DATA])
3871 +diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
3872 +index 9432387dc1789..c3b23244e64ff 100755
3873 +--- a/scripts/checkpatch.pl
3874 ++++ b/scripts/checkpatch.pl
3875 +@@ -3818,7 +3818,7 @@ sub process {
3876 + $fix) {
3877 + fix_delete_line($fixlinenr, $rawline);
3878 + my $fixed_line = $rawline;
3879 +- $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/;
3880 ++ $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*)\{(.*)$/;
3881 + my $line1 = $1;
3882 + my $line2 = $2;
3883 + fix_insert_line($fixlinenr, ltrim($line1));
3884 +diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
3885 +index 824097571467a..c2fb5198d5d56 100644
3886 +--- a/sound/core/oss/pcm_oss.c
3887 ++++ b/sound/core/oss/pcm_oss.c
3888 +@@ -719,6 +719,8 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
3889 +
3890 + oss_buffer_size = snd_pcm_plug_client_size(substream,
3891 + snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, NULL)) * oss_frame_size;
3892 ++ if (!oss_buffer_size)
3893 ++ return -EINVAL;
3894 + oss_buffer_size = rounddown_pow_of_two(oss_buffer_size);
3895 + if (atomic_read(&substream->mmap_count)) {
3896 + if (oss_buffer_size > runtime->oss.mmap_bytes)
3897 +@@ -754,17 +756,21 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
3898 +
3899 + min_period_size = snd_pcm_plug_client_size(substream,
3900 + snd_pcm_hw_param_value_min(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
3901 +- min_period_size *= oss_frame_size;
3902 +- min_period_size = roundup_pow_of_two(min_period_size);
3903 +- if (oss_period_size < min_period_size)
3904 +- oss_period_size = min_period_size;
3905 ++ if (min_period_size) {
3906 ++ min_period_size *= oss_frame_size;
3907 ++ min_period_size = roundup_pow_of_two(min_period_size);
3908 ++ if (oss_period_size < min_period_size)
3909 ++ oss_period_size = min_period_size;
3910 ++ }
3911 +
3912 + max_period_size = snd_pcm_plug_client_size(substream,
3913 + snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
3914 +- max_period_size *= oss_frame_size;
3915 +- max_period_size = rounddown_pow_of_two(max_period_size);
3916 +- if (oss_period_size > max_period_size)
3917 +- oss_period_size = max_period_size;
3918 ++ if (max_period_size) {
3919 ++ max_period_size *= oss_frame_size;
3920 ++ max_period_size = rounddown_pow_of_two(max_period_size);
3921 ++ if (oss_period_size > max_period_size)
3922 ++ oss_period_size = max_period_size;
3923 ++ }
3924 +
3925 + oss_periods = oss_buffer_size / oss_period_size;
3926 +
3927 +@@ -2001,11 +2007,15 @@ static int snd_pcm_oss_set_subdivide(struct snd_pcm_oss_file *pcm_oss_file, int
3928 + static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val)
3929 + {
3930 + struct snd_pcm_runtime *runtime;
3931 ++ int fragshift;
3932 +
3933 + runtime = substream->runtime;
3934 + if (runtime->oss.subdivision || runtime->oss.fragshift)
3935 + return -EINVAL;
3936 +- runtime->oss.fragshift = val & 0xffff;
3937 ++ fragshift = val & 0xffff;
3938 ++ if (fragshift >= 31)
3939 ++ return -EINVAL;
3940 ++ runtime->oss.fragshift = fragshift;
3941 + runtime->oss.maxfrags = (val >> 16) & 0xffff;
3942 + if (runtime->oss.fragshift < 4) /* < 16 */
3943 + runtime->oss.fragshift = 4;
3944 +diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
3945 +index 28eb55bc46634..00dd37f10daff 100644
3946 +--- a/sound/soc/codecs/wm_adsp.c
3947 ++++ b/sound/soc/codecs/wm_adsp.c
3948 +@@ -1156,7 +1156,7 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
3949 + ctl_work = kzalloc(sizeof(*ctl_work), GFP_KERNEL);
3950 + if (!ctl_work) {
3951 + ret = -ENOMEM;
3952 +- goto err_ctl_cache;
3953 ++ goto err_list_del;
3954 + }
3955 +
3956 + ctl_work->dsp = dsp;
3957 +@@ -1166,7 +1166,8 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
3958 +
3959 + return 0;
3960 +
3961 +-err_ctl_cache:
3962 ++err_list_del:
3963 ++ list_del(&ctl->list);
3964 + kfree(ctl->cache);
3965 + err_ctl_name:
3966 + kfree(ctl->name);
3967 +diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c
3968 +index 0dc1ab48fcebe..6440729facaf0 100644
3969 +--- a/sound/soc/jz4740/jz4740-i2s.c
3970 ++++ b/sound/soc/jz4740/jz4740-i2s.c
3971 +@@ -315,10 +315,14 @@ static int jz4740_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id,
3972 + switch (clk_id) {
3973 + case JZ4740_I2S_CLKSRC_EXT:
3974 + parent = clk_get(NULL, "ext");
3975 ++ if (IS_ERR(parent))
3976 ++ return PTR_ERR(parent);
3977 + clk_set_parent(i2s->clk_i2s, parent);
3978 + break;
3979 + case JZ4740_I2S_CLKSRC_PLL:
3980 + parent = clk_get(NULL, "pll half");
3981 ++ if (IS_ERR(parent))
3982 ++ return PTR_ERR(parent);
3983 + clk_set_parent(i2s->clk_i2s, parent);
3984 + ret = clk_set_rate(i2s->clk_i2s, freq);
3985 + break;
3986 +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
3987 +index b67d105b76e46..6c31a909845cd 100644
3988 +--- a/sound/soc/soc-pcm.c
3989 ++++ b/sound/soc/soc-pcm.c
3990 +@@ -2186,6 +2186,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
3991 + case SNDRV_PCM_TRIGGER_START:
3992 + case SNDRV_PCM_TRIGGER_RESUME:
3993 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
3994 ++ case SNDRV_PCM_TRIGGER_DRAIN:
3995 + ret = dpcm_dai_trigger_fe_be(substream, cmd, true);
3996 + break;
3997 + case SNDRV_PCM_TRIGGER_STOP:
3998 +@@ -2203,6 +2204,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
3999 + case SNDRV_PCM_TRIGGER_START:
4000 + case SNDRV_PCM_TRIGGER_RESUME:
4001 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
4002 ++ case SNDRV_PCM_TRIGGER_DRAIN:
4003 + ret = dpcm_dai_trigger_fe_be(substream, cmd, false);
4004 + break;
4005 + case SNDRV_PCM_TRIGGER_STOP:
4006 +diff --git a/sound/usb/clock.c b/sound/usb/clock.c
4007 +index eb3396ffba4c4..70e74895b1136 100644
4008 +--- a/sound/usb/clock.c
4009 ++++ b/sound/usb/clock.c
4010 +@@ -327,6 +327,12 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
4011 + }
4012 +
4013 + crate = data[0] | (data[1] << 8) | (data[2] << 16);
4014 ++ if (!crate) {
4015 ++ dev_info(&dev->dev, "failed to read current rate; disabling the check\n");
4016 ++ chip->sample_rate_read_error = 3; /* three strikes, see above */
4017 ++ return 0;
4018 ++ }
4019 ++
4020 + if (crate != rate) {
4021 + dev_warn(&dev->dev, "current rate %d is different from the runtime rate %d\n", crate, rate);
4022 + // runtime->rate = crate;
4023 +diff --git a/sound/usb/format.c b/sound/usb/format.c
4024 +index eeb56d6fe8aa8..06190e3fd9194 100644
4025 +--- a/sound/usb/format.c
4026 ++++ b/sound/usb/format.c
4027 +@@ -52,6 +52,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
4028 + case UAC_VERSION_1:
4029 + default: {
4030 + struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
4031 ++ if (format >= 64)
4032 ++ return 0; /* invalid format */
4033 + sample_width = fmt->bBitResolution;
4034 + sample_bytes = fmt->bSubframeSize;
4035 + format = 1 << format;
4036 +diff --git a/sound/usb/stream.c b/sound/usb/stream.c
4037 +index 499f8def98de8..a50718fca613d 100644
4038 +--- a/sound/usb/stream.c
4039 ++++ b/sound/usb/stream.c
4040 +@@ -185,16 +185,16 @@ static int usb_chmap_ctl_get(struct snd_kcontrol *kcontrol,
4041 + struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
4042 + struct snd_usb_substream *subs = info->private_data;
4043 + struct snd_pcm_chmap_elem *chmap = NULL;
4044 +- int i;
4045 ++ int i = 0;
4046 +
4047 +- memset(ucontrol->value.integer.value, 0,
4048 +- sizeof(ucontrol->value.integer.value));
4049 + if (subs->cur_audiofmt)
4050 + chmap = subs->cur_audiofmt->chmap;
4051 + if (chmap) {
4052 + for (i = 0; i < chmap->channels; i++)
4053 + ucontrol->value.integer.value[i] = chmap->map[i];
4054 + }
4055 ++ for (; i < subs->channels_max; i++)
4056 ++ ucontrol->value.integer.value[i] = 0;
4057 + return 0;
4058 + }
4059 +
4060 +diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c
4061 +index 646ecf736aadb..be2ab1091c2bb 100644
4062 +--- a/tools/perf/util/parse-regs-options.c
4063 ++++ b/tools/perf/util/parse-regs-options.c
4064 +@@ -40,7 +40,7 @@ parse_regs(const struct option *opt, const char *str, int unset)
4065 + }
4066 + fputc('\n', stderr);
4067 + /* just printing available regs */
4068 +- return -1;
4069 ++ goto error;
4070 + }
4071 + for (r = sample_reg_masks; r->name; r++) {
4072 + if (!strcasecmp(s, r->name))