Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Tue, 29 Dec 2020 14:16:45
Message-Id: 1609251381.6e2df9f671aecd053f46fa0aab6eb59eccdb8f09.mpagano@gentoo
1 commit: 6e2df9f671aecd053f46fa0aab6eb59eccdb8f09
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Tue Dec 29 14:16:21 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 29 14:16:21 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=6e2df9f6
7
8 Linux patch 4.4.249
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1248_linux-4.4.249.patch | 3061 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 3065 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index a6e4afe..c387012 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -1035,6 +1035,10 @@ Patch: 1247_linux-4.4.248.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.4.248
23
24 +Patch: 1248_linux-4.4.249.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.4.249
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1248_linux-4.4.249.patch b/1248_linux-4.4.249.patch
33 new file mode 100644
34 index 0000000..6841612
35 --- /dev/null
36 +++ b/1248_linux-4.4.249.patch
37 @@ -0,0 +1,3061 @@
38 +diff --git a/Makefile b/Makefile
39 +index 7d34194e0f65a..15560bbc07f61 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 4
45 +-SUBLEVEL = 248
46 ++SUBLEVEL = 249
47 + EXTRAVERSION =
48 + NAME = Blurry Fish Butt
49 +
50 +diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c
51 +index 5401e2bab3da2..054511f571dfd 100644
52 +--- a/arch/arc/kernel/stacktrace.c
53 ++++ b/arch/arc/kernel/stacktrace.c
54 +@@ -39,15 +39,15 @@
55 +
56 + #ifdef CONFIG_ARC_DW2_UNWIND
57 +
58 +-static void seed_unwind_frame_info(struct task_struct *tsk,
59 +- struct pt_regs *regs,
60 +- struct unwind_frame_info *frame_info)
61 ++static int
62 ++seed_unwind_frame_info(struct task_struct *tsk, struct pt_regs *regs,
63 ++ struct unwind_frame_info *frame_info)
64 + {
65 + /*
66 + * synchronous unwinding (e.g. dump_stack)
67 + * - uses current values of SP and friends
68 + */
69 +- if (tsk == NULL && regs == NULL) {
70 ++ if (regs == NULL && (tsk == NULL || tsk == current)) {
71 + unsigned long fp, sp, blink, ret;
72 + frame_info->task = current;
73 +
74 +@@ -66,11 +66,15 @@ static void seed_unwind_frame_info(struct task_struct *tsk,
75 + frame_info->call_frame = 0;
76 + } else if (regs == NULL) {
77 + /*
78 +- * Asynchronous unwinding of sleeping task
79 +- * - Gets SP etc from task's pt_regs (saved bottom of kernel
80 +- * mode stack of task)
81 ++ * Asynchronous unwinding of a likely sleeping task
82 ++ * - first ensure it is actually sleeping
83 ++ * - if so, it will be in __switch_to, kernel mode SP of task
84 ++ * is safe-kept and BLINK at a well known location in there
85 + */
86 +
87 ++ if (tsk->state == TASK_RUNNING)
88 ++ return -1;
89 ++
90 + frame_info->task = tsk;
91 +
92 + frame_info->regs.r27 = TSK_K_FP(tsk);
93 +@@ -104,6 +108,8 @@ static void seed_unwind_frame_info(struct task_struct *tsk,
94 + frame_info->regs.r63 = regs->ret;
95 + frame_info->call_frame = 0;
96 + }
97 ++
98 ++ return 0;
99 + }
100 +
101 + #endif
102 +@@ -117,7 +123,8 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
103 + unsigned int address;
104 + struct unwind_frame_info frame_info;
105 +
106 +- seed_unwind_frame_info(tsk, regs, &frame_info);
107 ++ if (seed_unwind_frame_info(tsk, regs, &frame_info))
108 ++ return 0;
109 +
110 + while (1) {
111 + address = UNW_PC(&frame_info);
112 +diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
113 +index 0bd325c314e15..2b882d129b16a 100644
114 +--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
115 ++++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
116 +@@ -231,6 +231,11 @@
117 + atmel,pins =
118 + <AT91_PIOE 9 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PE9, conflicts with A9 */
119 + };
120 ++ pinctrl_usb_default: usb_default {
121 ++ atmel,pins =
122 ++ <AT91_PIOE 3 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
123 ++ AT91_PIOE 4 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
124 ++ };
125 + };
126 + };
127 + };
128 +@@ -288,6 +293,8 @@
129 + &pioE 3 GPIO_ACTIVE_LOW
130 + &pioE 4 GPIO_ACTIVE_LOW
131 + >;
132 ++ pinctrl-names = "default";
133 ++ pinctrl-0 = <&pinctrl_usb_default>;
134 + status = "okay";
135 + };
136 +
137 +diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
138 +index e27024cdf48bd..17adaa1a65c19 100644
139 +--- a/arch/arm/boot/dts/at91-sama5d4_xplained.dts
140 ++++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts
141 +@@ -152,6 +152,11 @@
142 + atmel,pins =
143 + <AT91_PIOE 31 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>;
144 + };
145 ++ pinctrl_usb_default: usb_default {
146 ++ atmel,pins =
147 ++ <AT91_PIOE 11 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
148 ++ AT91_PIOE 14 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
149 ++ };
150 + pinctrl_key_gpio: key_gpio_0 {
151 + atmel,pins =
152 + <AT91_PIOE 8 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
153 +@@ -177,6 +182,8 @@
154 + &pioE 11 GPIO_ACTIVE_HIGH
155 + &pioE 14 GPIO_ACTIVE_HIGH
156 + >;
157 ++ pinctrl-names = "default";
158 ++ pinctrl-0 = <&pinctrl_usb_default>;
159 + status = "okay";
160 + };
161 +
162 +diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
163 +index 04286fd9e09ce..2e336acd68b0a 100644
164 +--- a/arch/arm/kernel/head.S
165 ++++ b/arch/arm/kernel/head.S
166 +@@ -673,12 +673,8 @@ ARM_BE8(rev16 ip, ip)
167 + ldrcc r7, [r4], #4 @ use branch for delay slot
168 + bcc 1b
169 + bx lr
170 +-#else
171 +-#ifdef CONFIG_CPU_ENDIAN_BE8
172 +- moveq r0, #0x00004000 @ set bit 22, mov to mvn instruction
173 + #else
174 + moveq r0, #0x400000 @ set bit 22, mov to mvn instruction
175 +-#endif
176 + b 2f
177 + 1: ldr ip, [r7, r3]
178 + #ifdef CONFIG_CPU_ENDIAN_BE8
179 +@@ -687,7 +683,7 @@ ARM_BE8(rev16 ip, ip)
180 + tst ip, #0x000f0000 @ check the rotation field
181 + orrne ip, ip, r6, lsl #24 @ mask in offset bits 31-24
182 + biceq ip, ip, #0x00004000 @ clear bit 22
183 +- orreq ip, ip, r0 @ mask in offset bits 7-0
184 ++ orreq ip, ip, r0, ror #8 @ mask in offset bits 7-0
185 + #else
186 + bic ip, ip, #0x000000ff
187 + tst ip, #0xf00 @ check the rotation field
188 +diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig
189 +index e970fd9cf7693..7ca7384fd5c9d 100644
190 +--- a/arch/mips/bcm47xx/Kconfig
191 ++++ b/arch/mips/bcm47xx/Kconfig
192 +@@ -26,6 +26,7 @@ config BCM47XX_BCMA
193 + select BCMA
194 + select BCMA_HOST_SOC
195 + select BCMA_DRIVER_MIPS
196 ++ select BCMA_DRIVER_PCI if PCI
197 + select BCMA_DRIVER_PCI_HOSTMODE if PCI
198 + select BCMA_DRIVER_GPIO
199 + default y
200 +diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
201 +index b118072670fb1..9fe3f05000e31 100644
202 +--- a/arch/powerpc/include/asm/cputable.h
203 ++++ b/arch/powerpc/include/asm/cputable.h
204 +@@ -400,7 +400,6 @@ enum {
205 + CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
206 + CPU_FTR_DEBUG_LVL_EXC | CPU_FTR_EMB_HV | CPU_FTR_ALTIVEC_COMP | \
207 + CPU_FTR_CELL_TB_BUG | CPU_FTR_SMT)
208 +-#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
209 +
210 + /* 64-bit CPUs */
211 + #define CPU_FTRS_POWER4 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
212 +@@ -479,8 +478,6 @@ enum {
213 + CPU_FTRS_7447 | CPU_FTRS_7447A | CPU_FTRS_82XX |
214 + CPU_FTRS_G2_LE | CPU_FTRS_E300 | CPU_FTRS_E300C2 |
215 + CPU_FTRS_CLASSIC32 |
216 +-#else
217 +- CPU_FTRS_GENERIC_32 |
218 + #endif
219 + #ifdef CONFIG_8xx
220 + CPU_FTRS_8XX |
221 +@@ -530,8 +527,6 @@ enum {
222 + CPU_FTRS_7447 & CPU_FTRS_7447A & CPU_FTRS_82XX &
223 + CPU_FTRS_G2_LE & CPU_FTRS_E300 & CPU_FTRS_E300C2 &
224 + CPU_FTRS_CLASSIC32 &
225 +-#else
226 +- CPU_FTRS_GENERIC_32 &
227 + #endif
228 + #ifdef CONFIG_8xx
229 + CPU_FTRS_8XX &
230 +diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
231 +index 30e2e8efbe6b7..e593e7f856ed0 100644
232 +--- a/arch/powerpc/perf/core-book3s.c
233 ++++ b/arch/powerpc/perf/core-book3s.c
234 +@@ -2020,6 +2020,16 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
235 + local64_set(&event->hw.period_left, left);
236 + perf_event_update_userpage(event);
237 +
238 ++ /*
239 ++ * Due to hardware limitation, sometimes SIAR could sample a kernel
240 ++ * address even when freeze on supervisor state (kernel) is set in
241 ++ * MMCR2. Check attr.exclude_kernel and address to drop the sample in
242 ++ * these cases.
243 ++ */
244 ++ if (event->attr.exclude_kernel && record)
245 ++ if (is_kernel_addr(mfspr(SPRN_SIAR)))
246 ++ record = 0;
247 ++
248 + /*
249 + * Finally record data if requested.
250 + */
251 +diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
252 +index e76aefae2aa2b..0a0e0c8256f67 100644
253 +--- a/arch/powerpc/platforms/pseries/suspend.c
254 ++++ b/arch/powerpc/platforms/pseries/suspend.c
255 +@@ -224,7 +224,6 @@ static struct bus_type suspend_subsys = {
256 +
257 + static const struct platform_suspend_ops pseries_suspend_ops = {
258 + .valid = suspend_valid_only_mem,
259 +- .begin = pseries_suspend_begin,
260 + .prepare_late = pseries_prepare_late,
261 + .enter = pseries_suspend_enter,
262 + };
263 +diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
264 +index 20e30be44795b..e3b422ebce09f 100644
265 +--- a/arch/um/drivers/xterm.c
266 ++++ b/arch/um/drivers/xterm.c
267 +@@ -18,6 +18,7 @@
268 + struct xterm_chan {
269 + int pid;
270 + int helper_pid;
271 ++ int chan_fd;
272 + char *title;
273 + int device;
274 + int raw;
275 +@@ -33,6 +34,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts)
276 + return NULL;
277 + *data = ((struct xterm_chan) { .pid = -1,
278 + .helper_pid = -1,
279 ++ .chan_fd = -1,
280 + .device = device,
281 + .title = opts->xterm_title,
282 + .raw = opts->raw } );
283 +@@ -149,6 +151,7 @@ static int xterm_open(int input, int output, int primary, void *d,
284 + goto out_kill;
285 + }
286 +
287 ++ data->chan_fd = fd;
288 + new = xterm_fd(fd, &data->helper_pid);
289 + if (new < 0) {
290 + err = new;
291 +@@ -206,6 +209,8 @@ static void xterm_close(int fd, void *d)
292 + os_kill_process(data->helper_pid, 0);
293 + data->helper_pid = -1;
294 +
295 ++ if (data->chan_fd != -1)
296 ++ os_close_file(data->chan_fd);
297 + os_close_file(fd);
298 + }
299 +
300 +diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
301 +index 5a6cb30b1c621..ebd4da00a56ea 100644
302 +--- a/arch/x86/kernel/kprobes/core.c
303 ++++ b/arch/x86/kernel/kprobes/core.c
304 +@@ -1014,6 +1014,11 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
305 + * So clear it by resetting the current kprobe:
306 + */
307 + regs->flags &= ~X86_EFLAGS_TF;
308 ++ /*
309 ++ * Since the single step (trap) has been cancelled,
310 ++ * we need to restore BTF here.
311 ++ */
312 ++ restore_btf();
313 +
314 + /*
315 + * If the TF flag was set before the kprobe hit,
316 +diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
317 +index 48fc3ad13a4bb..1738eb0fa7db1 100644
318 +--- a/drivers/acpi/acpi_pnp.c
319 ++++ b/drivers/acpi/acpi_pnp.c
320 +@@ -320,6 +320,9 @@ static bool matching_id(const char *idstr, const char *list_id)
321 + {
322 + int i;
323 +
324 ++ if (strlen(idstr) != strlen(list_id))
325 ++ return false;
326 ++
327 + if (memcmp(idstr, list_id, 3))
328 + return false;
329 +
330 +diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
331 +index 627f8fbb5e9a2..e6003d2baa451 100644
332 +--- a/drivers/acpi/resource.c
333 ++++ b/drivers/acpi/resource.c
334 +@@ -506,7 +506,7 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
335 + ret = c->preproc(ares, c->preproc_data);
336 + if (ret < 0) {
337 + c->error = ret;
338 +- return AE_CTRL_TERMINATE;
339 ++ return AE_ABORT_METHOD;
340 + } else if (ret > 0) {
341 + return AE_OK;
342 + }
343 +diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
344 +index 0ec257e69e95a..823f3480ebd19 100644
345 +--- a/drivers/block/xen-blkback/xenbus.c
346 ++++ b/drivers/block/xen-blkback/xenbus.c
347 +@@ -553,7 +553,8 @@ static int xen_blkbk_probe(struct xenbus_device *dev,
348 + /* setup back pointer */
349 + be->blkif->be = be;
350 +
351 +- err = xenbus_watch_pathfmt(dev, &be->backend_watch, backend_changed,
352 ++ err = xenbus_watch_pathfmt(dev, &be->backend_watch, NULL,
353 ++ backend_changed,
354 + "%s/%s", dev->nodename, "physical-device");
355 + if (err)
356 + goto fail;
357 +diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c
358 +index 1c543effe062f..e6284fc1689b3 100644
359 +--- a/drivers/bus/mips_cdmm.c
360 ++++ b/drivers/bus/mips_cdmm.c
361 +@@ -544,10 +544,8 @@ static void mips_cdmm_bus_discover(struct mips_cdmm_bus *bus)
362 + dev_set_name(&dev->dev, "cdmm%u-%u", cpu, id);
363 + ++id;
364 + ret = device_register(&dev->dev);
365 +- if (ret) {
366 ++ if (ret)
367 + put_device(&dev->dev);
368 +- kfree(dev);
369 +- }
370 + }
371 + }
372 +
373 +diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
374 +index 14af5c916c9ca..8a42a9c2a8f28 100644
375 +--- a/drivers/clk/clk-s2mps11.c
376 ++++ b/drivers/clk/clk-s2mps11.c
377 +@@ -263,6 +263,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
378 + return ret;
379 +
380 + err_reg:
381 ++ of_node_put(s2mps11_clks[0].clk_np);
382 + while (--i >= 0)
383 + clkdev_drop(s2mps11_clks[i].lookup);
384 +
385 +diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c
386 +index 66a0d0ed8b550..02ff499e36536 100644
387 +--- a/drivers/clk/ti/fapll.c
388 ++++ b/drivers/clk/ti/fapll.c
389 +@@ -497,6 +497,7 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd,
390 + {
391 + struct clk_init_data *init;
392 + struct fapll_synth *synth;
393 ++ struct clk *clk = ERR_PTR(-ENOMEM);
394 +
395 + init = kzalloc(sizeof(*init), GFP_KERNEL);
396 + if (!init)
397 +@@ -519,13 +520,19 @@ static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd,
398 + synth->hw.init = init;
399 + synth->clk_pll = pll_clk;
400 +
401 +- return clk_register(NULL, &synth->hw);
402 ++ clk = clk_register(NULL, &synth->hw);
403 ++ if (IS_ERR(clk)) {
404 ++ pr_err("failed to register clock\n");
405 ++ goto free;
406 ++ }
407 ++
408 ++ return clk;
409 +
410 + free:
411 + kfree(synth);
412 + kfree(init);
413 +
414 +- return ERR_PTR(-ENOMEM);
415 ++ return clk;
416 + }
417 +
418 + static void __init ti_fapll_setup(struct device_node *node)
419 +diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
420 +index c64d543d64bf6..4e303c77caed5 100644
421 +--- a/drivers/clocksource/arm_arch_timer.c
422 ++++ b/drivers/clocksource/arm_arch_timer.c
423 +@@ -310,15 +310,24 @@ static void arch_timer_evtstrm_enable(int divider)
424 +
425 + static void arch_timer_configure_evtstream(void)
426 + {
427 +- int evt_stream_div, pos;
428 ++ int evt_stream_div, lsb;
429 ++
430 ++ /*
431 ++ * As the event stream can at most be generated at half the frequency
432 ++ * of the counter, use half the frequency when computing the divider.
433 ++ */
434 ++ evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ / 2;
435 ++
436 ++ /*
437 ++ * Find the closest power of two to the divisor. If the adjacent bit
438 ++ * of lsb (last set bit, starts from 0) is set, then we use (lsb + 1).
439 ++ */
440 ++ lsb = fls(evt_stream_div) - 1;
441 ++ if (lsb > 0 && (evt_stream_div & BIT(lsb - 1)))
442 ++ lsb++;
443 +
444 +- /* Find the closest power of two to the divisor */
445 +- evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ;
446 +- pos = fls(evt_stream_div);
447 +- if (pos > 1 && !(evt_stream_div & (1 << (pos - 2))))
448 +- pos--;
449 + /* enable event stream */
450 +- arch_timer_evtstrm_enable(min(pos, 15));
451 ++ arch_timer_evtstrm_enable(max(0, min(lsb, 15)));
452 + }
453 +
454 + static void arch_counter_set_user_access(void)
455 +diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c
456 +index 1608f7105c9f8..ad743f2f31e78 100644
457 +--- a/drivers/cpufreq/highbank-cpufreq.c
458 ++++ b/drivers/cpufreq/highbank-cpufreq.c
459 +@@ -104,6 +104,13 @@ out_put_node:
460 + }
461 + module_init(hb_cpufreq_driver_init);
462 +
463 ++static const struct of_device_id __maybe_unused hb_cpufreq_of_match[] = {
464 ++ { .compatible = "calxeda,highbank" },
465 ++ { .compatible = "calxeda,ecx-2000" },
466 ++ { },
467 ++};
468 ++MODULE_DEVICE_TABLE(of, hb_cpufreq_of_match);
469 ++
470 + MODULE_AUTHOR("Mark Langsdorf <mark.langsdorf@×××××××.com>");
471 + MODULE_DESCRIPTION("Calxeda Highbank cpufreq driver");
472 + MODULE_LICENSE("GPL");
473 +diff --git a/drivers/cpufreq/ls1x-cpufreq.c b/drivers/cpufreq/ls1x-cpufreq.c
474 +index 262581b3318d7..367cb1615c30d 100644
475 +--- a/drivers/cpufreq/ls1x-cpufreq.c
476 ++++ b/drivers/cpufreq/ls1x-cpufreq.c
477 +@@ -217,6 +217,7 @@ static struct platform_driver ls1x_cpufreq_platdrv = {
478 +
479 + module_platform_driver(ls1x_cpufreq_platdrv);
480 +
481 ++MODULE_ALIAS("platform:ls1x-cpufreq");
482 + MODULE_AUTHOR("Kelvin Cheung <keguang.zhang@×××××.com>");
483 + MODULE_DESCRIPTION("Loongson 1 CPUFreq driver");
484 + MODULE_LICENSE("GPL");
485 +diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c
486 +index de5e89b2eaaa3..98f762cca9010 100644
487 +--- a/drivers/cpufreq/scpi-cpufreq.c
488 ++++ b/drivers/cpufreq/scpi-cpufreq.c
489 +@@ -119,6 +119,7 @@ static struct platform_driver scpi_cpufreq_platdrv = {
490 + };
491 + module_platform_driver(scpi_cpufreq_platdrv);
492 +
493 ++MODULE_ALIAS("platform:scpi-cpufreq");
494 + MODULE_AUTHOR("Sudeep Holla <sudeep.holla@×××.com>");
495 + MODULE_DESCRIPTION("ARM SCPI CPUFreq interface driver");
496 + MODULE_LICENSE("GPL v2");
497 +diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
498 +index 1c8857e7db894..cfefa18bca28b 100644
499 +--- a/drivers/crypto/talitos.c
500 ++++ b/drivers/crypto/talitos.c
501 +@@ -440,7 +440,7 @@ DEF_TALITOS2_DONE(ch1_3, TALITOS2_ISR_CH_1_3_DONE)
502 + /*
503 + * locate current (offending) descriptor
504 + */
505 +-static u32 current_desc_hdr(struct device *dev, int ch)
506 ++static __be32 current_desc_hdr(struct device *dev, int ch)
507 + {
508 + struct talitos_private *priv = dev_get_drvdata(dev);
509 + int tail, iter;
510 +@@ -471,13 +471,13 @@ static u32 current_desc_hdr(struct device *dev, int ch)
511 + /*
512 + * user diagnostics; report root cause of error based on execution unit status
513 + */
514 +-static void report_eu_error(struct device *dev, int ch, u32 desc_hdr)
515 ++static void report_eu_error(struct device *dev, int ch, __be32 desc_hdr)
516 + {
517 + struct talitos_private *priv = dev_get_drvdata(dev);
518 + int i;
519 +
520 + if (!desc_hdr)
521 +- desc_hdr = in_be32(priv->chan[ch].reg + TALITOS_DESCBUF);
522 ++ desc_hdr = cpu_to_be32(in_be32(priv->chan[ch].reg + TALITOS_DESCBUF));
523 +
524 + switch (desc_hdr & DESC_HDR_SEL0_MASK) {
525 + case DESC_HDR_SEL0_AFEU:
526 +diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
527 +index 44c499e1beeed..02b3feb76ca99 100644
528 +--- a/drivers/extcon/extcon-max77693.c
529 ++++ b/drivers/extcon/extcon-max77693.c
530 +@@ -1262,4 +1262,4 @@ module_platform_driver(max77693_muic_driver);
531 + MODULE_DESCRIPTION("Maxim MAX77693 Extcon driver");
532 + MODULE_AUTHOR("Chanwoo Choi <cw00.choi@×××××××.com>");
533 + MODULE_LICENSE("GPL");
534 +-MODULE_ALIAS("platform:extcon-max77693");
535 ++MODULE_ALIAS("platform:max77693-muic");
536 +diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
537 +index 25c68e4dc7a53..e465d71272584 100644
538 +--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
539 ++++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
540 +@@ -2125,7 +2125,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
541 + DRM_INFO("failed to retrieve link info, disabling eDP\n");
542 + cdv_intel_dp_encoder_destroy(encoder);
543 + cdv_intel_dp_destroy(connector);
544 +- goto err_priv;
545 ++ goto err_connector;
546 + } else {
547 + DRM_DEBUG_KMS("DPCD: Rev=%x LN_Rate=%x LN_CNT=%x LN_DOWNSP=%x\n",
548 + intel_dp->dpcd[0], intel_dp->dpcd[1],
549 +diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
550 +index 8282ae0c4fc3e..bed6862798825 100644
551 +--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
552 ++++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
553 +@@ -720,6 +720,7 @@ static int omap_dmm_probe(struct platform_device *dev)
554 + &omap_dmm->refill_pa, GFP_KERNEL);
555 + if (!omap_dmm->refill_va) {
556 + dev_err(&dev->dev, "could not allocate refill memory\n");
557 ++ ret = -ENOMEM;
558 + goto fail;
559 + }
560 +
561 +diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
562 +index dffff64b59893..da91e9e9ed8f1 100644
563 +--- a/drivers/iio/adc/rockchip_saradc.c
564 ++++ b/drivers/iio/adc/rockchip_saradc.c
565 +@@ -359,7 +359,7 @@ static int rockchip_saradc_resume(struct device *dev)
566 +
567 + ret = clk_prepare_enable(info->clk);
568 + if (ret)
569 +- return ret;
570 ++ clk_disable_unprepare(info->pclk);
571 +
572 + return ret;
573 + }
574 +diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c
575 +index 0f5b8767ec2e6..6ed4e6902effe 100644
576 +--- a/drivers/iio/pressure/mpl3115.c
577 ++++ b/drivers/iio/pressure/mpl3115.c
578 +@@ -139,7 +139,14 @@ static irqreturn_t mpl3115_trigger_handler(int irq, void *p)
579 + struct iio_poll_func *pf = p;
580 + struct iio_dev *indio_dev = pf->indio_dev;
581 + struct mpl3115_data *data = iio_priv(indio_dev);
582 +- u8 buffer[16]; /* 32-bit channel + 16-bit channel + padding + ts */
583 ++ /*
584 ++ * 32-bit channel + 16-bit channel + padding + ts
585 ++ * Note that it is possible for only one of the first 2
586 ++ * channels to be enabled. If that happens, the first element
587 ++ * of the buffer may be either 16 or 32-bits. As such we cannot
588 ++ * use a simple structure definition to express this data layout.
589 ++ */
590 ++ u8 buffer[16] __aligned(8);
591 + int ret, pos = 0;
592 +
593 + mutex_lock(&data->lock);
594 +diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
595 +index 53c622c99ee40..ba713bc27c5f9 100644
596 +--- a/drivers/infiniband/core/cm.c
597 ++++ b/drivers/infiniband/core/cm.c
598 +@@ -1252,6 +1252,7 @@ int ib_send_cm_req(struct ib_cm_id *cm_id,
599 + id.local_id);
600 + if (IS_ERR(cm_id_priv->timewait_info)) {
601 + ret = PTR_ERR(cm_id_priv->timewait_info);
602 ++ cm_id_priv->timewait_info = NULL;
603 + goto out;
604 + }
605 +
606 +@@ -1681,6 +1682,7 @@ static int cm_req_handler(struct cm_work *work)
607 + id.local_id);
608 + if (IS_ERR(cm_id_priv->timewait_info)) {
609 + ret = PTR_ERR(cm_id_priv->timewait_info);
610 ++ cm_id_priv->timewait_info = NULL;
611 + goto destroy;
612 + }
613 + cm_id_priv->timewait_info->work.remote_id = req_msg->local_comm_id;
614 +diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
615 +index 59e1f6ea2ede9..1b0bb340281e6 100644
616 +--- a/drivers/infiniband/hw/mthca/mthca_cq.c
617 ++++ b/drivers/infiniband/hw/mthca/mthca_cq.c
618 +@@ -612,7 +612,7 @@ static inline int mthca_poll_one(struct mthca_dev *dev,
619 + entry->opcode = IB_WC_BIND_MW;
620 + break;
621 + default:
622 +- entry->opcode = MTHCA_OPCODE_INVALID;
623 ++ entry->opcode = 0xFF;
624 + break;
625 + }
626 + } else {
627 +diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
628 +index 4393a022867ba..e1fc67e73bf87 100644
629 +--- a/drivers/infiniband/hw/mthca/mthca_dev.h
630 ++++ b/drivers/infiniband/hw/mthca/mthca_dev.h
631 +@@ -105,7 +105,6 @@ enum {
632 + MTHCA_OPCODE_ATOMIC_CS = 0x11,
633 + MTHCA_OPCODE_ATOMIC_FA = 0x12,
634 + MTHCA_OPCODE_BIND_MW = 0x18,
635 +- MTHCA_OPCODE_INVALID = 0xff
636 + };
637 +
638 + enum {
639 +diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
640 +index b01966dc7eb3d..44a5a5496cfd0 100644
641 +--- a/drivers/input/keyboard/cros_ec_keyb.c
642 ++++ b/drivers/input/keyboard/cros_ec_keyb.c
643 +@@ -137,6 +137,7 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
644 + "changed: [r%d c%d]: byte %02x\n",
645 + row, col, new_state);
646 +
647 ++ input_event(idev, EV_MSC, MSC_SCAN, pos);
648 + input_report_key(idev, keycodes[pos],
649 + new_state);
650 + }
651 +diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
652 +index 50a7faa504f72..c8c6650b9140b 100644
653 +--- a/drivers/input/misc/cm109.c
654 ++++ b/drivers/input/misc/cm109.c
655 +@@ -546,12 +546,15 @@ static int cm109_input_open(struct input_dev *idev)
656 + dev->ctl_data->byte[HID_OR2] = dev->keybit;
657 + dev->ctl_data->byte[HID_OR3] = 0x00;
658 +
659 ++ dev->ctl_urb_pending = 1;
660 + error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL);
661 +- if (error)
662 ++ if (error) {
663 ++ dev->ctl_urb_pending = 0;
664 + dev_err(&dev->intf->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n",
665 + __func__, error);
666 +- else
667 ++ } else {
668 + dev->open = 1;
669 ++ }
670 +
671 + mutex_unlock(&dev->pm_mutex);
672 +
673 +diff --git a/drivers/input/mouse/cyapa_gen6.c b/drivers/input/mouse/cyapa_gen6.c
674 +index e4eb048d1bf63..c7ab84bc877f9 100644
675 +--- a/drivers/input/mouse/cyapa_gen6.c
676 ++++ b/drivers/input/mouse/cyapa_gen6.c
677 +@@ -573,7 +573,7 @@ static int cyapa_pip_retrieve_data_structure(struct cyapa *cyapa,
678 +
679 + memset(&cmd, 0, sizeof(cmd));
680 + put_unaligned_le16(PIP_OUTPUT_REPORT_ADDR, &cmd.head.addr);
681 +- put_unaligned_le16(sizeof(cmd), &cmd.head.length - 2);
682 ++ put_unaligned_le16(sizeof(cmd) - 2, &cmd.head.length);
683 + cmd.head.report_id = PIP_APP_CMD_REPORT_ID;
684 + cmd.head.cmd_code = PIP_RETRIEVE_DATA_STRUCTURE;
685 + put_unaligned_le16(read_offset, &cmd.read_offset);
686 +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
687 +index 1f45010a5b814..fa07be0b4500e 100644
688 +--- a/drivers/input/serio/i8042-x86ia64io.h
689 ++++ b/drivers/input/serio/i8042-x86ia64io.h
690 +@@ -687,6 +687,48 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
691 + DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
692 + },
693 + },
694 ++ {
695 ++ .matches = {
696 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
697 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A114-31"),
698 ++ },
699 ++ },
700 ++ {
701 ++ .matches = {
702 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
703 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A314-31"),
704 ++ },
705 ++ },
706 ++ {
707 ++ .matches = {
708 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
709 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A315-31"),
710 ++ },
711 ++ },
712 ++ {
713 ++ .matches = {
714 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
715 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-132"),
716 ++ },
717 ++ },
718 ++ {
719 ++ .matches = {
720 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
721 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-332"),
722 ++ },
723 ++ },
724 ++ {
725 ++ .matches = {
726 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
727 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-432"),
728 ++ },
729 ++ },
730 ++ {
731 ++ .matches = {
732 ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
733 ++ DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate Spin B118-RN"),
734 ++ },
735 ++ },
736 + {
737 + /* Advent 4211 */
738 + .matches = {
739 +diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
740 +index a61b2153ab8c2..1d98198c4bdfb 100644
741 +--- a/drivers/input/touchscreen/ads7846.c
742 ++++ b/drivers/input/touchscreen/ads7846.c
743 +@@ -35,6 +35,7 @@
744 + #include <linux/regulator/consumer.h>
745 + #include <linux/module.h>
746 + #include <asm/irq.h>
747 ++#include <asm/unaligned.h>
748 +
749 + /*
750 + * This code has been heavily tested on a Nokia 770, and lightly
751 +@@ -410,7 +411,7 @@ static int ads7845_read12_ser(struct device *dev, unsigned command)
752 +
753 + if (status == 0) {
754 + /* BE12 value, then padding */
755 +- status = be16_to_cpu(*((u16 *)&req->sample[1]));
756 ++ status = get_unaligned_be16(&req->sample[1]);
757 + status = status >> 3;
758 + status &= 0x0fff;
759 + }
760 +@@ -785,10 +786,11 @@ static void ads7846_report_state(struct ads7846 *ts)
761 + /* compute touch pressure resistance using equation #2 */
762 + Rt = z2;
763 + Rt -= z1;
764 +- Rt *= x;
765 + Rt *= ts->x_plate_ohms;
766 ++ Rt = DIV_ROUND_CLOSEST(Rt, 16);
767 ++ Rt *= x;
768 + Rt /= z1;
769 +- Rt = (Rt + 2047) >> 12;
770 ++ Rt = DIV_ROUND_CLOSEST(Rt, 256);
771 + } else {
772 + Rt = 0;
773 + }
774 +diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
775 +index 67cadda13ab17..d7cc8f6a292ea 100644
776 +--- a/drivers/input/touchscreen/goodix.c
777 ++++ b/drivers/input/touchscreen/goodix.c
778 +@@ -77,6 +77,18 @@ static const struct dmi_system_id rotated_screen[] = {
779 + DMI_MATCH(DMI_BIOS_DATE, "12/19/2014"),
780 + },
781 + },
782 ++ {
783 ++ .ident = "Teclast X98 Pro",
784 ++ .matches = {
785 ++ /*
786 ++ * Only match BIOS date, because the manufacturers
787 ++ * BIOS does not report the board name at all
788 ++ * (sometimes)...
789 ++ */
790 ++ DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"),
791 ++ DMI_MATCH(DMI_BIOS_DATE, "10/28/2015"),
792 ++ },
793 ++ },
794 + {
795 + .ident = "WinBook TW100",
796 + .matches = {
797 +diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
798 +index 9371194677dc3..eab3f7325e310 100644
799 +--- a/drivers/md/dm-ioctl.c
800 ++++ b/drivers/md/dm-ioctl.c
801 +@@ -1539,6 +1539,7 @@ static int target_message(struct dm_ioctl *param, size_t param_size)
802 +
803 + if (!argc) {
804 + DMWARN("Empty message received.");
805 ++ r = -EINVAL;
806 + goto out_argv;
807 + }
808 +
809 +diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
810 +index 466158d06ab1b..8eed39dc2036a 100644
811 +--- a/drivers/md/dm-table.c
812 ++++ b/drivers/md/dm-table.c
813 +@@ -1154,12 +1154,6 @@ void dm_table_event_callback(struct dm_table *t,
814 +
815 + void dm_table_event(struct dm_table *t)
816 + {
817 +- /*
818 +- * You can no longer call dm_table_event() from interrupt
819 +- * context, use a bottom half instead.
820 +- */
821 +- BUG_ON(in_interrupt());
822 +-
823 + mutex_lock(&_event_lock);
824 + if (t->event_fn)
825 + t->event_fn(t->event_context);
826 +diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
827 +index f33c0de3e8490..019bbc18cede6 100644
828 +--- a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
829 ++++ b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
830 +@@ -184,7 +184,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
831 + struct spi_master *master;
832 + struct netup_spi *nspi;
833 +
834 +- master = spi_alloc_master(&ndev->pci_dev->dev,
835 ++ master = devm_spi_alloc_master(&ndev->pci_dev->dev,
836 + sizeof(struct netup_spi));
837 + if (!master) {
838 + dev_err(&ndev->pci_dev->dev,
839 +@@ -217,6 +217,7 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
840 + ndev->pci_slot,
841 + ndev->pci_func);
842 + if (!spi_new_device(master, &netup_spi_board)) {
843 ++ spi_unregister_master(master);
844 + ndev->spi = NULL;
845 + dev_err(&ndev->pci_dev->dev,
846 + "%s(): unable to create SPI device\n", __func__);
847 +@@ -235,13 +236,13 @@ void netup_spi_release(struct netup_unidvb_dev *ndev)
848 + if (!spi)
849 + return;
850 +
851 ++ spi_unregister_master(spi->master);
852 + spin_lock_irqsave(&spi->lock, flags);
853 + reg = readw(&spi->regs->control_stat);
854 + writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat);
855 + reg = readw(&spi->regs->control_stat);
856 + writew(reg & ~NETUP_SPI_CTRL_IMASK, &spi->regs->control_stat);
857 + spin_unlock_irqrestore(&spi->lock, flags);
858 +- spi_unregister_master(spi->master);
859 + ndev->spi = NULL;
860 + }
861 +
862 +diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c
863 +index 0ca1e07ae7837..868af73c5536a 100644
864 +--- a/drivers/media/pci/saa7146/mxb.c
865 ++++ b/drivers/media/pci/saa7146/mxb.c
866 +@@ -652,16 +652,17 @@ static int vidioc_s_audio(struct file *file, void *fh, const struct v4l2_audio *
867 + struct mxb *mxb = (struct mxb *)dev->ext_priv;
868 +
869 + DEB_D("VIDIOC_S_AUDIO %d\n", a->index);
870 +- if (mxb_inputs[mxb->cur_input].audioset & (1 << a->index)) {
871 +- if (mxb->cur_audinput != a->index) {
872 +- mxb->cur_audinput = a->index;
873 +- tea6420_route(mxb, a->index);
874 +- if (mxb->cur_audinput == 0)
875 +- mxb_update_audmode(mxb);
876 +- }
877 +- return 0;
878 ++ if (a->index >= 32 ||
879 ++ !(mxb_inputs[mxb->cur_input].audioset & (1 << a->index)))
880 ++ return -EINVAL;
881 ++
882 ++ if (mxb->cur_audinput != a->index) {
883 ++ mxb->cur_audinput = a->index;
884 ++ tea6420_route(mxb, a->index);
885 ++ if (mxb->cur_audinput == 0)
886 ++ mxb_update_audmode(mxb);
887 + }
888 +- return -EINVAL;
889 ++ return 0;
890 + }
891 +
892 + #ifdef CONFIG_VIDEO_ADV_DEBUG
893 +diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c
894 +index 4a37a1c51c488..30407955a4d17 100644
895 +--- a/drivers/media/pci/solo6x10/solo6x10-g723.c
896 ++++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
897 +@@ -385,7 +385,7 @@ int solo_g723_init(struct solo_dev *solo_dev)
898 +
899 + ret = snd_ctl_add(card, snd_ctl_new1(&kctl, solo_dev));
900 + if (ret < 0)
901 +- return ret;
902 ++ goto snd_error;
903 +
904 + ret = solo_snd_pcm_init(solo_dev);
905 + if (ret < 0)
906 +diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c
907 +index 40f77685cc4a2..3ad7b67797e9f 100644
908 +--- a/drivers/media/rc/sunxi-cir.c
909 ++++ b/drivers/media/rc/sunxi-cir.c
910 +@@ -132,6 +132,8 @@ static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id)
911 + } else if (status & REG_RXINT_RPEI_EN) {
912 + ir_raw_event_set_idle(ir->rc, true);
913 + ir_raw_event_handle(ir->rc);
914 ++ } else {
915 ++ ir_raw_event_handle(ir->rc);
916 + }
917 +
918 + spin_unlock(&ir->ir_lock);
919 +diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
920 +index 3733c15c753ec..17b7b02330c97 100644
921 +--- a/drivers/media/usb/gspca/gspca.c
922 ++++ b/drivers/media/usb/gspca/gspca.c
923 +@@ -2130,6 +2130,7 @@ out:
924 + input_unregister_device(gspca_dev->input_dev);
925 + #endif
926 + v4l2_ctrl_handler_free(gspca_dev->vdev.ctrl_handler);
927 ++ v4l2_device_unregister(&gspca_dev->v4l2_dev);
928 + kfree(gspca_dev->usb_buf);
929 + kfree(gspca_dev);
930 + return ret;
931 +diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c
932 +index e06a21a4fbd9a..322238d9aa713 100644
933 +--- a/drivers/media/usb/msi2500/msi2500.c
934 ++++ b/drivers/media/usb/msi2500/msi2500.c
935 +@@ -1254,7 +1254,7 @@ static int msi2500_probe(struct usb_interface *intf,
936 + }
937 +
938 + dev->master = master;
939 +- master->bus_num = 0;
940 ++ master->bus_num = -1;
941 + master->num_chipselect = 1;
942 + master->transfer_one_message = msi2500_transfer_one_message;
943 + spi_master_set_devdata(master, dev);
944 +diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
945 +index 1041eb7a61672..2cae85a7ca6de 100644
946 +--- a/drivers/memstick/core/memstick.c
947 ++++ b/drivers/memstick/core/memstick.c
948 +@@ -469,7 +469,6 @@ static void memstick_check(struct work_struct *work)
949 + host->card = card;
950 + if (device_register(&card->dev)) {
951 + put_device(&card->dev);
952 +- kfree(host->card);
953 + host->card = NULL;
954 + }
955 + } else
956 +diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c
957 +index ef09ba0289d72..b3857445d6736 100644
958 +--- a/drivers/memstick/host/r592.c
959 ++++ b/drivers/memstick/host/r592.c
960 +@@ -763,8 +763,10 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id)
961 + goto error3;
962 +
963 + dev->mmio = pci_ioremap_bar(pdev, 0);
964 +- if (!dev->mmio)
965 ++ if (!dev->mmio) {
966 ++ error = -ENOMEM;
967 + goto error4;
968 ++ }
969 +
970 + dev->irq = pdev->irq;
971 + spin_lock_init(&dev->irq_lock);
972 +@@ -791,12 +793,14 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id)
973 + &dev->dummy_dma_page_physical_address, GFP_KERNEL);
974 + r592_stop_dma(dev , 0);
975 +
976 +- if (request_irq(dev->irq, &r592_irq, IRQF_SHARED,
977 +- DRV_NAME, dev))
978 ++ error = request_irq(dev->irq, &r592_irq, IRQF_SHARED,
979 ++ DRV_NAME, dev);
980 ++ if (error)
981 + goto error6;
982 +
983 + r592_update_card_detect(dev);
984 +- if (memstick_add_host(host))
985 ++ error = memstick_add_host(host);
986 ++ if (error)
987 + goto error7;
988 +
989 + message("driver successfully loaded");
990 +diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c
991 +index ffbc9b304beb2..ab5b023ad2791 100644
992 +--- a/drivers/mtd/cmdlinepart.c
993 ++++ b/drivers/mtd/cmdlinepart.c
994 +@@ -228,7 +228,7 @@ static int mtdpart_setup_real(char *s)
995 + struct cmdline_mtd_partition *this_mtd;
996 + struct mtd_partition *parts;
997 + int mtd_id_len, num_parts;
998 +- char *p, *mtd_id, *semicol;
999 ++ char *p, *mtd_id, *semicol, *open_parenth;
1000 +
1001 + /*
1002 + * Replace the first ';' by a NULL char so strrchr can work
1003 +@@ -238,6 +238,14 @@ static int mtdpart_setup_real(char *s)
1004 + if (semicol)
1005 + *semicol = '\0';
1006 +
1007 ++ /*
1008 ++ * make sure that part-names with ":" will not be handled as
1009 ++ * part of the mtd-id with an ":"
1010 ++ */
1011 ++ open_parenth = strchr(s, '(');
1012 ++ if (open_parenth)
1013 ++ *open_parenth = '\0';
1014 ++
1015 + mtd_id = s;
1016 +
1017 + /*
1018 +@@ -247,6 +255,10 @@ static int mtdpart_setup_real(char *s)
1019 + */
1020 + p = strrchr(s, ':');
1021 +
1022 ++ /* Restore the '(' now. */
1023 ++ if (open_parenth)
1024 ++ *open_parenth = '(';
1025 ++
1026 + /* Restore the ';' now. */
1027 + if (semicol)
1028 + *semicol = ';';
1029 +diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
1030 +index 7621f91a8a209..fd48770ba7920 100644
1031 +--- a/drivers/net/can/softing/softing_main.c
1032 ++++ b/drivers/net/can/softing/softing_main.c
1033 +@@ -393,8 +393,13 @@ static int softing_netdev_open(struct net_device *ndev)
1034 +
1035 + /* check or determine and set bittime */
1036 + ret = open_candev(ndev);
1037 +- if (!ret)
1038 +- ret = softing_startstop(ndev, 1);
1039 ++ if (ret)
1040 ++ return ret;
1041 ++
1042 ++ ret = softing_startstop(ndev, 1);
1043 ++ if (ret < 0)
1044 ++ close_candev(ndev);
1045 ++
1046 + return ret;
1047 + }
1048 +
1049 +diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
1050 +index dde3cd2d47631..10dda58849c6e 100644
1051 +--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
1052 ++++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
1053 +@@ -853,13 +853,13 @@ static int emac_probe(struct platform_device *pdev)
1054 + db->clk = devm_clk_get(&pdev->dev, NULL);
1055 + if (IS_ERR(db->clk)) {
1056 + ret = PTR_ERR(db->clk);
1057 +- goto out_iounmap;
1058 ++ goto out_dispose_mapping;
1059 + }
1060 +
1061 + ret = clk_prepare_enable(db->clk);
1062 + if (ret) {
1063 + dev_err(&pdev->dev, "Error couldn't enable clock (%d)\n", ret);
1064 +- goto out_iounmap;
1065 ++ goto out_dispose_mapping;
1066 + }
1067 +
1068 + ret = sunxi_sram_claim(&pdev->dev);
1069 +@@ -916,6 +916,8 @@ out_release_sram:
1070 + sunxi_sram_release(&pdev->dev);
1071 + out_clk_disable_unprepare:
1072 + clk_disable_unprepare(db->clk);
1073 ++out_dispose_mapping:
1074 ++ irq_dispose_mapping(ndev->irq);
1075 + out_iounmap:
1076 + iounmap(db->membase);
1077 + out:
1078 +@@ -934,6 +936,7 @@ static int emac_remove(struct platform_device *pdev)
1079 + unregister_netdev(ndev);
1080 + sunxi_sram_release(&pdev->dev);
1081 + clk_disable_unprepare(db->clk);
1082 ++ irq_dispose_mapping(ndev->irq);
1083 + iounmap(db->membase);
1084 + free_netdev(ndev);
1085 +
1086 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1087 +index bae8df9517808..3a6cebff9f426 100644
1088 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1089 ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1090 +@@ -3518,8 +3518,10 @@ static int bcmgenet_probe(struct platform_device *pdev)
1091 + clk_disable_unprepare(priv->clk);
1092 +
1093 + err = register_netdev(dev);
1094 +- if (err)
1095 ++ if (err) {
1096 ++ bcmgenet_mii_exit(dev);
1097 + goto err;
1098 ++ }
1099 +
1100 + return err;
1101 +
1102 +diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
1103 +index b491de946a0e6..88f5c45d9eef4 100644
1104 +--- a/drivers/net/ethernet/korina.c
1105 ++++ b/drivers/net/ethernet/korina.c
1106 +@@ -216,7 +216,7 @@ static int korina_send_packet(struct sk_buff *skb, struct net_device *dev)
1107 + dev_kfree_skb_any(skb);
1108 + spin_unlock_irqrestore(&lp->lock, flags);
1109 +
1110 +- return NETDEV_TX_BUSY;
1111 ++ return NETDEV_TX_OK;
1112 + }
1113 + }
1114 +
1115 +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1116 +index 7d61a5de9d5a4..b7bde70a3e952 100644
1117 +--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1118 ++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1119 +@@ -1313,8 +1313,10 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
1120 + }
1121 +
1122 + priv->port_stats.tx_timeout++;
1123 +- en_dbg(DRV, priv, "Scheduling watchdog\n");
1124 +- queue_work(mdev->workqueue, &priv->watchdog_task);
1125 ++ if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state)) {
1126 ++ en_dbg(DRV, priv, "Scheduling port restart\n");
1127 ++ queue_work(mdev->workqueue, &priv->restart_task);
1128 ++ }
1129 + }
1130 +
1131 +
1132 +@@ -1730,6 +1732,7 @@ int mlx4_en_start_port(struct net_device *dev)
1133 + local_bh_enable();
1134 + }
1135 +
1136 ++ clear_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state);
1137 + netif_tx_start_all_queues(dev);
1138 + netif_device_attach(dev);
1139 +
1140 +@@ -1891,7 +1894,7 @@ void mlx4_en_stop_port(struct net_device *dev, int detach)
1141 + static void mlx4_en_restart(struct work_struct *work)
1142 + {
1143 + struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
1144 +- watchdog_task);
1145 ++ restart_task);
1146 + struct mlx4_en_dev *mdev = priv->mdev;
1147 + struct net_device *dev = priv->dev;
1148 +
1149 +@@ -2121,7 +2124,7 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
1150 + if (netif_running(dev)) {
1151 + mutex_lock(&mdev->state_lock);
1152 + if (!mdev->device_up) {
1153 +- /* NIC is probably restarting - let watchdog task reset
1154 ++ /* NIC is probably restarting - let restart task reset
1155 + * the port */
1156 + en_dbg(DRV, priv, "Change MTU called with card down!?\n");
1157 + } else {
1158 +@@ -2130,7 +2133,9 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
1159 + if (err) {
1160 + en_err(priv, "Failed restarting port:%d\n",
1161 + priv->port);
1162 +- queue_work(mdev->workqueue, &priv->watchdog_task);
1163 ++ if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING,
1164 ++ &priv->state))
1165 ++ queue_work(mdev->workqueue, &priv->restart_task);
1166 + }
1167 + }
1168 + mutex_unlock(&mdev->state_lock);
1169 +@@ -2850,7 +2855,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
1170 + priv->counter_index = MLX4_SINK_COUNTER_INDEX(mdev->dev);
1171 + spin_lock_init(&priv->stats_lock);
1172 + INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode);
1173 +- INIT_WORK(&priv->watchdog_task, mlx4_en_restart);
1174 ++ INIT_WORK(&priv->restart_task, mlx4_en_restart);
1175 + INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate);
1176 + INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats);
1177 + INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task);
1178 +diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
1179 +index 607daaffae986..440f1ab6d92e2 100644
1180 +--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
1181 ++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
1182 +@@ -495,6 +495,10 @@ struct mlx4_en_stats_bitmap {
1183 + struct mutex mutex; /* for mutual access to stats bitmap */
1184 + };
1185 +
1186 ++enum {
1187 ++ MLX4_EN_STATE_FLAG_RESTARTING,
1188 ++};
1189 ++
1190 + struct mlx4_en_priv {
1191 + struct mlx4_en_dev *mdev;
1192 + struct mlx4_en_port_profile *prof;
1193 +@@ -560,7 +564,7 @@ struct mlx4_en_priv {
1194 + struct mlx4_en_cq *rx_cq[MAX_RX_RINGS];
1195 + struct mlx4_qp drop_qp;
1196 + struct work_struct rx_mode_task;
1197 +- struct work_struct watchdog_task;
1198 ++ struct work_struct restart_task;
1199 + struct work_struct linkstate_task;
1200 + struct delayed_work stats_task;
1201 + struct delayed_work service_task;
1202 +@@ -605,6 +609,7 @@ struct mlx4_en_priv {
1203 + u32 pflags;
1204 + u8 rss_key[MLX4_EN_RSS_KEY_SIZE];
1205 + u8 rss_hash_fn;
1206 ++ unsigned long state;
1207 + };
1208 +
1209 + enum mlx4_en_wol {
1210 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
1211 +index 1205f6f9c9417..a4b10776f8346 100644
1212 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
1213 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
1214 +@@ -2506,6 +2506,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1215 + qlcnic_sriov_vf_register_map(ahw);
1216 + break;
1217 + default:
1218 ++ err = -EINVAL;
1219 + goto err_out_free_hw_res;
1220 + }
1221 +
1222 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1223 +index 6f695239e6580..d9462ee91a4bc 100644
1224 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1225 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
1226 +@@ -1897,9 +1897,6 @@ static int stmmac_release(struct net_device *dev)
1227 + {
1228 + struct stmmac_priv *priv = netdev_priv(dev);
1229 +
1230 +- if (priv->eee_enabled)
1231 +- del_timer_sync(&priv->eee_ctrl_timer);
1232 +-
1233 + /* Stop and disconnect the PHY */
1234 + if (priv->phydev) {
1235 + phy_stop(priv->phydev);
1236 +@@ -1920,6 +1917,11 @@ static int stmmac_release(struct net_device *dev)
1237 + if (priv->lpi_irq > 0)
1238 + free_irq(priv->lpi_irq, dev);
1239 +
1240 ++ if (priv->eee_enabled) {
1241 ++ priv->tx_path_in_lpi_mode = false;
1242 ++ del_timer_sync(&priv->eee_ctrl_timer);
1243 ++ }
1244 ++
1245 + /* Stop TX/RX DMA and clear the descriptors */
1246 + priv->hw->dma->stop_tx(priv->ioaddr);
1247 + priv->hw->dma->stop_rx(priv->ioaddr);
1248 +@@ -3068,6 +3070,11 @@ int stmmac_suspend(struct net_device *ndev)
1249 +
1250 + napi_disable(&priv->napi);
1251 +
1252 ++ if (priv->eee_enabled) {
1253 ++ priv->tx_path_in_lpi_mode = false;
1254 ++ del_timer_sync(&priv->eee_ctrl_timer);
1255 ++ }
1256 ++
1257 + /* Stop TX/RX DMA */
1258 + priv->hw->dma->stop_tx(priv->ioaddr);
1259 + priv->hw->dma->stop_rx(priv->ioaddr);
1260 +diff --git a/drivers/net/wireless/cw1200/main.c b/drivers/net/wireless/cw1200/main.c
1261 +index 317daa968e037..057725b06f640 100644
1262 +--- a/drivers/net/wireless/cw1200/main.c
1263 ++++ b/drivers/net/wireless/cw1200/main.c
1264 +@@ -385,6 +385,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,
1265 + CW1200_LINK_ID_MAX,
1266 + cw1200_skb_dtor,
1267 + priv)) {
1268 ++ destroy_workqueue(priv->workqueue);
1269 + ieee80211_free_hw(hw);
1270 + return NULL;
1271 + }
1272 +@@ -396,6 +397,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,
1273 + for (; i > 0; i--)
1274 + cw1200_queue_deinit(&priv->tx_queue[i - 1]);
1275 + cw1200_queue_stats_deinit(&priv->tx_queue_stats);
1276 ++ destroy_workqueue(priv->workqueue);
1277 + ieee80211_free_hw(hw);
1278 + return NULL;
1279 + }
1280 +diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c
1281 +index 3c5baccd67922..8eb73d54b1d6d 100644
1282 +--- a/drivers/net/wireless/orinoco/orinoco_usb.c
1283 ++++ b/drivers/net/wireless/orinoco/orinoco_usb.c
1284 +@@ -1224,13 +1224,6 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
1285 + if (skb->len < ETH_HLEN)
1286 + goto drop;
1287 +
1288 +- ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0);
1289 +- if (!ctx)
1290 +- goto busy;
1291 +-
1292 +- memset(ctx->buf, 0, BULK_BUF_SIZE);
1293 +- buf = ctx->buf->data;
1294 +-
1295 + tx_control = 0;
1296 +
1297 + err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control,
1298 +@@ -1238,6 +1231,13 @@ static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev)
1299 + if (err)
1300 + goto drop;
1301 +
1302 ++ ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0);
1303 ++ if (!ctx)
1304 ++ goto drop;
1305 ++
1306 ++ memset(ctx->buf, 0, BULK_BUF_SIZE);
1307 ++ buf = ctx->buf->data;
1308 ++
1309 + {
1310 + __le16 *tx_cntl = (__le16 *)buf;
1311 + *tx_cntl = cpu_to_le16(tx_control);
1312 +diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
1313 +index 56ebd8267386e..21c8e2720b403 100644
1314 +--- a/drivers/net/xen-netback/xenbus.c
1315 ++++ b/drivers/net/xen-netback/xenbus.c
1316 +@@ -697,12 +697,14 @@ static int xen_register_watchers(struct xenbus_device *dev, struct xenvif *vif)
1317 + return -ENOMEM;
1318 + snprintf(node, maxlen, "%s/rate", dev->nodename);
1319 + vif->credit_watch.node = node;
1320 ++ vif->credit_watch.will_handle = NULL;
1321 + vif->credit_watch.callback = xen_net_rate_changed;
1322 + err = register_xenbus_watch(&vif->credit_watch);
1323 + if (err) {
1324 + pr_err("Failed to set watcher %s\n", vif->credit_watch.node);
1325 + kfree(node);
1326 + vif->credit_watch.node = NULL;
1327 ++ vif->credit_watch.will_handle = NULL;
1328 + vif->credit_watch.callback = NULL;
1329 + }
1330 + return err;
1331 +@@ -847,7 +849,7 @@ static void connect(struct backend_info *be)
1332 + xenvif_carrier_on(be->vif);
1333 +
1334 + unregister_hotplug_status_watch(be);
1335 +- err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch,
1336 ++ err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL,
1337 + hotplug_status_changed,
1338 + "%s/%s", dev->nodename, "hotplug-status");
1339 + if (!err)
1340 +diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c
1341 +index 64a90252c57f2..b387845d3c72a 100644
1342 +--- a/drivers/nfc/s3fwrn5/firmware.c
1343 ++++ b/drivers/nfc/s3fwrn5/firmware.c
1344 +@@ -304,8 +304,10 @@ static int s3fwrn5_fw_request_firmware(struct s3fwrn5_fw_info *fw_info)
1345 + if (ret < 0)
1346 + return ret;
1347 +
1348 +- if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE)
1349 ++ if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE) {
1350 ++ release_firmware(fw->fw);
1351 + return -EINVAL;
1352 ++ }
1353 +
1354 + memcpy(fw->date, fw->fw->data + 0x00, 12);
1355 + fw->date[12] = '\0';
1356 +diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
1357 +index 01a343ad7155c..14d84d5a0f581 100644
1358 +--- a/drivers/pci/slot.c
1359 ++++ b/drivers/pci/slot.c
1360 +@@ -307,6 +307,9 @@ placeholder:
1361 + goto err;
1362 + }
1363 +
1364 ++ INIT_LIST_HEAD(&slot->list);
1365 ++ list_add(&slot->list, &parent->slots);
1366 ++
1367 + err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL,
1368 + "%s", slot_name);
1369 + if (err) {
1370 +@@ -314,9 +317,6 @@ placeholder:
1371 + goto err;
1372 + }
1373 +
1374 +- INIT_LIST_HEAD(&slot->list);
1375 +- list_add(&slot->list, &parent->slots);
1376 +-
1377 + down_read(&pci_bus_sem);
1378 + list_for_each_entry(dev, &parent->devices, bus_list)
1379 + if (PCI_SLOT(dev->devfn) == slot_nr)
1380 +diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
1381 +index a3b27856b9e97..43440b6b85bc3 100644
1382 +--- a/drivers/pinctrl/pinctrl-amd.c
1383 ++++ b/drivers/pinctrl/pinctrl-amd.c
1384 +@@ -399,7 +399,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
1385 + pin_reg &= ~BIT(LEVEL_TRIG_OFF);
1386 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
1387 + pin_reg |= ACTIVE_HIGH << ACTIVE_LEVEL_OFF;
1388 +- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF;
1389 + irq_set_handler_locked(d, handle_edge_irq);
1390 + break;
1391 +
1392 +@@ -407,7 +406,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
1393 + pin_reg &= ~BIT(LEVEL_TRIG_OFF);
1394 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
1395 + pin_reg |= ACTIVE_LOW << ACTIVE_LEVEL_OFF;
1396 +- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF;
1397 + irq_set_handler_locked(d, handle_edge_irq);
1398 + break;
1399 +
1400 +@@ -415,7 +413,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
1401 + pin_reg &= ~BIT(LEVEL_TRIG_OFF);
1402 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
1403 + pin_reg |= BOTH_EADGE << ACTIVE_LEVEL_OFF;
1404 +- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF;
1405 + irq_set_handler_locked(d, handle_edge_irq);
1406 + break;
1407 +
1408 +@@ -423,8 +420,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
1409 + pin_reg |= LEVEL_TRIGGER << LEVEL_TRIG_OFF;
1410 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
1411 + pin_reg |= ACTIVE_HIGH << ACTIVE_LEVEL_OFF;
1412 +- pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF);
1413 +- pin_reg |= DB_TYPE_PRESERVE_LOW_GLITCH << DB_CNTRL_OFF;
1414 + irq_set_handler_locked(d, handle_level_irq);
1415 + break;
1416 +
1417 +@@ -432,8 +427,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
1418 + pin_reg |= LEVEL_TRIGGER << LEVEL_TRIG_OFF;
1419 + pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
1420 + pin_reg |= ACTIVE_LOW << ACTIVE_LEVEL_OFF;
1421 +- pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF);
1422 +- pin_reg |= DB_TYPE_PRESERVE_HIGH_GLITCH << DB_CNTRL_OFF;
1423 + irq_set_handler_locked(d, handle_level_irq);
1424 + break;
1425 +
1426 +diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c
1427 +index 0b0fc2eb48e0b..adcdb0585d398 100644
1428 +--- a/drivers/pinctrl/pinctrl-falcon.c
1429 ++++ b/drivers/pinctrl/pinctrl-falcon.c
1430 +@@ -438,24 +438,28 @@ static int pinctrl_falcon_probe(struct platform_device *pdev)
1431 +
1432 + /* load and remap the pad resources of the different banks */
1433 + for_each_compatible_node(np, NULL, "lantiq,pad-falcon") {
1434 +- struct platform_device *ppdev = of_find_device_by_node(np);
1435 + const __be32 *bank = of_get_property(np, "lantiq,bank", NULL);
1436 + struct resource res;
1437 ++ struct platform_device *ppdev;
1438 + u32 avail;
1439 + int pins;
1440 +
1441 + if (!of_device_is_available(np))
1442 + continue;
1443 +
1444 +- if (!ppdev) {
1445 +- dev_err(&pdev->dev, "failed to find pad pdev\n");
1446 +- continue;
1447 +- }
1448 + if (!bank || *bank >= PORTS)
1449 + continue;
1450 + if (of_address_to_resource(np, 0, &res))
1451 + continue;
1452 ++
1453 ++ ppdev = of_find_device_by_node(np);
1454 ++ if (!ppdev) {
1455 ++ dev_err(&pdev->dev, "failed to find pad pdev\n");
1456 ++ continue;
1457 ++ }
1458 ++
1459 + falcon_info.clk[*bank] = clk_get(&ppdev->dev, NULL);
1460 ++ put_device(&ppdev->dev);
1461 + if (IS_ERR(falcon_info.clk[*bank])) {
1462 + dev_err(&ppdev->dev, "failed to get clock\n");
1463 + return PTR_ERR(falcon_info.clk[*bank]);
1464 +diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
1465 +index 5c169a837ebdf..b336f2620f9dc 100644
1466 +--- a/drivers/platform/x86/acer-wmi.c
1467 ++++ b/drivers/platform/x86/acer-wmi.c
1468 +@@ -124,6 +124,7 @@ static const struct key_entry acer_wmi_keymap[] __initconst = {
1469 + {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */
1470 + {KE_IGNORE, 0x81, {KEY_SLEEP} },
1471 + {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad Toggle */
1472 ++ {KE_IGNORE, 0x84, {KEY_KBDILLUMTOGGLE} }, /* Automatic Keyboard background light toggle */
1473 + {KE_KEY, KEY_TOUCHPAD_ON, {KEY_TOUCHPAD_ON} },
1474 + {KE_KEY, KEY_TOUCHPAD_OFF, {KEY_TOUCHPAD_OFF} },
1475 + {KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} },
1476 +diff --git a/drivers/ps3/ps3stor_lib.c b/drivers/ps3/ps3stor_lib.c
1477 +index 8c3f5adf1bc65..2d76183756626 100644
1478 +--- a/drivers/ps3/ps3stor_lib.c
1479 ++++ b/drivers/ps3/ps3stor_lib.c
1480 +@@ -201,7 +201,7 @@ int ps3stor_setup(struct ps3_storage_device *dev, irq_handler_t handler)
1481 + dev->bounce_lpar = ps3_mm_phys_to_lpar(__pa(dev->bounce_buf));
1482 + dev->bounce_dma = dma_map_single(&dev->sbd.core, dev->bounce_buf,
1483 + dev->bounce_size, DMA_BIDIRECTIONAL);
1484 +- if (!dev->bounce_dma) {
1485 ++ if (dma_mapping_error(&dev->sbd.core, dev->bounce_dma)) {
1486 + dev_err(&dev->sbd.core, "%s:%u: map DMA region failed\n",
1487 + __func__, __LINE__);
1488 + error = -ENODEV;
1489 +diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c
1490 +index 6601047d4b656..89b708135000c 100644
1491 +--- a/drivers/s390/block/dasd_alias.c
1492 ++++ b/drivers/s390/block/dasd_alias.c
1493 +@@ -258,7 +258,6 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device)
1494 + return;
1495 + device->discipline->get_uid(device, &uid);
1496 + spin_lock_irqsave(&lcu->lock, flags);
1497 +- list_del_init(&device->alias_list);
1498 + /* make sure that the workers don't use this device */
1499 + if (device == lcu->suc_data.device) {
1500 + spin_unlock_irqrestore(&lcu->lock, flags);
1501 +@@ -285,6 +284,7 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device)
1502 +
1503 + spin_lock_irqsave(&aliastree.lock, flags);
1504 + spin_lock(&lcu->lock);
1505 ++ list_del_init(&device->alias_list);
1506 + if (list_empty(&lcu->grouplist) &&
1507 + list_empty(&lcu->active_devices) &&
1508 + list_empty(&lcu->inactive_devices)) {
1509 +@@ -637,6 +637,7 @@ int dasd_alias_add_device(struct dasd_device *device)
1510 + }
1511 + if (lcu->flags & UPDATE_PENDING) {
1512 + list_move(&device->alias_list, &lcu->active_devices);
1513 ++ private->pavgroup = NULL;
1514 + _schedule_lcu_update(lcu, device);
1515 + }
1516 + spin_unlock(&lcu->lock);
1517 +diff --git a/drivers/scsi/bnx2i/Kconfig b/drivers/scsi/bnx2i/Kconfig
1518 +index ba30ff86d5818..b27a3738d940c 100644
1519 +--- a/drivers/scsi/bnx2i/Kconfig
1520 ++++ b/drivers/scsi/bnx2i/Kconfig
1521 +@@ -3,6 +3,7 @@ config SCSI_BNX2_ISCSI
1522 + depends on NET
1523 + depends on PCI
1524 + depends on (IPV6 || IPV6=n)
1525 ++ depends on MMU
1526 + select SCSI_ISCSI_ATTRS
1527 + select NETDEVICES
1528 + select ETHERNET
1529 +diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
1530 +index 58ce9020d69c5..389c13e1c9788 100644
1531 +--- a/drivers/scsi/fnic/fnic_main.c
1532 ++++ b/drivers/scsi/fnic/fnic_main.c
1533 +@@ -735,6 +735,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1534 + for (i = 0; i < FNIC_IO_LOCKS; i++)
1535 + spin_lock_init(&fnic->io_req_lock[i]);
1536 +
1537 ++ err = -ENOMEM;
1538 + fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache);
1539 + if (!fnic->io_req_pool)
1540 + goto err_out_free_resources;
1541 +diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
1542 +index 062ab34b86f8b..a982701bc3e0c 100644
1543 +--- a/drivers/scsi/pm8001/pm8001_init.c
1544 ++++ b/drivers/scsi/pm8001/pm8001_init.c
1545 +@@ -1063,7 +1063,8 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
1546 +
1547 + pm8001_init_sas_add(pm8001_ha);
1548 + /* phy setting support for motherboard controller */
1549 +- if (pm8001_configure_phy_settings(pm8001_ha))
1550 ++ rc = pm8001_configure_phy_settings(pm8001_ha);
1551 ++ if (rc)
1552 + goto err_out_shost;
1553 +
1554 + pm8001_post_sas_ha_init(shost, chip);
1555 +diff --git a/drivers/soc/tegra/fuse/speedo-tegra210.c b/drivers/soc/tegra/fuse/speedo-tegra210.c
1556 +index 5373f4c16b54c..4403b89561fd6 100644
1557 +--- a/drivers/soc/tegra/fuse/speedo-tegra210.c
1558 ++++ b/drivers/soc/tegra/fuse/speedo-tegra210.c
1559 +@@ -105,7 +105,7 @@ static int get_process_id(int value, const u32 *speedos, unsigned int num)
1560 + unsigned int i;
1561 +
1562 + for (i = 0; i < num; i++)
1563 +- if (value < speedos[num])
1564 ++ if (value < speedos[i])
1565 + return i;
1566 +
1567 + return -EINVAL;
1568 +diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c
1569 +index bc1b80ec6afe3..838b87adf48bb 100644
1570 +--- a/drivers/soc/ti/knav_dma.c
1571 ++++ b/drivers/soc/ti/knav_dma.c
1572 +@@ -752,8 +752,9 @@ static int knav_dma_probe(struct platform_device *pdev)
1573 + pm_runtime_enable(kdev->dev);
1574 + ret = pm_runtime_get_sync(kdev->dev);
1575 + if (ret < 0) {
1576 ++ pm_runtime_put_noidle(kdev->dev);
1577 + dev_err(kdev->dev, "unable to enable pktdma, err %d\n", ret);
1578 +- return ret;
1579 ++ goto err_pm_disable;
1580 + }
1581 +
1582 + /* Initialise all packet dmas */
1583 +@@ -767,13 +768,21 @@ static int knav_dma_probe(struct platform_device *pdev)
1584 +
1585 + if (list_empty(&kdev->list)) {
1586 + dev_err(dev, "no valid dma instance\n");
1587 +- return -ENODEV;
1588 ++ ret = -ENODEV;
1589 ++ goto err_put_sync;
1590 + }
1591 +
1592 + debugfs_create_file("knav_dma", S_IFREG | S_IRUGO, NULL, NULL,
1593 + &knav_dma_debug_ops);
1594 +
1595 + return ret;
1596 ++
1597 ++err_put_sync:
1598 ++ pm_runtime_put_sync(kdev->dev);
1599 ++err_pm_disable:
1600 ++ pm_runtime_disable(kdev->dev);
1601 ++
1602 ++ return ret;
1603 + }
1604 +
1605 + static int knav_dma_remove(struct platform_device *pdev)
1606 +diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
1607 +index 8c03a80b482dd..1aff6659655e3 100644
1608 +--- a/drivers/soc/ti/knav_qmss_queue.c
1609 ++++ b/drivers/soc/ti/knav_qmss_queue.c
1610 +@@ -1717,6 +1717,7 @@ static int knav_queue_probe(struct platform_device *pdev)
1611 + pm_runtime_enable(&pdev->dev);
1612 + ret = pm_runtime_get_sync(&pdev->dev);
1613 + if (ret < 0) {
1614 ++ pm_runtime_put_noidle(&pdev->dev);
1615 + dev_err(dev, "Failed to enable QMSS\n");
1616 + return ret;
1617 + }
1618 +@@ -1784,9 +1785,10 @@ static int knav_queue_probe(struct platform_device *pdev)
1619 + if (ret)
1620 + goto err;
1621 +
1622 +- regions = of_get_child_by_name(node, "descriptor-regions");
1623 ++ regions = of_get_child_by_name(node, "descriptor-regions");
1624 + if (!regions) {
1625 + dev_err(dev, "descriptor-regions not specified\n");
1626 ++ ret = -ENODEV;
1627 + goto err;
1628 + }
1629 + ret = knav_queue_setup_regions(kdev, regions);
1630 +diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
1631 +index 8b9c2a38d1ccd..a81a3cbf1439a 100644
1632 +--- a/drivers/spi/Kconfig
1633 ++++ b/drivers/spi/Kconfig
1634 +@@ -706,4 +706,7 @@ endif # SPI_MASTER
1635 +
1636 + # (slave support would go here)
1637 +
1638 ++config SPI_DYNAMIC
1639 ++ def_bool ACPI || OF_DYNAMIC || SPI_SLAVE
1640 ++
1641 + endif # SPI
1642 +diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c
1643 +index 5ffc2765a8ddf..0b5aff090b2e3 100644
1644 +--- a/drivers/spi/spi-bcm2835aux.c
1645 ++++ b/drivers/spi/spi-bcm2835aux.c
1646 +@@ -381,7 +381,7 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
1647 + unsigned long clk_hz;
1648 + int err;
1649 +
1650 +- master = spi_alloc_master(&pdev->dev, sizeof(*bs));
1651 ++ master = devm_spi_alloc_master(&pdev->dev, sizeof(*bs));
1652 + if (!master) {
1653 + dev_err(&pdev->dev, "spi_alloc_master() failed\n");
1654 + return -ENOMEM;
1655 +@@ -411,30 +411,27 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
1656 + /* the main area */
1657 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1658 + bs->regs = devm_ioremap_resource(&pdev->dev, res);
1659 +- if (IS_ERR(bs->regs)) {
1660 +- err = PTR_ERR(bs->regs);
1661 +- goto out_master_put;
1662 +- }
1663 ++ if (IS_ERR(bs->regs))
1664 ++ return PTR_ERR(bs->regs);
1665 +
1666 + bs->clk = devm_clk_get(&pdev->dev, NULL);
1667 + if ((!bs->clk) || (IS_ERR(bs->clk))) {
1668 + err = PTR_ERR(bs->clk);
1669 + dev_err(&pdev->dev, "could not get clk: %d\n", err);
1670 +- goto out_master_put;
1671 ++ return err;
1672 + }
1673 +
1674 + bs->irq = platform_get_irq(pdev, 0);
1675 + if (bs->irq <= 0) {
1676 + dev_err(&pdev->dev, "could not get IRQ: %d\n", bs->irq);
1677 +- err = bs->irq ? bs->irq : -ENODEV;
1678 +- goto out_master_put;
1679 ++ return bs->irq ? bs->irq : -ENODEV;
1680 + }
1681 +
1682 + /* this also enables the HW block */
1683 + err = clk_prepare_enable(bs->clk);
1684 + if (err) {
1685 + dev_err(&pdev->dev, "could not prepare clock: %d\n", err);
1686 +- goto out_master_put;
1687 ++ return err;
1688 + }
1689 +
1690 + /* just checking if the clock returns a sane value */
1691 +@@ -467,8 +464,6 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
1692 +
1693 + out_clk_disable:
1694 + clk_disable_unprepare(bs->clk);
1695 +-out_master_put:
1696 +- spi_master_put(master);
1697 + return err;
1698 + }
1699 +
1700 +diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
1701 +index c46c0738c7340..e58319e58ba4b 100644
1702 +--- a/drivers/spi/spi-img-spfi.c
1703 ++++ b/drivers/spi/spi-img-spfi.c
1704 +@@ -773,8 +773,10 @@ static int img_spfi_resume(struct device *dev)
1705 + int ret;
1706 +
1707 + ret = pm_runtime_get_sync(dev);
1708 +- if (ret)
1709 ++ if (ret) {
1710 ++ pm_runtime_put_noidle(dev);
1711 + return ret;
1712 ++ }
1713 + spfi_reset(spfi);
1714 + pm_runtime_put(dev);
1715 +
1716 +diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
1717 +index 3641d0e20135b..1d7fd6dbaf876 100644
1718 +--- a/drivers/spi/spi-rb4xx.c
1719 ++++ b/drivers/spi/spi-rb4xx.c
1720 +@@ -148,7 +148,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
1721 + if (IS_ERR(spi_base))
1722 + return PTR_ERR(spi_base);
1723 +
1724 +- master = spi_alloc_master(&pdev->dev, sizeof(*rbspi));
1725 ++ master = devm_spi_alloc_master(&pdev->dev, sizeof(*rbspi));
1726 + if (!master)
1727 + return -ENOMEM;
1728 +
1729 +diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
1730 +index e37712bed0b2d..d1ca8f619b828 100644
1731 +--- a/drivers/spi/spi-tegra114.c
1732 ++++ b/drivers/spi/spi-tegra114.c
1733 +@@ -801,6 +801,7 @@ static int tegra_spi_setup(struct spi_device *spi)
1734 +
1735 + ret = pm_runtime_get_sync(tspi->dev);
1736 + if (ret < 0) {
1737 ++ pm_runtime_put_noidle(tspi->dev);
1738 + dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
1739 + return ret;
1740 + }
1741 +@@ -1214,6 +1215,7 @@ static int tegra_spi_resume(struct device *dev)
1742 +
1743 + ret = pm_runtime_get_sync(dev);
1744 + if (ret < 0) {
1745 ++ pm_runtime_put_noidle(dev);
1746 + dev_err(dev, "pm runtime failed, e = %d\n", ret);
1747 + return ret;
1748 + }
1749 +diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
1750 +index b6558bb6f9dfc..4b9541e1726a5 100644
1751 +--- a/drivers/spi/spi-tegra20-sflash.c
1752 ++++ b/drivers/spi/spi-tegra20-sflash.c
1753 +@@ -564,6 +564,7 @@ static int tegra_sflash_resume(struct device *dev)
1754 +
1755 + ret = pm_runtime_get_sync(dev);
1756 + if (ret < 0) {
1757 ++ pm_runtime_put_noidle(dev);
1758 + dev_err(dev, "pm runtime failed, e = %d\n", ret);
1759 + return ret;
1760 + }
1761 +diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
1762 +index cf2a329fd8958..9f14560686b68 100644
1763 +--- a/drivers/spi/spi-tegra20-slink.c
1764 ++++ b/drivers/spi/spi-tegra20-slink.c
1765 +@@ -761,6 +761,7 @@ static int tegra_slink_setup(struct spi_device *spi)
1766 +
1767 + ret = pm_runtime_get_sync(tspi->dev);
1768 + if (ret < 0) {
1769 ++ pm_runtime_put_noidle(tspi->dev);
1770 + dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
1771 + return ret;
1772 + }
1773 +@@ -1197,6 +1198,7 @@ static int tegra_slink_resume(struct device *dev)
1774 +
1775 + ret = pm_runtime_get_sync(dev);
1776 + if (ret < 0) {
1777 ++ pm_runtime_put_noidle(dev);
1778 + dev_err(dev, "pm runtime failed, e = %d\n", ret);
1779 + return ret;
1780 + }
1781 +diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
1782 +index 5044c61983324..6e97f71a8cea3 100644
1783 +--- a/drivers/spi/spi-ti-qspi.c
1784 ++++ b/drivers/spi/spi-ti-qspi.c
1785 +@@ -159,6 +159,7 @@ static int ti_qspi_setup(struct spi_device *spi)
1786 +
1787 + ret = pm_runtime_get_sync(qspi->dev);
1788 + if (ret < 0) {
1789 ++ pm_runtime_put_noidle(qspi->dev);
1790 + dev_err(qspi->dev, "pm_runtime_get_sync() failed\n");
1791 + return ret;
1792 + }
1793 +diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
1794 +index ed87f71a428d1..e85feee750e3d 100644
1795 +--- a/drivers/spi/spi.c
1796 ++++ b/drivers/spi/spi.c
1797 +@@ -418,6 +418,12 @@ static LIST_HEAD(spi_master_list);
1798 + */
1799 + static DEFINE_MUTEX(board_lock);
1800 +
1801 ++/*
1802 ++ * Prevents addition of devices with same chip select and
1803 ++ * addition of devices below an unregistering controller.
1804 ++ */
1805 ++static DEFINE_MUTEX(spi_add_lock);
1806 ++
1807 + /**
1808 + * spi_alloc_device - Allocate a new SPI device
1809 + * @master: Controller to which device is connected
1810 +@@ -496,7 +502,6 @@ static int spi_dev_check(struct device *dev, void *data)
1811 + */
1812 + int spi_add_device(struct spi_device *spi)
1813 + {
1814 +- static DEFINE_MUTEX(spi_add_lock);
1815 + struct spi_master *master = spi->master;
1816 + struct device *dev = master->dev.parent;
1817 + int status;
1818 +@@ -525,6 +530,13 @@ int spi_add_device(struct spi_device *spi)
1819 + goto done;
1820 + }
1821 +
1822 ++ /* Controller may unregister concurrently */
1823 ++ if (IS_ENABLED(CONFIG_SPI_DYNAMIC) &&
1824 ++ !device_is_registered(&master->dev)) {
1825 ++ status = -ENODEV;
1826 ++ goto done;
1827 ++ }
1828 ++
1829 + if (master->cs_gpios)
1830 + spi->cs_gpio = master->cs_gpios[spi->chip_select];
1831 +
1832 +@@ -1962,6 +1974,10 @@ static int __unregister(struct device *dev, void *null)
1833 + */
1834 + void spi_unregister_master(struct spi_master *master)
1835 + {
1836 ++ /* Prevent addition of new devices, unregister existing ones */
1837 ++ if (IS_ENABLED(CONFIG_SPI_DYNAMIC))
1838 ++ mutex_lock(&spi_add_lock);
1839 ++
1840 + device_for_each_child(&master->dev, NULL, __unregister);
1841 +
1842 + if (master->queued) {
1843 +@@ -1981,6 +1997,9 @@ void spi_unregister_master(struct spi_master *master)
1844 + if (!devres_find(master->dev.parent, devm_spi_release_master,
1845 + devm_spi_match_master, master))
1846 + put_device(&master->dev);
1847 ++
1848 ++ if (IS_ENABLED(CONFIG_SPI_DYNAMIC))
1849 ++ mutex_unlock(&spi_add_lock);
1850 + }
1851 + EXPORT_SYMBOL_GPL(spi_unregister_master);
1852 +
1853 +diff --git a/drivers/staging/comedi/drivers/mf6x4.c b/drivers/staging/comedi/drivers/mf6x4.c
1854 +index fbdf181d8cccc..40aa24a9b2c30 100644
1855 +--- a/drivers/staging/comedi/drivers/mf6x4.c
1856 ++++ b/drivers/staging/comedi/drivers/mf6x4.c
1857 +@@ -121,8 +121,9 @@ static int mf6x4_ai_eoc(struct comedi_device *dev,
1858 + struct mf6x4_private *devpriv = dev->private;
1859 + unsigned int status;
1860 +
1861 ++ /* EOLC goes low at end of conversion. */
1862 + status = ioread32(devpriv->gpioc_reg);
1863 +- if (status & MF6X4_GPIOC_EOLC)
1864 ++ if ((status & MF6X4_GPIOC_EOLC) == 0)
1865 + return 0;
1866 + return -EBUSY;
1867 + }
1868 +diff --git a/drivers/staging/speakup/speakup_dectlk.c b/drivers/staging/speakup/speakup_dectlk.c
1869 +index 09063b82326f1..71aa623facd69 100644
1870 +--- a/drivers/staging/speakup/speakup_dectlk.c
1871 ++++ b/drivers/staging/speakup/speakup_dectlk.c
1872 +@@ -51,7 +51,7 @@ static unsigned char get_index(void);
1873 + static int in_escape;
1874 + static int is_flushing;
1875 +
1876 +-static spinlock_t flush_lock;
1877 ++static DEFINE_SPINLOCK(flush_lock);
1878 + static DECLARE_WAIT_QUEUE_HEAD(flush);
1879 +
1880 + static struct var_t vars[] = {
1881 +diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
1882 +index 0377b35d62b80..4bcb8dfa48743 100644
1883 +--- a/drivers/tty/serial/8250/8250_omap.c
1884 ++++ b/drivers/tty/serial/8250/8250_omap.c
1885 +@@ -155,11 +155,6 @@ static void omap_8250_mdr1_errataset(struct uart_8250_port *up,
1886 + struct omap8250_priv *priv)
1887 + {
1888 + u8 timeout = 255;
1889 +- u8 old_mdr1;
1890 +-
1891 +- old_mdr1 = serial_in(up, UART_OMAP_MDR1);
1892 +- if (old_mdr1 == priv->mdr1)
1893 +- return;
1894 +
1895 + serial_out(up, UART_OMAP_MDR1, priv->mdr1);
1896 + udelay(2);
1897 +diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
1898 +index 2949289bb3c50..97eb52b976057 100644
1899 +--- a/drivers/usb/chipidea/ci_hdrc_imx.c
1900 ++++ b/drivers/usb/chipidea/ci_hdrc_imx.c
1901 +@@ -58,7 +58,8 @@ static const struct ci_hdrc_imx_platform_flag imx6sx_usb_data = {
1902 +
1903 + static const struct ci_hdrc_imx_platform_flag imx6ul_usb_data = {
1904 + .flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
1905 +- CI_HDRC_TURN_VBUS_EARLY_ON,
1906 ++ CI_HDRC_TURN_VBUS_EARLY_ON |
1907 ++ CI_HDRC_DISABLE_DEVICE_STREAMING,
1908 + };
1909 +
1910 + static const struct ci_hdrc_imx_platform_flag imx7d_usb_data = {
1911 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1912 +index 34d8cece6dd3b..5d109717ac4e3 100644
1913 +--- a/drivers/usb/core/quirks.c
1914 ++++ b/drivers/usb/core/quirks.c
1915 +@@ -189,6 +189,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1916 + { USB_DEVICE(0x06a3, 0x0006), .driver_info =
1917 + USB_QUIRK_CONFIG_INTF_STRINGS },
1918 +
1919 ++ /* Agfa SNAPSCAN 1212U */
1920 ++ { USB_DEVICE(0x06bd, 0x0001), .driver_info = USB_QUIRK_RESET_RESUME },
1921 ++
1922 + /* Guillemot Webcam Hercules Dualpix Exchange (2nd ID) */
1923 + { USB_DEVICE(0x06f8, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME },
1924 +
1925 +diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
1926 +index e281af92e0844..8482a8a37dde8 100644
1927 +--- a/drivers/usb/gadget/function/f_rndis.c
1928 ++++ b/drivers/usb/gadget/function/f_rndis.c
1929 +@@ -91,8 +91,10 @@ static inline struct f_rndis *func_to_rndis(struct usb_function *f)
1930 + /* peak (theoretical) bulk transfer rate in bits-per-second */
1931 + static unsigned int bitrate(struct usb_gadget *g)
1932 + {
1933 ++ if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER_PLUS)
1934 ++ return 4250000000U;
1935 + if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER)
1936 +- return 13 * 1024 * 8 * 1000 * 8;
1937 ++ return 3750000000U;
1938 + else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
1939 + return 13 * 512 * 8 * 1000 * 8;
1940 + else
1941 +diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
1942 +index 0321b9ce9faf3..cbd4ef2c74b87 100644
1943 +--- a/drivers/usb/gadget/udc/dummy_hcd.c
1944 ++++ b/drivers/usb/gadget/udc/dummy_hcd.c
1945 +@@ -2741,7 +2741,7 @@ static int __init init(void)
1946 + {
1947 + int retval = -ENOMEM;
1948 + int i;
1949 +- struct dummy *dum[MAX_NUM_UDC];
1950 ++ struct dummy *dum[MAX_NUM_UDC] = {};
1951 +
1952 + if (usb_disabled())
1953 + return -ENODEV;
1954 +diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
1955 +index cccde8217f288..8e0625cc1801b 100644
1956 +--- a/drivers/usb/host/ehci-omap.c
1957 ++++ b/drivers/usb/host/ehci-omap.c
1958 +@@ -237,6 +237,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
1959 +
1960 + err_pm_runtime:
1961 + pm_runtime_put_sync(dev);
1962 ++ pm_runtime_disable(dev);
1963 +
1964 + err_phy:
1965 + for (i = 0; i < omap->nports; i++) {
1966 +diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
1967 +index 1f139d82cee08..d1e0d9d4e7a60 100644
1968 +--- a/drivers/usb/host/oxu210hp-hcd.c
1969 ++++ b/drivers/usb/host/oxu210hp-hcd.c
1970 +@@ -3741,8 +3741,10 @@ static struct usb_hcd *oxu_create(struct platform_device *pdev,
1971 + oxu->is_otg = otg;
1972 +
1973 + ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
1974 +- if (ret < 0)
1975 ++ if (ret < 0) {
1976 ++ usb_put_hcd(hcd);
1977 + return ERR_PTR(ret);
1978 ++ }
1979 +
1980 + device_wakeup_enable(hcd->self.controller);
1981 + return hcd;
1982 +diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
1983 +index 6891738278bcb..74d5975bf98f1 100644
1984 +--- a/drivers/usb/host/xhci-hub.c
1985 ++++ b/drivers/usb/host/xhci-hub.c
1986 +@@ -1400,6 +1400,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
1987 + hcd->state = HC_STATE_SUSPENDED;
1988 + bus_state->next_statechange = jiffies + msecs_to_jiffies(10);
1989 + spin_unlock_irqrestore(&xhci->lock, flags);
1990 ++
1991 ++ if (bus_state->bus_suspended)
1992 ++ usleep_range(5000, 10000);
1993 ++
1994 + return 0;
1995 + }
1996 +
1997 +diff --git a/drivers/usb/misc/sisusbvga/Kconfig b/drivers/usb/misc/sisusbvga/Kconfig
1998 +index 36bc28c884ad7..47dabccafef43 100644
1999 +--- a/drivers/usb/misc/sisusbvga/Kconfig
2000 ++++ b/drivers/usb/misc/sisusbvga/Kconfig
2001 +@@ -15,7 +15,7 @@ config USB_SISUSBVGA
2002 +
2003 + config USB_SISUSBVGA_CON
2004 + bool "Text console and mode switching support" if USB_SISUSBVGA
2005 +- depends on VT
2006 ++ depends on VT && BROKEN
2007 + select FONT_8x16
2008 + ---help---
2009 + Say Y here if you want a VGA text console via the USB dongle or
2010 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
2011 +index 205f31200264b..13c718ebaee5b 100644
2012 +--- a/drivers/usb/serial/cp210x.c
2013 ++++ b/drivers/usb/serial/cp210x.c
2014 +@@ -252,6 +252,8 @@ static struct usb_serial_driver cp210x_device = {
2015 + .close = cp210x_close,
2016 + .break_ctl = cp210x_break_ctl,
2017 + .set_termios = cp210x_set_termios,
2018 ++ .throttle = usb_serial_generic_throttle,
2019 ++ .unthrottle = usb_serial_generic_unthrottle,
2020 + .tiocmget = cp210x_tiocmget,
2021 + .tiocmset = cp210x_tiocmset,
2022 + .attach = cp210x_startup,
2023 +diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
2024 +index 8a4047de43dce..e25ea9069350e 100644
2025 +--- a/drivers/usb/serial/keyspan_pda.c
2026 ++++ b/drivers/usb/serial/keyspan_pda.c
2027 +@@ -44,11 +44,12 @@
2028 + #define DRIVER_AUTHOR "Brian Warner <warner@××××××.com>"
2029 + #define DRIVER_DESC "USB Keyspan PDA Converter driver"
2030 +
2031 ++#define KEYSPAN_TX_THRESHOLD 16
2032 ++
2033 + struct keyspan_pda_private {
2034 + int tx_room;
2035 + int tx_throttled;
2036 +- struct work_struct wakeup_work;
2037 +- struct work_struct unthrottle_work;
2038 ++ struct work_struct unthrottle_work;
2039 + struct usb_serial *serial;
2040 + struct usb_serial_port *port;
2041 + };
2042 +@@ -101,15 +102,6 @@ static const struct usb_device_id id_table_fake_xircom[] = {
2043 + };
2044 + #endif
2045 +
2046 +-static void keyspan_pda_wakeup_write(struct work_struct *work)
2047 +-{
2048 +- struct keyspan_pda_private *priv =
2049 +- container_of(work, struct keyspan_pda_private, wakeup_work);
2050 +- struct usb_serial_port *port = priv->port;
2051 +-
2052 +- tty_port_tty_wakeup(&port->port);
2053 +-}
2054 +-
2055 + static void keyspan_pda_request_unthrottle(struct work_struct *work)
2056 + {
2057 + struct keyspan_pda_private *priv =
2058 +@@ -124,7 +116,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work)
2059 + 7, /* request_unthrottle */
2060 + USB_TYPE_VENDOR | USB_RECIP_INTERFACE
2061 + | USB_DIR_OUT,
2062 +- 16, /* value: threshold */
2063 ++ KEYSPAN_TX_THRESHOLD,
2064 + 0, /* index */
2065 + NULL,
2066 + 0,
2067 +@@ -143,6 +135,8 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
2068 + int retval;
2069 + int status = urb->status;
2070 + struct keyspan_pda_private *priv;
2071 ++ unsigned long flags;
2072 ++
2073 + priv = usb_get_serial_port_data(port);
2074 +
2075 + switch (status) {
2076 +@@ -176,18 +170,21 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
2077 + break;
2078 + case 1:
2079 + /* status interrupt */
2080 +- if (len < 3) {
2081 ++ if (len < 2) {
2082 + dev_warn(&port->dev, "short interrupt message received\n");
2083 + break;
2084 + }
2085 +- dev_dbg(&port->dev, "rx int, d1=%d, d2=%d\n", data[1], data[2]);
2086 ++ dev_dbg(&port->dev, "rx int, d1=%d\n", data[1]);
2087 + switch (data[1]) {
2088 + case 1: /* modemline change */
2089 + break;
2090 + case 2: /* tx unthrottle interrupt */
2091 ++ spin_lock_irqsave(&port->lock, flags);
2092 + priv->tx_throttled = 0;
2093 ++ priv->tx_room = max(priv->tx_room, KEYSPAN_TX_THRESHOLD);
2094 ++ spin_unlock_irqrestore(&port->lock, flags);
2095 + /* queue up a wakeup at scheduler time */
2096 +- schedule_work(&priv->wakeup_work);
2097 ++ usb_serial_port_softint(port);
2098 + break;
2099 + default:
2100 + break;
2101 +@@ -447,6 +444,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
2102 + int request_unthrottle = 0;
2103 + int rc = 0;
2104 + struct keyspan_pda_private *priv;
2105 ++ unsigned long flags;
2106 +
2107 + priv = usb_get_serial_port_data(port);
2108 + /* guess how much room is left in the device's ring buffer, and if we
2109 +@@ -466,13 +464,13 @@ static int keyspan_pda_write(struct tty_struct *tty,
2110 + the TX urb is in-flight (wait until it completes)
2111 + the device is full (wait until it says there is room)
2112 + */
2113 +- spin_lock_bh(&port->lock);
2114 ++ spin_lock_irqsave(&port->lock, flags);
2115 + if (!test_bit(0, &port->write_urbs_free) || priv->tx_throttled) {
2116 +- spin_unlock_bh(&port->lock);
2117 ++ spin_unlock_irqrestore(&port->lock, flags);
2118 + return 0;
2119 + }
2120 + clear_bit(0, &port->write_urbs_free);
2121 +- spin_unlock_bh(&port->lock);
2122 ++ spin_unlock_irqrestore(&port->lock, flags);
2123 +
2124 + /* At this point the URB is in our control, nobody else can submit it
2125 + again (the only sudden transition was the one from EINPROGRESS to
2126 +@@ -518,7 +516,8 @@ static int keyspan_pda_write(struct tty_struct *tty,
2127 + goto exit;
2128 + }
2129 + }
2130 +- if (count > priv->tx_room) {
2131 ++
2132 ++ if (count >= priv->tx_room) {
2133 + /* we're about to completely fill the Tx buffer, so
2134 + we'll be throttled afterwards. */
2135 + count = priv->tx_room;
2136 +@@ -551,7 +550,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
2137 +
2138 + rc = count;
2139 + exit:
2140 +- if (rc < 0)
2141 ++ if (rc <= 0)
2142 + set_bit(0, &port->write_urbs_free);
2143 + return rc;
2144 + }
2145 +@@ -566,21 +565,24 @@ static void keyspan_pda_write_bulk_callback(struct urb *urb)
2146 + priv = usb_get_serial_port_data(port);
2147 +
2148 + /* queue up a wakeup at scheduler time */
2149 +- schedule_work(&priv->wakeup_work);
2150 ++ usb_serial_port_softint(port);
2151 + }
2152 +
2153 +
2154 + static int keyspan_pda_write_room(struct tty_struct *tty)
2155 + {
2156 + struct usb_serial_port *port = tty->driver_data;
2157 +- struct keyspan_pda_private *priv;
2158 +- priv = usb_get_serial_port_data(port);
2159 +- /* used by n_tty.c for processing of tabs and such. Giving it our
2160 +- conservative guess is probably good enough, but needs testing by
2161 +- running a console through the device. */
2162 +- return priv->tx_room;
2163 +-}
2164 ++ struct keyspan_pda_private *priv = usb_get_serial_port_data(port);
2165 ++ unsigned long flags;
2166 ++ int room = 0;
2167 +
2168 ++ spin_lock_irqsave(&port->lock, flags);
2169 ++ if (test_bit(0, &port->write_urbs_free) && !priv->tx_throttled)
2170 ++ room = priv->tx_room;
2171 ++ spin_unlock_irqrestore(&port->lock, flags);
2172 ++
2173 ++ return room;
2174 ++}
2175 +
2176 + static int keyspan_pda_chars_in_buffer(struct tty_struct *tty)
2177 + {
2178 +@@ -660,8 +662,12 @@ error:
2179 + }
2180 + static void keyspan_pda_close(struct usb_serial_port *port)
2181 + {
2182 ++ struct keyspan_pda_private *priv = usb_get_serial_port_data(port);
2183 ++
2184 + usb_kill_urb(port->write_urb);
2185 + usb_kill_urb(port->interrupt_in_urb);
2186 ++
2187 ++ cancel_work_sync(&priv->unthrottle_work);
2188 + }
2189 +
2190 +
2191 +@@ -732,7 +738,6 @@ static int keyspan_pda_port_probe(struct usb_serial_port *port)
2192 + if (!priv)
2193 + return -ENOMEM;
2194 +
2195 +- INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write);
2196 + INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle);
2197 + priv->serial = port->serial;
2198 + priv->port = port;
2199 +diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
2200 +index 1927f41ccafc4..1d8a6c17c9eb0 100644
2201 +--- a/drivers/usb/serial/mos7720.c
2202 ++++ b/drivers/usb/serial/mos7720.c
2203 +@@ -640,6 +640,8 @@ static void parport_mos7715_restore_state(struct parport *pp,
2204 + spin_unlock(&release_lock);
2205 + return;
2206 + }
2207 ++ mos_parport->shadowDCR = s->u.pc.ctr;
2208 ++ mos_parport->shadowECR = s->u.pc.ecr;
2209 + write_parport_reg_nonblock(mos_parport, MOS7720_DCR,
2210 + mos_parport->shadowDCR);
2211 + write_parport_reg_nonblock(mos_parport, MOS7720_ECR,
2212 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
2213 +index e8643612e9a39..6045a8e24068c 100644
2214 +--- a/drivers/usb/serial/option.c
2215 ++++ b/drivers/usb/serial/option.c
2216 +@@ -563,6 +563,9 @@ static void option_instat_callback(struct urb *urb);
2217 +
2218 + /* Device flags */
2219 +
2220 ++/* Highest interface number which can be used with NCTRL() and RSVD() */
2221 ++#define FLAG_IFNUM_MAX 7
2222 ++
2223 + /* Interface does not support modem-control requests */
2224 + #define NCTRL(ifnum) ((BIT(ifnum) & 0xff) << 8)
2225 +
2226 +@@ -2086,6 +2089,14 @@ static struct usb_serial_driver * const serial_drivers[] = {
2227 +
2228 + module_usb_serial_driver(serial_drivers, option_ids);
2229 +
2230 ++static bool iface_is_reserved(unsigned long device_flags, u8 ifnum)
2231 ++{
2232 ++ if (ifnum > FLAG_IFNUM_MAX)
2233 ++ return false;
2234 ++
2235 ++ return device_flags & RSVD(ifnum);
2236 ++}
2237 ++
2238 + static int option_probe(struct usb_serial *serial,
2239 + const struct usb_device_id *id)
2240 + {
2241 +@@ -2103,7 +2114,7 @@ static int option_probe(struct usb_serial *serial,
2242 + * the same class/subclass/protocol as the serial interfaces. Look at
2243 + * the Windows driver .INF files for reserved interface numbers.
2244 + */
2245 +- if (device_flags & RSVD(iface_desc->bInterfaceNumber))
2246 ++ if (iface_is_reserved(device_flags, iface_desc->bInterfaceNumber))
2247 + return -ENODEV;
2248 + /*
2249 + * Don't bind network interface on Samsung GT-B3730, it is handled by
2250 +@@ -2120,6 +2131,14 @@ static int option_probe(struct usb_serial *serial,
2251 + return 0;
2252 + }
2253 +
2254 ++static bool iface_no_modem_control(unsigned long device_flags, u8 ifnum)
2255 ++{
2256 ++ if (ifnum > FLAG_IFNUM_MAX)
2257 ++ return false;
2258 ++
2259 ++ return device_flags & NCTRL(ifnum);
2260 ++}
2261 ++
2262 + static int option_attach(struct usb_serial *serial)
2263 + {
2264 + struct usb_interface_descriptor *iface_desc;
2265 +@@ -2135,7 +2154,7 @@ static int option_attach(struct usb_serial *serial)
2266 +
2267 + iface_desc = &serial->interface->cur_altsetting->desc;
2268 +
2269 +- if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber)))
2270 ++ if (!iface_no_modem_control(device_flags, iface_desc->bInterfaceNumber))
2271 + data->use_send_setup = 1;
2272 +
2273 + if (device_flags & ZLP)
2274 +diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
2275 +index 48196347f2f94..12497a2140c25 100644
2276 +--- a/drivers/xen/xen-pciback/xenbus.c
2277 ++++ b/drivers/xen/xen-pciback/xenbus.c
2278 +@@ -691,7 +691,7 @@ static int xen_pcibk_xenbus_probe(struct xenbus_device *dev,
2279 +
2280 + /* watch the backend node for backend configuration information */
2281 + err = xenbus_watch_path(dev, dev->nodename, &pdev->be_watch,
2282 +- xen_pcibk_be_watch);
2283 ++ NULL, xen_pcibk_be_watch);
2284 + if (err)
2285 + goto out;
2286 +
2287 +diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
2288 +index 266f446ba331c..8bbd887ca422b 100644
2289 +--- a/drivers/xen/xenbus/xenbus_client.c
2290 ++++ b/drivers/xen/xenbus/xenbus_client.c
2291 +@@ -114,18 +114,22 @@ EXPORT_SYMBOL_GPL(xenbus_strstate);
2292 + */
2293 + int xenbus_watch_path(struct xenbus_device *dev, const char *path,
2294 + struct xenbus_watch *watch,
2295 ++ bool (*will_handle)(struct xenbus_watch *,
2296 ++ const char **, unsigned int),
2297 + void (*callback)(struct xenbus_watch *,
2298 + const char **, unsigned int))
2299 + {
2300 + int err;
2301 +
2302 + watch->node = path;
2303 ++ watch->will_handle = will_handle;
2304 + watch->callback = callback;
2305 +
2306 + err = register_xenbus_watch(watch);
2307 +
2308 + if (err) {
2309 + watch->node = NULL;
2310 ++ watch->will_handle = NULL;
2311 + watch->callback = NULL;
2312 + xenbus_dev_fatal(dev, err, "adding watch on %s", path);
2313 + }
2314 +@@ -152,6 +156,8 @@ EXPORT_SYMBOL_GPL(xenbus_watch_path);
2315 + */
2316 + int xenbus_watch_pathfmt(struct xenbus_device *dev,
2317 + struct xenbus_watch *watch,
2318 ++ bool (*will_handle)(struct xenbus_watch *,
2319 ++ const char **, unsigned int),
2320 + void (*callback)(struct xenbus_watch *,
2321 + const char **, unsigned int),
2322 + const char *pathfmt, ...)
2323 +@@ -168,7 +174,7 @@ int xenbus_watch_pathfmt(struct xenbus_device *dev,
2324 + xenbus_dev_fatal(dev, -ENOMEM, "allocating path for watch");
2325 + return -ENOMEM;
2326 + }
2327 +- err = xenbus_watch_path(dev, path, watch, callback);
2328 ++ err = xenbus_watch_path(dev, path, watch, will_handle, callback);
2329 +
2330 + if (err)
2331 + kfree(path);
2332 +diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
2333 +index c2d447687e33f..ba7590d75985e 100644
2334 +--- a/drivers/xen/xenbus/xenbus_probe.c
2335 ++++ b/drivers/xen/xenbus/xenbus_probe.c
2336 +@@ -137,6 +137,7 @@ static int watch_otherend(struct xenbus_device *dev)
2337 + container_of(dev->dev.bus, struct xen_bus_type, bus);
2338 +
2339 + return xenbus_watch_pathfmt(dev, &dev->otherend_watch,
2340 ++ bus->otherend_will_handle,
2341 + bus->otherend_changed,
2342 + "%s/%s", dev->otherend, "state");
2343 + }
2344 +diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h
2345 +index c9ec7ca1f7ab6..2c394c6ba605c 100644
2346 +--- a/drivers/xen/xenbus/xenbus_probe.h
2347 ++++ b/drivers/xen/xenbus/xenbus_probe.h
2348 +@@ -42,6 +42,8 @@ struct xen_bus_type {
2349 + int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename);
2350 + int (*probe)(struct xen_bus_type *bus, const char *type,
2351 + const char *dir);
2352 ++ bool (*otherend_will_handle)(struct xenbus_watch *watch,
2353 ++ const char **vec, unsigned int len);
2354 + void (*otherend_changed)(struct xenbus_watch *watch, const char **vec,
2355 + unsigned int len);
2356 + struct bus_type bus;
2357 +diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c
2358 +index 04f7f85a5edf8..597c0b0384542 100644
2359 +--- a/drivers/xen/xenbus/xenbus_probe_backend.c
2360 ++++ b/drivers/xen/xenbus/xenbus_probe_backend.c
2361 +@@ -181,6 +181,12 @@ static int xenbus_probe_backend(struct xen_bus_type *bus, const char *type,
2362 + return err;
2363 + }
2364 +
2365 ++static bool frontend_will_handle(struct xenbus_watch *watch,
2366 ++ const char **vec, unsigned int len)
2367 ++{
2368 ++ return watch->nr_pending == 0;
2369 ++}
2370 ++
2371 + static void frontend_changed(struct xenbus_watch *watch,
2372 + const char **vec, unsigned int len)
2373 + {
2374 +@@ -192,6 +198,7 @@ static struct xen_bus_type xenbus_backend = {
2375 + .levels = 3, /* backend/type/<frontend>/<id> */
2376 + .get_bus_id = backend_bus_id,
2377 + .probe = xenbus_probe_backend,
2378 ++ .otherend_will_handle = frontend_will_handle,
2379 + .otherend_changed = frontend_changed,
2380 + .bus = {
2381 + .name = "xen-backend",
2382 +diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
2383 +index ce65591b4168f..d98d88fae58ab 100644
2384 +--- a/drivers/xen/xenbus/xenbus_xs.c
2385 ++++ b/drivers/xen/xenbus/xenbus_xs.c
2386 +@@ -701,6 +701,8 @@ int register_xenbus_watch(struct xenbus_watch *watch)
2387 +
2388 + sprintf(token, "%lX", (long)watch);
2389 +
2390 ++ watch->nr_pending = 0;
2391 ++
2392 + down_read(&xs_state.watch_mutex);
2393 +
2394 + spin_lock(&watches_lock);
2395 +@@ -750,12 +752,15 @@ void unregister_xenbus_watch(struct xenbus_watch *watch)
2396 +
2397 + /* Cancel pending watch events. */
2398 + spin_lock(&watch_events_lock);
2399 +- list_for_each_entry_safe(msg, tmp, &watch_events, list) {
2400 +- if (msg->u.watch.handle != watch)
2401 +- continue;
2402 +- list_del(&msg->list);
2403 +- kfree(msg->u.watch.vec);
2404 +- kfree(msg);
2405 ++ if (watch->nr_pending) {
2406 ++ list_for_each_entry_safe(msg, tmp, &watch_events, list) {
2407 ++ if (msg->u.watch.handle != watch)
2408 ++ continue;
2409 ++ list_del(&msg->list);
2410 ++ kfree(msg->u.watch.vec);
2411 ++ kfree(msg);
2412 ++ }
2413 ++ watch->nr_pending = 0;
2414 + }
2415 + spin_unlock(&watch_events_lock);
2416 +
2417 +@@ -802,7 +807,6 @@ void xs_suspend_cancel(void)
2418 +
2419 + static int xenwatch_thread(void *unused)
2420 + {
2421 +- struct list_head *ent;
2422 + struct xs_stored_msg *msg;
2423 +
2424 + for (;;) {
2425 +@@ -815,13 +819,15 @@ static int xenwatch_thread(void *unused)
2426 + mutex_lock(&xenwatch_mutex);
2427 +
2428 + spin_lock(&watch_events_lock);
2429 +- ent = watch_events.next;
2430 +- if (ent != &watch_events)
2431 +- list_del(ent);
2432 ++ msg = list_first_entry_or_null(&watch_events,
2433 ++ struct xs_stored_msg, list);
2434 ++ if (msg) {
2435 ++ list_del(&msg->list);
2436 ++ msg->u.watch.handle->nr_pending--;
2437 ++ }
2438 + spin_unlock(&watch_events_lock);
2439 +
2440 +- if (ent != &watch_events) {
2441 +- msg = list_entry(ent, struct xs_stored_msg, list);
2442 ++ if (msg) {
2443 + msg->u.watch.handle->callback(
2444 + msg->u.watch.handle,
2445 + (const char **)msg->u.watch.vec,
2446 +@@ -903,9 +909,15 @@ static int process_msg(void)
2447 + spin_lock(&watches_lock);
2448 + msg->u.watch.handle = find_watch(
2449 + msg->u.watch.vec[XS_WATCH_TOKEN]);
2450 +- if (msg->u.watch.handle != NULL) {
2451 ++ if (msg->u.watch.handle != NULL &&
2452 ++ (!msg->u.watch.handle->will_handle ||
2453 ++ msg->u.watch.handle->will_handle(
2454 ++ msg->u.watch.handle,
2455 ++ (const char **)msg->u.watch.vec,
2456 ++ msg->u.watch.vec_size))) {
2457 + spin_lock(&watch_events_lock);
2458 + list_add_tail(&msg->list, &watch_events);
2459 ++ msg->u.watch.handle->nr_pending++;
2460 + wake_up(&watch_events_waitq);
2461 + spin_unlock(&watch_events_lock);
2462 + } else {
2463 +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
2464 +index 9e1f9910bdf2d..6d846ff696fb3 100644
2465 +--- a/fs/btrfs/inode.c
2466 ++++ b/fs/btrfs/inode.c
2467 +@@ -6923,7 +6923,7 @@ again:
2468 + found_type == BTRFS_FILE_EXTENT_PREALLOC) {
2469 + /* Only regular file could have regular/prealloc extent */
2470 + if (!S_ISREG(inode->i_mode)) {
2471 +- ret = -EUCLEAN;
2472 ++ err = -EUCLEAN;
2473 + btrfs_crit(root->fs_info,
2474 + "regular/prealloc extent found for non-regular inode %llu",
2475 + btrfs_ino(inode));
2476 +diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
2477 +index 18e667fbd054d..bc4cc417e7abb 100644
2478 +--- a/fs/btrfs/qgroup.c
2479 ++++ b/fs/btrfs/qgroup.c
2480 +@@ -2288,8 +2288,10 @@ out:
2481 + }
2482 + btrfs_put_tree_mod_seq(fs_info, &tree_mod_seq_elem);
2483 +
2484 +- if (done && !ret)
2485 ++ if (done && !ret) {
2486 + ret = 1;
2487 ++ fs_info->qgroup_rescan_progress.objectid = (u64)-1;
2488 ++ }
2489 + return ret;
2490 + }
2491 +
2492 +diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
2493 +index cc9ccc42f4698..0b41a88ef9e9a 100644
2494 +--- a/fs/btrfs/scrub.c
2495 ++++ b/fs/btrfs/scrub.c
2496 +@@ -918,11 +918,6 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check)
2497 + have_csum = sblock_to_check->pagev[0]->have_csum;
2498 + dev = sblock_to_check->pagev[0]->dev;
2499 +
2500 +- if (sctx->is_dev_replace && !is_metadata && !have_csum) {
2501 +- sblocks_for_recheck = NULL;
2502 +- goto nodatasum_case;
2503 +- }
2504 +-
2505 + /*
2506 + * read all mirrors one after the other. This includes to
2507 + * re-read the extent or metadata block that failed (that was
2508 +@@ -1035,13 +1030,19 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check)
2509 + goto out;
2510 + }
2511 +
2512 +- if (!is_metadata && !have_csum) {
2513 ++ /*
2514 ++ * NOTE: Even for nodatasum case, it's still possible that it's a
2515 ++ * compressed data extent, thus scrub_fixup_nodatasum(), which write
2516 ++ * inode page cache onto disk, could cause serious data corruption.
2517 ++ *
2518 ++ * So here we could only read from disk, and hope our recovery could
2519 ++ * reach disk before the newer write.
2520 ++ */
2521 ++ if (0 && !is_metadata && !have_csum) {
2522 + struct scrub_fixup_nodatasum *fixup_nodatasum;
2523 +
2524 + WARN_ON(sctx->is_dev_replace);
2525 +
2526 +-nodatasum_case:
2527 +-
2528 + /*
2529 + * !is_metadata and !have_csum, this means that the data
2530 + * might not be COW'ed, that it might be modified
2531 +diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c
2532 +index 69255148f0c84..2825cbe3ea8df 100644
2533 +--- a/fs/btrfs/tests/btrfs-tests.c
2534 ++++ b/fs/btrfs/tests/btrfs-tests.c
2535 +@@ -48,7 +48,13 @@ static struct file_system_type test_type = {
2536 +
2537 + struct inode *btrfs_new_test_inode(void)
2538 + {
2539 +- return new_inode(test_mnt->mnt_sb);
2540 ++ struct inode *inode;
2541 ++
2542 ++ inode = new_inode(test_mnt->mnt_sb);
2543 ++ if (inode)
2544 ++ inode_init_owner(inode, NULL, S_IFREG);
2545 ++
2546 ++ return inode;
2547 + }
2548 +
2549 + int btrfs_init_test_fs(void)
2550 +diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
2551 +index 49e693232916f..9d74cd37b3958 100644
2552 +--- a/fs/ceph/caps.c
2553 ++++ b/fs/ceph/caps.c
2554 +@@ -920,12 +920,19 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
2555 + {
2556 + struct ceph_mds_session *session = cap->session;
2557 + struct ceph_inode_info *ci = cap->ci;
2558 +- struct ceph_mds_client *mdsc =
2559 +- ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
2560 ++ struct ceph_mds_client *mdsc;
2561 + int removed = 0;
2562 +
2563 ++ /* 'ci' being NULL means the remove have already occurred */
2564 ++ if (!ci) {
2565 ++ dout("%s: cap inode is NULL\n", __func__);
2566 ++ return;
2567 ++ }
2568 ++
2569 + dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);
2570 +
2571 ++ mdsc = ceph_inode_to_client(&ci->vfs_inode)->mdsc;
2572 ++
2573 + /* remove from inode's cap rbtree, and clear auth cap */
2574 + rb_erase(&cap->ci_node, &ci->i_caps);
2575 + if (ci->i_auth_cap == cap)
2576 +diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
2577 +index 04fab14e630c1..812e0ba25a08b 100644
2578 +--- a/fs/ext4/mballoc.c
2579 ++++ b/fs/ext4/mballoc.c
2580 +@@ -4646,6 +4646,7 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
2581 + ext4_group_first_block_no(sb, group) +
2582 + EXT4_C2B(sbi, cluster),
2583 + "Block already on to-be-freed list");
2584 ++ kmem_cache_free(ext4_free_data_cachep, new_entry);
2585 + return 0;
2586 + }
2587 + }
2588 +diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
2589 +index 5b52ea41b84fa..bee8964682f85 100644
2590 +--- a/fs/jffs2/readinode.c
2591 ++++ b/fs/jffs2/readinode.c
2592 +@@ -672,6 +672,22 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r
2593 + jffs2_free_full_dirent(fd);
2594 + return -EIO;
2595 + }
2596 ++
2597 ++#ifdef CONFIG_JFFS2_SUMMARY
2598 ++ /*
2599 ++ * we use CONFIG_JFFS2_SUMMARY because without it, we
2600 ++ * have checked it while mounting
2601 ++ */
2602 ++ crc = crc32(0, fd->name, rd->nsize);
2603 ++ if (unlikely(crc != je32_to_cpu(rd->name_crc))) {
2604 ++ JFFS2_NOTICE("name CRC failed on dirent node at"
2605 ++ "%#08x: read %#08x,calculated %#08x\n",
2606 ++ ref_offset(ref), je32_to_cpu(rd->node_crc), crc);
2607 ++ jffs2_mark_node_obsolete(c, ref);
2608 ++ jffs2_free_full_dirent(fd);
2609 ++ return 0;
2610 ++ }
2611 ++#endif
2612 + }
2613 +
2614 + fd->nhash = full_name_hash(fd->name, rd->nsize);
2615 +diff --git a/fs/jfs/jfs_dmap.h b/fs/jfs/jfs_dmap.h
2616 +index 562b9a7e4311f..f502a15c6c987 100644
2617 +--- a/fs/jfs/jfs_dmap.h
2618 ++++ b/fs/jfs/jfs_dmap.h
2619 +@@ -196,7 +196,7 @@ typedef union dmtree {
2620 + #define dmt_leafidx t1.leafidx
2621 + #define dmt_height t1.height
2622 + #define dmt_budmin t1.budmin
2623 +-#define dmt_stree t1.stree
2624 ++#define dmt_stree t2.stree
2625 +
2626 + /*
2627 + * on-disk aggregate disk allocation map descriptor.
2628 +diff --git a/fs/lockd/host.c b/fs/lockd/host.c
2629 +index c7eb47f2fb6c3..603fa652b965d 100644
2630 +--- a/fs/lockd/host.c
2631 ++++ b/fs/lockd/host.c
2632 +@@ -430,12 +430,7 @@ nlm_bind_host(struct nlm_host *host)
2633 + * RPC rebind is required
2634 + */
2635 + if ((clnt = host->h_rpcclnt) != NULL) {
2636 +- if (time_after_eq(jiffies, host->h_nextrebind)) {
2637 +- rpc_force_rebind(clnt);
2638 +- host->h_nextrebind = jiffies + NLM_HOST_REBIND;
2639 +- dprintk("lockd: next rebind in %lu jiffies\n",
2640 +- host->h_nextrebind - jiffies);
2641 +- }
2642 ++ nlm_rebind_host(host);
2643 + } else {
2644 + unsigned long increment = nlmsvc_timeout;
2645 + struct rpc_timeout timeparms = {
2646 +@@ -483,13 +478,20 @@ nlm_bind_host(struct nlm_host *host)
2647 + return clnt;
2648 + }
2649 +
2650 +-/*
2651 +- * Force a portmap lookup of the remote lockd port
2652 ++/**
2653 ++ * nlm_rebind_host - If needed, force a portmap lookup of the peer's lockd port
2654 ++ * @host: NLM host handle for peer
2655 ++ *
2656 ++ * This is not needed when using a connection-oriented protocol, such as TCP.
2657 ++ * The existing autobind mechanism is sufficient to force a rebind when
2658 ++ * required, e.g. on connection state transitions.
2659 + */
2660 + void
2661 + nlm_rebind_host(struct nlm_host *host)
2662 + {
2663 +- dprintk("lockd: rebind host %s\n", host->h_name);
2664 ++ if (host->h_proto != IPPROTO_UDP)
2665 ++ return;
2666 ++
2667 + if (host->h_rpcclnt && time_after_eq(jiffies, host->h_nextrebind)) {
2668 + rpc_force_rebind(host->h_rpcclnt);
2669 + host->h_nextrebind = jiffies + NLM_HOST_REBIND;
2670 +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
2671 +index d25b55ceb9d58..b152366411917 100644
2672 +--- a/fs/nfs/inode.c
2673 ++++ b/fs/nfs/inode.c
2674 +@@ -1964,7 +1964,7 @@ static int nfsiod_start(void)
2675 + {
2676 + struct workqueue_struct *wq;
2677 + dprintk("RPC: creating workqueue nfsiod\n");
2678 +- wq = alloc_workqueue("nfsiod", WQ_MEM_RECLAIM, 0);
2679 ++ wq = alloc_workqueue("nfsiod", WQ_MEM_RECLAIM | WQ_UNBOUND, 0);
2680 + if (wq == NULL)
2681 + return -ENOMEM;
2682 + nfsiod_workqueue = wq;
2683 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
2684 +index 64d15c2662db6..3c15291ba1aaa 100644
2685 +--- a/fs/nfs/nfs4proc.c
2686 ++++ b/fs/nfs/nfs4proc.c
2687 +@@ -4047,12 +4047,12 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
2688 + u64 cookie, struct page **pages, unsigned int count, int plus)
2689 + {
2690 + struct inode *dir = d_inode(dentry);
2691 ++ struct nfs_server *server = NFS_SERVER(dir);
2692 + struct nfs4_readdir_arg args = {
2693 + .fh = NFS_FH(dir),
2694 + .pages = pages,
2695 + .pgbase = 0,
2696 + .count = count,
2697 +- .bitmask = NFS_SERVER(d_inode(dentry))->attr_bitmask,
2698 + .plus = plus,
2699 + };
2700 + struct nfs4_readdir_res res;
2701 +@@ -4067,9 +4067,15 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
2702 + dprintk("%s: dentry = %pd2, cookie = %Lu\n", __func__,
2703 + dentry,
2704 + (unsigned long long)cookie);
2705 ++ if (!(server->caps & NFS_CAP_SECURITY_LABEL))
2706 ++ args.bitmask = server->attr_bitmask_nl;
2707 ++ else
2708 ++ args.bitmask = server->attr_bitmask;
2709 ++
2710 + nfs4_setup_readdir(cookie, NFS_I(dir)->cookieverf, dentry, &args);
2711 + res.pgbase = args.pgbase;
2712 +- status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0);
2713 ++ status = nfs4_call_sync(server->client, server, &msg, &args.seq_args,
2714 ++ &res.seq_res, 0);
2715 + if (status >= 0) {
2716 + memcpy(NFS_I(dir)->cookieverf, res.verifier.data, NFS4_VERIFIER_SIZE);
2717 + status += args.pgbase;
2718 +diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
2719 +index 77d136ac89099..c21fca0dcba74 100644
2720 +--- a/fs/nfs_common/grace.c
2721 ++++ b/fs/nfs_common/grace.c
2722 +@@ -75,10 +75,14 @@ __state_in_grace(struct net *net, bool open)
2723 + if (!open)
2724 + return !list_empty(grace_list);
2725 +
2726 ++ spin_lock(&grace_lock);
2727 + list_for_each_entry(lm, grace_list, list) {
2728 +- if (lm->block_opens)
2729 ++ if (lm->block_opens) {
2730 ++ spin_unlock(&grace_lock);
2731 + return true;
2732 ++ }
2733 + }
2734 ++ spin_unlock(&grace_lock);
2735 + return false;
2736 + }
2737 +
2738 +diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h
2739 +index fb7eb9ccb1cd4..d4c3c9bab5826 100644
2740 +--- a/include/linux/seq_buf.h
2741 ++++ b/include/linux/seq_buf.h
2742 +@@ -29,7 +29,7 @@ static inline void seq_buf_clear(struct seq_buf *s)
2743 + }
2744 +
2745 + static inline void
2746 +-seq_buf_init(struct seq_buf *s, unsigned char *buf, unsigned int size)
2747 ++seq_buf_init(struct seq_buf *s, char *buf, unsigned int size)
2748 + {
2749 + s->buffer = buf;
2750 + s->size = size;
2751 +diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
2752 +index cfaf5a1d4bad7..f5be2716b01c6 100644
2753 +--- a/include/linux/trace_seq.h
2754 ++++ b/include/linux/trace_seq.h
2755 +@@ -11,7 +11,7 @@
2756 + */
2757 +
2758 + struct trace_seq {
2759 +- unsigned char buffer[PAGE_SIZE];
2760 ++ char buffer[PAGE_SIZE];
2761 + struct seq_buf seq;
2762 + int full;
2763 + };
2764 +@@ -50,7 +50,7 @@ static inline int trace_seq_used(struct trace_seq *s)
2765 + * that is about to be written to and then return the result
2766 + * of that write.
2767 + */
2768 +-static inline unsigned char *
2769 ++static inline char *
2770 + trace_seq_buffer_ptr(struct trace_seq *s)
2771 + {
2772 + return s->buffer + seq_buf_used(&s->seq);
2773 +diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
2774 +index 32b944b7cebd1..ed9e7e3307b75 100644
2775 +--- a/include/xen/xenbus.h
2776 ++++ b/include/xen/xenbus.h
2777 +@@ -58,6 +58,15 @@ struct xenbus_watch
2778 + /* Path being watched. */
2779 + const char *node;
2780 +
2781 ++ unsigned int nr_pending;
2782 ++
2783 ++ /*
2784 ++ * Called just before enqueing new event while a spinlock is held.
2785 ++ * The event will be discarded if this callback returns false.
2786 ++ */
2787 ++ bool (*will_handle)(struct xenbus_watch *,
2788 ++ const char **vec, unsigned int len);
2789 ++
2790 + /* Callback (executed in a process context with no locks held). */
2791 + void (*callback)(struct xenbus_watch *,
2792 + const char **vec, unsigned int len);
2793 +@@ -194,10 +203,14 @@ void xenbus_suspend_cancel(void);
2794 +
2795 + int xenbus_watch_path(struct xenbus_device *dev, const char *path,
2796 + struct xenbus_watch *watch,
2797 ++ bool (*will_handle)(struct xenbus_watch *,
2798 ++ const char **, unsigned int),
2799 + void (*callback)(struct xenbus_watch *,
2800 + const char **, unsigned int));
2801 +-__printf(4, 5)
2802 ++__printf(5, 6)
2803 + int xenbus_watch_pathfmt(struct xenbus_device *dev, struct xenbus_watch *watch,
2804 ++ bool (*will_handle)(struct xenbus_watch *,
2805 ++ const char **, unsigned int),
2806 + void (*callback)(struct xenbus_watch *,
2807 + const char **, unsigned int),
2808 + const char *pathfmt, ...);
2809 +diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
2810 +index 7cee89fddcd50..586c005bdc1ee 100644
2811 +--- a/net/bluetooth/hci_event.c
2812 ++++ b/net/bluetooth/hci_event.c
2813 +@@ -4336,6 +4336,11 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev,
2814 + return;
2815 + }
2816 +
2817 ++ if (!hcon->amp_mgr) {
2818 ++ hci_dev_unlock(hdev);
2819 ++ return;
2820 ++ }
2821 ++
2822 + if (ev->status) {
2823 + hci_conn_del(hcon);
2824 + hci_dev_unlock(hdev);
2825 +@@ -5114,20 +5119,18 @@ static void hci_le_direct_adv_report_evt(struct hci_dev *hdev,
2826 + struct sk_buff *skb)
2827 + {
2828 + u8 num_reports = skb->data[0];
2829 +- void *ptr = &skb->data[1];
2830 ++ struct hci_ev_le_direct_adv_info *ev = (void *)&skb->data[1];
2831 +
2832 +- hci_dev_lock(hdev);
2833 ++ if (!num_reports || skb->len < num_reports * sizeof(*ev) + 1)
2834 ++ return;
2835 +
2836 +- while (num_reports--) {
2837 +- struct hci_ev_le_direct_adv_info *ev = ptr;
2838 ++ hci_dev_lock(hdev);
2839 +
2840 ++ for (; num_reports; num_reports--, ev++)
2841 + process_adv_report(hdev, ev->evt_type, &ev->bdaddr,
2842 + ev->bdaddr_type, &ev->direct_addr,
2843 + ev->direct_addr_type, ev->rssi, NULL, 0);
2844 +
2845 +- ptr += sizeof(*ev);
2846 +- }
2847 +-
2848 + hci_dev_unlock(hdev);
2849 + }
2850 +
2851 +diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
2852 +index a7953962112aa..1b848a45047bc 100644
2853 +--- a/net/bridge/br_vlan.c
2854 ++++ b/net/bridge/br_vlan.c
2855 +@@ -225,8 +225,10 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags)
2856 + }
2857 +
2858 + masterv = br_vlan_get_master(br, v->vid);
2859 +- if (!masterv)
2860 ++ if (!masterv) {
2861 ++ err = -ENOMEM;
2862 + goto out_filt;
2863 ++ }
2864 + v->brvlan = masterv;
2865 + }
2866 +
2867 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
2868 +index b218138874cc4..db037082e6f25 100644
2869 +--- a/net/ipv4/tcp_output.c
2870 ++++ b/net/ipv4/tcp_output.c
2871 +@@ -1501,7 +1501,8 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited)
2872 + * window, and remember whether we were cwnd-limited then.
2873 + */
2874 + if (!before(tp->snd_una, tp->max_packets_seq) ||
2875 +- tp->packets_out > tp->max_packets_out) {
2876 ++ tp->packets_out > tp->max_packets_out ||
2877 ++ is_cwnd_limited) {
2878 + tp->max_packets_out = tp->packets_out;
2879 + tp->max_packets_seq = tp->snd_nxt;
2880 + tp->is_cwnd_limited = is_cwnd_limited;
2881 +@@ -2172,6 +2173,10 @@ repair:
2882 + break;
2883 + }
2884 +
2885 ++ is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd);
2886 ++ if (likely(sent_pkts || is_cwnd_limited))
2887 ++ tcp_cwnd_validate(sk, is_cwnd_limited);
2888 ++
2889 + if (likely(sent_pkts)) {
2890 + if (tcp_in_cwnd_reduction(sk))
2891 + tp->prr_out += sent_pkts;
2892 +@@ -2179,8 +2184,6 @@ repair:
2893 + /* Send one loss probe per tail loss episode. */
2894 + if (push_one != 2)
2895 + tcp_schedule_loss_probe(sk);
2896 +- is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd);
2897 +- tcp_cwnd_validate(sk, is_cwnd_limited);
2898 + return false;
2899 + }
2900 + return !tp->packets_out && tcp_send_head(sk);
2901 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
2902 +index 7748d674677c9..eb25998a0032e 100644
2903 +--- a/net/wireless/nl80211.c
2904 ++++ b/net/wireless/nl80211.c
2905 +@@ -9836,7 +9836,7 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)
2906 + struct net_device *dev = info->user_ptr[1];
2907 + struct wireless_dev *wdev = dev->ieee80211_ptr;
2908 + struct nlattr *tb[NUM_NL80211_REKEY_DATA];
2909 +- struct cfg80211_gtk_rekey_data rekey_data;
2910 ++ struct cfg80211_gtk_rekey_data rekey_data = {};
2911 + int err;
2912 +
2913 + if (!info->attrs[NL80211_ATTR_REKEY_DATA])
2914 +diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
2915 +index 8835a4775d205..67a6a8a9b6722 100755
2916 +--- a/scripts/checkpatch.pl
2917 ++++ b/scripts/checkpatch.pl
2918 +@@ -3580,7 +3580,7 @@ sub process {
2919 + $fix) {
2920 + fix_delete_line($fixlinenr, $rawline);
2921 + my $fixed_line = $rawline;
2922 +- $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/;
2923 ++ $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*)\{(.*)$/;
2924 + my $line1 = $1;
2925 + my $line2 = $2;
2926 + fix_insert_line($fixlinenr, ltrim($line1));
2927 +diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
2928 +index 443bb8ce82559..1d1faf1925173 100644
2929 +--- a/sound/core/oss/pcm_oss.c
2930 ++++ b/sound/core/oss/pcm_oss.c
2931 +@@ -718,6 +718,8 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
2932 +
2933 + oss_buffer_size = snd_pcm_plug_client_size(substream,
2934 + snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, NULL)) * oss_frame_size;
2935 ++ if (!oss_buffer_size)
2936 ++ return -EINVAL;
2937 + oss_buffer_size = rounddown_pow_of_two(oss_buffer_size);
2938 + if (atomic_read(&substream->mmap_count)) {
2939 + if (oss_buffer_size > runtime->oss.mmap_bytes)
2940 +@@ -753,17 +755,21 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
2941 +
2942 + min_period_size = snd_pcm_plug_client_size(substream,
2943 + snd_pcm_hw_param_value_min(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
2944 +- min_period_size *= oss_frame_size;
2945 +- min_period_size = roundup_pow_of_two(min_period_size);
2946 +- if (oss_period_size < min_period_size)
2947 +- oss_period_size = min_period_size;
2948 ++ if (min_period_size) {
2949 ++ min_period_size *= oss_frame_size;
2950 ++ min_period_size = roundup_pow_of_two(min_period_size);
2951 ++ if (oss_period_size < min_period_size)
2952 ++ oss_period_size = min_period_size;
2953 ++ }
2954 +
2955 + max_period_size = snd_pcm_plug_client_size(substream,
2956 + snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
2957 +- max_period_size *= oss_frame_size;
2958 +- max_period_size = rounddown_pow_of_two(max_period_size);
2959 +- if (oss_period_size > max_period_size)
2960 +- oss_period_size = max_period_size;
2961 ++ if (max_period_size) {
2962 ++ max_period_size *= oss_frame_size;
2963 ++ max_period_size = rounddown_pow_of_two(max_period_size);
2964 ++ if (oss_period_size > max_period_size)
2965 ++ oss_period_size = max_period_size;
2966 ++ }
2967 +
2968 + oss_periods = oss_buffer_size / oss_period_size;
2969 +
2970 +@@ -2000,11 +2006,15 @@ static int snd_pcm_oss_set_subdivide(struct snd_pcm_oss_file *pcm_oss_file, int
2971 + static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val)
2972 + {
2973 + struct snd_pcm_runtime *runtime;
2974 ++ int fragshift;
2975 +
2976 + runtime = substream->runtime;
2977 + if (runtime->oss.subdivision || runtime->oss.fragshift)
2978 + return -EINVAL;
2979 +- runtime->oss.fragshift = val & 0xffff;
2980 ++ fragshift = val & 0xffff;
2981 ++ if (fragshift >= 31)
2982 ++ return -EINVAL;
2983 ++ runtime->oss.fragshift = fragshift;
2984 + runtime->oss.maxfrags = (val >> 16) & 0xffff;
2985 + if (runtime->oss.fragshift < 4) /* < 16 */
2986 + runtime->oss.fragshift = 4;
2987 +diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
2988 +index f1f990b325ad7..5ff0d3b10bcfd 100644
2989 +--- a/sound/soc/codecs/wm_adsp.c
2990 ++++ b/sound/soc/codecs/wm_adsp.c
2991 +@@ -852,7 +852,7 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
2992 + ctl_work = kzalloc(sizeof(*ctl_work), GFP_KERNEL);
2993 + if (!ctl_work) {
2994 + ret = -ENOMEM;
2995 +- goto err_ctl_cache;
2996 ++ goto err_list_del;
2997 + }
2998 +
2999 + ctl_work->dsp = dsp;
3000 +@@ -862,7 +862,8 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
3001 +
3002 + return 0;
3003 +
3004 +-err_ctl_cache:
3005 ++err_list_del:
3006 ++ list_del(&ctl->list);
3007 + kfree(ctl->cache);
3008 + err_ctl_name:
3009 + kfree(ctl->name);
3010 +diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c
3011 +index 0dc1ab48fcebe..6440729facaf0 100644
3012 +--- a/sound/soc/jz4740/jz4740-i2s.c
3013 ++++ b/sound/soc/jz4740/jz4740-i2s.c
3014 +@@ -315,10 +315,14 @@ static int jz4740_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id,
3015 + switch (clk_id) {
3016 + case JZ4740_I2S_CLKSRC_EXT:
3017 + parent = clk_get(NULL, "ext");
3018 ++ if (IS_ERR(parent))
3019 ++ return PTR_ERR(parent);
3020 + clk_set_parent(i2s->clk_i2s, parent);
3021 + break;
3022 + case JZ4740_I2S_CLKSRC_PLL:
3023 + parent = clk_get(NULL, "pll half");
3024 ++ if (IS_ERR(parent))
3025 ++ return PTR_ERR(parent);
3026 + clk_set_parent(i2s->clk_i2s, parent);
3027 + ret = clk_set_rate(i2s->clk_i2s, freq);
3028 + break;
3029 +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
3030 +index d4bf3dc6b0158..b773d61cd5bc7 100644
3031 +--- a/sound/soc/soc-pcm.c
3032 ++++ b/sound/soc/soc-pcm.c
3033 +@@ -2075,6 +2075,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
3034 + case SNDRV_PCM_TRIGGER_START:
3035 + case SNDRV_PCM_TRIGGER_RESUME:
3036 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
3037 ++ case SNDRV_PCM_TRIGGER_DRAIN:
3038 + ret = dpcm_dai_trigger_fe_be(substream, cmd, true);
3039 + break;
3040 + case SNDRV_PCM_TRIGGER_STOP:
3041 +@@ -2092,6 +2093,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
3042 + case SNDRV_PCM_TRIGGER_START:
3043 + case SNDRV_PCM_TRIGGER_RESUME:
3044 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
3045 ++ case SNDRV_PCM_TRIGGER_DRAIN:
3046 + ret = dpcm_dai_trigger_fe_be(substream, cmd, false);
3047 + break;
3048 + case SNDRV_PCM_TRIGGER_STOP:
3049 +diff --git a/sound/usb/format.c b/sound/usb/format.c
3050 +index f28a41194d171..ca75807eeb170 100644
3051 +--- a/sound/usb/format.c
3052 ++++ b/sound/usb/format.c
3053 +@@ -52,6 +52,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
3054 + case UAC_VERSION_1:
3055 + default: {
3056 + struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
3057 ++ if (format >= 64)
3058 ++ return 0; /* invalid format */
3059 + sample_width = fmt->bBitResolution;
3060 + sample_bytes = fmt->bSubframeSize;
3061 + format = 1 << format;
3062 +diff --git a/sound/usb/stream.c b/sound/usb/stream.c
3063 +index 1ffc32fd3a9eb..bc8e4702e9ed6 100644
3064 +--- a/sound/usb/stream.c
3065 ++++ b/sound/usb/stream.c
3066 +@@ -187,16 +187,16 @@ static int usb_chmap_ctl_get(struct snd_kcontrol *kcontrol,
3067 + struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
3068 + struct snd_usb_substream *subs = info->private_data;
3069 + struct snd_pcm_chmap_elem *chmap = NULL;
3070 +- int i;
3071 ++ int i = 0;
3072 +
3073 +- memset(ucontrol->value.integer.value, 0,
3074 +- sizeof(ucontrol->value.integer.value));
3075 + if (subs->cur_audiofmt)
3076 + chmap = subs->cur_audiofmt->chmap;
3077 + if (chmap) {
3078 + for (i = 0; i < chmap->channels; i++)
3079 + ucontrol->value.integer.value[i] = chmap->map[i];
3080 + }
3081 ++ for (; i < subs->channels_max; i++)
3082 ++ ucontrol->value.integer.value[i] = 0;
3083 + return 0;
3084 + }
3085 +
3086 +diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c
3087 +index 4f2c1c255d818..a8865d1c3e818 100644
3088 +--- a/tools/perf/util/parse-regs-options.c
3089 ++++ b/tools/perf/util/parse-regs-options.c
3090 +@@ -40,7 +40,7 @@ parse_regs(const struct option *opt, const char *str, int unset)
3091 + }
3092 + fputc('\n', stderr);
3093 + /* just printing available regs */
3094 +- return -1;
3095 ++ goto error;
3096 + }
3097 + for (r = sample_reg_masks; r->name; r++) {
3098 + if (!strcasecmp(s, r->name))