Magellan Linux

Contents of /trunk/kernel-alx-legacy/patches-4.9/0348-4.9.249-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


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