Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Thu, 12 May 2022 11:32:36
Message-Id: 1652355136.cbf2942017b4265674a6ebc3074a979f02aca793.mpagano@gentoo
1 commit: cbf2942017b4265674a6ebc3074a979f02aca793
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 12 11:32:16 2022 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Thu May 12 11:32:16 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=cbf29420
7
8 Linux patch 4.9.313
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1312_linux-4.9.313.patch | 1998 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2002 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 9590ee57..b5574842 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -1291,6 +1291,10 @@ Patch: 1311_linux-4.9.312.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.9.312
23
24 +Patch: 1312_linux-4.9.313.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.9.313
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/1312_linux-4.9.313.patch b/1312_linux-4.9.313.patch
33 new file mode 100644
34 index 00000000..9f0b3803
35 --- /dev/null
36 +++ b/1312_linux-4.9.313.patch
37 @@ -0,0 +1,1998 @@
38 +diff --git a/Makefile b/Makefile
39 +index a9f16c9c9614f..0c13bf09d17dc 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 9
45 +-SUBLEVEL = 312
46 ++SUBLEVEL = 313
47 + EXTRAVERSION =
48 + NAME = Roaring Lionus
49 +
50 +diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
51 +index 99e323b57261c..cbe7b0dcb6eb2 100644
52 +--- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
53 ++++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
54 +@@ -324,6 +324,8 @@
55 + codec: sgtl5000@0a {
56 + compatible = "fsl,sgtl5000";
57 + reg = <0x0a>;
58 ++ pinctrl-names = "default";
59 ++ pinctrl-0 = <&pinctrl_sgtl5000>;
60 + clocks = <&clks IMX6QDL_CLK_CKO>;
61 + VDDA-supply = <&reg_2p5v>;
62 + VDDIO-supply = <&reg_3p3v>;
63 +@@ -550,8 +552,6 @@
64 + MX6QDL_PAD_DISP0_DAT21__AUD4_TXD 0x130b0
65 + MX6QDL_PAD_DISP0_DAT22__AUD4_TXFS 0x130b0
66 + MX6QDL_PAD_DISP0_DAT23__AUD4_RXD 0x130b0
67 +- /* SGTL5000 sys_mclk */
68 +- MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x130b0
69 + >;
70 + };
71 +
72 +@@ -812,6 +812,12 @@
73 + >;
74 + };
75 +
76 ++ pinctrl_sgtl5000: sgtl5000grp {
77 ++ fsl,pins = <
78 ++ MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x130b0
79 ++ >;
80 ++ };
81 ++
82 + pinctrl_spdif: spdifgrp {
83 + fsl,pins = <
84 + MX6QDL_PAD_GPIO_16__SPDIF_IN 0x1b0b0
85 +diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi
86 +index 338ee6bd0e0c0..ced298d073382 100644
87 +--- a/arch/arm/boot/dts/omap3-gta04.dtsi
88 ++++ b/arch/arm/boot/dts/omap3-gta04.dtsi
89 +@@ -29,6 +29,8 @@
90 + aliases {
91 + display0 = &lcd;
92 + display1 = &tv0;
93 ++ /delete-property/ mmc2;
94 ++ /delete-property/ mmc3;
95 + };
96 +
97 + gpio-keys {
98 +diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
99 +index e5dcbda20129d..7fff67ea7bcd3 100644
100 +--- a/arch/arm/mach-omap2/omap4-common.c
101 ++++ b/arch/arm/mach-omap2/omap4-common.c
102 +@@ -342,10 +342,12 @@ void __init omap_gic_of_init(void)
103 +
104 + np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-gic");
105 + gic_dist_base_addr = of_iomap(np, 0);
106 ++ of_node_put(np);
107 + WARN_ON(!gic_dist_base_addr);
108 +
109 + np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-twd-timer");
110 + twd_base = of_iomap(np, 0);
111 ++ of_node_put(np);
112 + WARN_ON(!twd_base);
113 +
114 + skip_errata_init:
115 +diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h
116 +index b05bb70a2e46f..8026baf46e729 100644
117 +--- a/arch/mips/include/asm/timex.h
118 ++++ b/arch/mips/include/asm/timex.h
119 +@@ -40,9 +40,9 @@
120 + typedef unsigned int cycles_t;
121 +
122 + /*
123 +- * On R4000/R4400 before version 5.0 an erratum exists such that if the
124 +- * cycle counter is read in the exact moment that it is matching the
125 +- * compare register, no interrupt will be generated.
126 ++ * On R4000/R4400 an erratum exists such that if the cycle counter is
127 ++ * read in the exact moment that it is matching the compare register,
128 ++ * no interrupt will be generated.
129 + *
130 + * There is a suggested workaround and also the erratum can't strike if
131 + * the compare interrupt isn't being used as the clock source device.
132 +@@ -63,7 +63,7 @@ static inline int can_use_mips_counter(unsigned int prid)
133 + if (!__builtin_constant_p(cpu_has_counter))
134 + asm volatile("" : "=m" (cpu_data[0].options));
135 + if (likely(cpu_has_counter &&
136 +- prid >= (PRID_IMP_R4000 | PRID_REV_ENCODE_44(5, 0))))
137 ++ prid > (PRID_IMP_R4000 | PRID_REV_ENCODE_44(15, 15))))
138 + return 1;
139 + else
140 + return 0;
141 +diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
142 +index b15ee12586688..1d69989337889 100644
143 +--- a/arch/mips/kernel/time.c
144 ++++ b/arch/mips/kernel/time.c
145 +@@ -168,15 +168,10 @@ static __init int cpu_has_mfc0_count_bug(void)
146 + case CPU_R4400MC:
147 + /*
148 + * The published errata for the R4400 up to 3.0 say the CPU
149 +- * has the mfc0 from count bug.
150 ++ * has the mfc0 from count bug. This seems the last version
151 ++ * produced.
152 + */
153 +- if ((current_cpu_data.processor_id & 0xff) <= 0x30)
154 +- return 1;
155 +-
156 +- /*
157 +- * we assume newer revisions are ok
158 +- */
159 +- return 0;
160 ++ return 1;
161 + }
162 +
163 + return 0;
164 +diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
165 +index 0c2a94a0f7518..e31633dcb0f35 100644
166 +--- a/arch/parisc/kernel/processor.c
167 ++++ b/arch/parisc/kernel/processor.c
168 +@@ -390,8 +390,7 @@ show_cpuinfo (struct seq_file *m, void *v)
169 + }
170 + seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities);
171 +
172 +- seq_printf(m, "model\t\t: %s\n"
173 +- "model name\t: %s\n",
174 ++ seq_printf(m, "model\t\t: %s - %s\n",
175 + boot_cpu_data.pdc.sys_model_name,
176 + cpuinfo->dev ?
177 + cpuinfo->dev->name : "Unknown");
178 +diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
179 +index da0d81fa0b546..0e50b668184ad 100644
180 +--- a/arch/x86/include/asm/microcode.h
181 ++++ b/arch/x86/include/asm/microcode.h
182 +@@ -135,10 +135,12 @@ extern void __init load_ucode_bsp(void);
183 + extern void load_ucode_ap(void);
184 + void reload_early_microcode(void);
185 + extern bool get_builtin_firmware(struct cpio_data *cd, const char *name);
186 ++void microcode_bsp_resume(void);
187 + #else
188 + static inline void __init load_ucode_bsp(void) { }
189 + static inline void load_ucode_ap(void) { }
190 + static inline void reload_early_microcode(void) { }
191 ++static inline void microcode_bsp_resume(void) { }
192 + static inline bool
193 + get_builtin_firmware(struct cpio_data *cd, const char *name) { return false; }
194 + #endif
195 +diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
196 +index b53a6579767d1..499bc79fc82a7 100644
197 +--- a/arch/x86/kernel/cpu/microcode/core.c
198 ++++ b/arch/x86/kernel/cpu/microcode/core.c
199 +@@ -586,9 +586,9 @@ static struct subsys_interface mc_cpu_interface = {
200 + };
201 +
202 + /**
203 +- * mc_bp_resume - Update boot CPU microcode during resume.
204 ++ * microcode_bsp_resume - Update boot CPU microcode during resume.
205 + */
206 +-static void mc_bp_resume(void)
207 ++void microcode_bsp_resume(void)
208 + {
209 + int cpu = smp_processor_id();
210 + struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
211 +@@ -600,7 +600,7 @@ static void mc_bp_resume(void)
212 + }
213 +
214 + static struct syscore_ops mc_syscore_ops = {
215 +- .resume = mc_bp_resume,
216 ++ .resume = microcode_bsp_resume,
217 + };
218 +
219 + static int mc_cpu_online(unsigned int cpu)
220 +diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
221 +index a6f8600672d75..c068027ac55f2 100644
222 +--- a/arch/x86/kvm/cpuid.c
223 ++++ b/arch/x86/kvm/cpuid.c
224 +@@ -502,6 +502,11 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
225 + union cpuid10_eax eax;
226 + union cpuid10_edx edx;
227 +
228 ++ if (!static_cpu_has(X86_FEATURE_ARCH_PERFMON)) {
229 ++ entry->eax = entry->ebx = entry->ecx = entry->edx = 0;
230 ++ break;
231 ++ }
232 ++
233 + perf_get_x86_pmu_capability(&cap);
234 +
235 + /*
236 +diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
237 +index 357b3e6a2f7b1..a1fbf18eed5a8 100644
238 +--- a/arch/x86/power/cpu.c
239 ++++ b/arch/x86/power/cpu.c
240 +@@ -26,6 +26,7 @@
241 + #include <asm/cpu.h>
242 + #include <asm/mmu_context.h>
243 + #include <asm/cpu_device_id.h>
244 ++#include <asm/microcode.h>
245 +
246 + #ifdef CONFIG_X86_32
247 + __visible unsigned long saved_context_ebx;
248 +@@ -261,6 +262,13 @@ static void notrace __restore_processor_state(struct saved_context *ctxt)
249 + x86_platform.restore_sched_clock_state();
250 + mtrr_bp_restore();
251 + perf_restore_debug_store();
252 ++
253 ++ microcode_bsp_resume();
254 ++
255 ++ /*
256 ++ * This needs to happen after the microcode has been updated upon resume
257 ++ * because some of the MSRs are "emulated" in microcode.
258 ++ */
259 + msr_restore_context(ctxt);
260 + }
261 +
262 +diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
263 +index b701c79f07e53..3d5cf588c0786 100644
264 +--- a/drivers/block/Kconfig
265 ++++ b/drivers/block/Kconfig
266 +@@ -33,6 +33,22 @@ config BLK_DEV_FD
267 + To compile this driver as a module, choose M here: the
268 + module will be called floppy.
269 +
270 ++config BLK_DEV_FD_RAWCMD
271 ++ bool "Support for raw floppy disk commands (DEPRECATED)"
272 ++ depends on BLK_DEV_FD
273 ++ help
274 ++ If you want to use actual physical floppies and expect to do
275 ++ special low-level hardware accesses to them (access and use
276 ++ non-standard formats, for example), then enable this.
277 ++
278 ++ Note that the code enabled by this option is rarely used and
279 ++ might be unstable or insecure, and distros should not enable it.
280 ++
281 ++ Note: FDRAWCMD is deprecated and will be removed from the kernel
282 ++ in the near future.
283 ++
284 ++ If unsure, say N.
285 ++
286 + config AMIGA_FLOPPY
287 + tristate "Amiga floppy support"
288 + depends on AMIGA
289 +diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
290 +index 7164be9710e51..cfe1bfb3c20e9 100644
291 +--- a/drivers/block/floppy.c
292 ++++ b/drivers/block/floppy.c
293 +@@ -3016,6 +3016,8 @@ static const char *drive_name(int type, int drive)
294 + return "(null)";
295 + }
296 +
297 ++#ifdef CONFIG_BLK_DEV_FD_RAWCMD
298 ++
299 + /* raw commands */
300 + static void raw_cmd_done(int flag)
301 + {
302 +@@ -3227,6 +3229,35 @@ static int raw_cmd_ioctl(int cmd, void __user *param)
303 + return ret;
304 + }
305 +
306 ++static int floppy_raw_cmd_ioctl(int type, int drive, int cmd,
307 ++ void __user *param)
308 ++{
309 ++ int ret;
310 ++
311 ++ pr_warn_once("Note: FDRAWCMD is deprecated and will be removed from the kernel in the near future.\n");
312 ++
313 ++ if (type)
314 ++ return -EINVAL;
315 ++ if (lock_fdc(drive))
316 ++ return -EINTR;
317 ++ set_floppy(drive);
318 ++ ret = raw_cmd_ioctl(cmd, param);
319 ++ if (ret == -EINTR)
320 ++ return -EINTR;
321 ++ process_fd_request();
322 ++ return ret;
323 ++}
324 ++
325 ++#else /* CONFIG_BLK_DEV_FD_RAWCMD */
326 ++
327 ++static int floppy_raw_cmd_ioctl(int type, int drive, int cmd,
328 ++ void __user *param)
329 ++{
330 ++ return -EOPNOTSUPP;
331 ++}
332 ++
333 ++#endif
334 ++
335 + static int invalidate_drive(struct block_device *bdev)
336 + {
337 + /* invalidate the buffer track to force a reread */
338 +@@ -3414,7 +3445,6 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int
339 + {
340 + int drive = (long)bdev->bd_disk->private_data;
341 + int type = ITYPE(UDRS->fd_device);
342 +- int i;
343 + int ret;
344 + int size;
345 + union inparam {
346 +@@ -3565,16 +3595,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int
347 + outparam = UDRWE;
348 + break;
349 + case FDRAWCMD:
350 +- if (type)
351 +- return -EINVAL;
352 +- if (lock_fdc(drive))
353 +- return -EINTR;
354 +- set_floppy(drive);
355 +- i = raw_cmd_ioctl(cmd, (void __user *)param);
356 +- if (i == -EINTR)
357 +- return -EINTR;
358 +- process_fd_request();
359 +- return i;
360 ++ return floppy_raw_cmd_ioctl(type, drive, cmd, (void __user *)param);
361 + case FDTWADDLE:
362 + if (lock_fdc(drive))
363 + return -EINTR;
364 +diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
365 +index 4f3d988210b0a..ce5b976a88568 100644
366 +--- a/drivers/bus/sunxi-rsb.c
367 ++++ b/drivers/bus/sunxi-rsb.c
368 +@@ -224,6 +224,8 @@ static struct sunxi_rsb_device *sunxi_rsb_device_create(struct sunxi_rsb *rsb,
369 +
370 + dev_dbg(&rdev->dev, "device %s registered\n", dev_name(&rdev->dev));
371 +
372 ++ return rdev;
373 ++
374 + err_device_add:
375 + put_device(&rdev->dev);
376 +
377 +diff --git a/drivers/clk/sunxi/clk-sun9i-mmc.c b/drivers/clk/sunxi/clk-sun9i-mmc.c
378 +index f69f9e8c6f380..7e9d1624032fe 100644
379 +--- a/drivers/clk/sunxi/clk-sun9i-mmc.c
380 ++++ b/drivers/clk/sunxi/clk-sun9i-mmc.c
381 +@@ -117,6 +117,8 @@ static int sun9i_a80_mmc_config_clk_probe(struct platform_device *pdev)
382 + spin_lock_init(&data->lock);
383 +
384 + r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
385 ++ if (!r)
386 ++ return -EINVAL;
387 + /* one clock/reset pair per word */
388 + count = DIV_ROUND_UP((resource_size(r)), SUN9I_MMC_WIDTH);
389 + data->membase = devm_ioremap_resource(&pdev->dev, r);
390 +diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
391 +index 57ea7f4641787..11c634125c7df 100644
392 +--- a/drivers/firewire/core-card.c
393 ++++ b/drivers/firewire/core-card.c
394 +@@ -681,6 +681,7 @@ EXPORT_SYMBOL_GPL(fw_card_release);
395 + void fw_core_remove_card(struct fw_card *card)
396 + {
397 + struct fw_card_driver dummy_driver = dummy_driver_template;
398 ++ unsigned long flags;
399 +
400 + card->driver->update_phy_reg(card, 4,
401 + PHY_LINK_ACTIVE | PHY_CONTENDER, 0);
402 +@@ -695,7 +696,9 @@ void fw_core_remove_card(struct fw_card *card)
403 + dummy_driver.stop_iso = card->driver->stop_iso;
404 + card->driver = &dummy_driver;
405 +
406 ++ spin_lock_irqsave(&card->lock, flags);
407 + fw_destroy_nodes(card);
408 ++ spin_unlock_irqrestore(&card->lock, flags);
409 +
410 + /* Wait for all users, especially device workqueue jobs, to finish. */
411 + fw_card_put(card);
412 +diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
413 +index aee149bdf4c03..59b49ff1f4be7 100644
414 +--- a/drivers/firewire/core-cdev.c
415 ++++ b/drivers/firewire/core-cdev.c
416 +@@ -1496,6 +1496,7 @@ static void outbound_phy_packet_callback(struct fw_packet *packet,
417 + {
418 + struct outbound_phy_packet_event *e =
419 + container_of(packet, struct outbound_phy_packet_event, p);
420 ++ struct client *e_client;
421 +
422 + switch (status) {
423 + /* expected: */
424 +@@ -1512,9 +1513,10 @@ static void outbound_phy_packet_callback(struct fw_packet *packet,
425 + }
426 + e->phy_packet.data[0] = packet->timestamp;
427 +
428 ++ e_client = e->client;
429 + queue_event(e->client, &e->event, &e->phy_packet,
430 + sizeof(e->phy_packet) + e->phy_packet.length, NULL, 0);
431 +- client_put(e->client);
432 ++ client_put(e_client);
433 + }
434 +
435 + static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg)
436 +diff --git a/drivers/firewire/core-topology.c b/drivers/firewire/core-topology.c
437 +index 0de83508f321c..2337b0f3dae2c 100644
438 +--- a/drivers/firewire/core-topology.c
439 ++++ b/drivers/firewire/core-topology.c
440 +@@ -387,16 +387,13 @@ static void report_found_node(struct fw_card *card,
441 + card->bm_retries = 0;
442 + }
443 +
444 ++/* Must be called with card->lock held */
445 + void fw_destroy_nodes(struct fw_card *card)
446 + {
447 +- unsigned long flags;
448 +-
449 +- spin_lock_irqsave(&card->lock, flags);
450 + card->color++;
451 + if (card->local_node != NULL)
452 + for_each_fw_node(card, card->local_node, report_lost_node);
453 + card->local_node = NULL;
454 +- spin_unlock_irqrestore(&card->lock, flags);
455 + }
456 +
457 + static void move_tree(struct fw_node *node0, struct fw_node *node1, int port)
458 +@@ -522,6 +519,8 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
459 + struct fw_node *local_node;
460 + unsigned long flags;
461 +
462 ++ spin_lock_irqsave(&card->lock, flags);
463 ++
464 + /*
465 + * If the selfID buffer is not the immediate successor of the
466 + * previously processed one, we cannot reliably compare the
467 +@@ -533,8 +532,6 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
468 + card->bm_retries = 0;
469 + }
470 +
471 +- spin_lock_irqsave(&card->lock, flags);
472 +-
473 + card->broadcast_channel_allocated = card->broadcast_channel_auto_allocated;
474 + card->node_id = node_id;
475 + /*
476 +diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
477 +index d6a09b9cd8cca..0446221d7d2e3 100644
478 +--- a/drivers/firewire/core-transaction.c
479 ++++ b/drivers/firewire/core-transaction.c
480 +@@ -86,24 +86,25 @@ static int try_cancel_split_timeout(struct fw_transaction *t)
481 + static int close_transaction(struct fw_transaction *transaction,
482 + struct fw_card *card, int rcode)
483 + {
484 +- struct fw_transaction *t;
485 ++ struct fw_transaction *t = NULL, *iter;
486 + unsigned long flags;
487 +
488 + spin_lock_irqsave(&card->lock, flags);
489 +- list_for_each_entry(t, &card->transaction_list, link) {
490 +- if (t == transaction) {
491 +- if (!try_cancel_split_timeout(t)) {
492 ++ list_for_each_entry(iter, &card->transaction_list, link) {
493 ++ if (iter == transaction) {
494 ++ if (!try_cancel_split_timeout(iter)) {
495 + spin_unlock_irqrestore(&card->lock, flags);
496 + goto timed_out;
497 + }
498 +- list_del_init(&t->link);
499 +- card->tlabel_mask &= ~(1ULL << t->tlabel);
500 ++ list_del_init(&iter->link);
501 ++ card->tlabel_mask &= ~(1ULL << iter->tlabel);
502 ++ t = iter;
503 + break;
504 + }
505 + }
506 + spin_unlock_irqrestore(&card->lock, flags);
507 +
508 +- if (&t->link != &card->transaction_list) {
509 ++ if (t) {
510 + t->callback(card, rcode, NULL, 0, t->callback_data);
511 + return 0;
512 + }
513 +@@ -938,7 +939,7 @@ EXPORT_SYMBOL(fw_core_handle_request);
514 +
515 + void fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
516 + {
517 +- struct fw_transaction *t;
518 ++ struct fw_transaction *t = NULL, *iter;
519 + unsigned long flags;
520 + u32 *data;
521 + size_t data_length;
522 +@@ -950,20 +951,21 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
523 + rcode = HEADER_GET_RCODE(p->header[1]);
524 +
525 + spin_lock_irqsave(&card->lock, flags);
526 +- list_for_each_entry(t, &card->transaction_list, link) {
527 +- if (t->node_id == source && t->tlabel == tlabel) {
528 +- if (!try_cancel_split_timeout(t)) {
529 ++ list_for_each_entry(iter, &card->transaction_list, link) {
530 ++ if (iter->node_id == source && iter->tlabel == tlabel) {
531 ++ if (!try_cancel_split_timeout(iter)) {
532 + spin_unlock_irqrestore(&card->lock, flags);
533 + goto timed_out;
534 + }
535 +- list_del_init(&t->link);
536 +- card->tlabel_mask &= ~(1ULL << t->tlabel);
537 ++ list_del_init(&iter->link);
538 ++ card->tlabel_mask &= ~(1ULL << iter->tlabel);
539 ++ t = iter;
540 + break;
541 + }
542 + }
543 + spin_unlock_irqrestore(&card->lock, flags);
544 +
545 +- if (&t->link == &card->transaction_list) {
546 ++ if (!t) {
547 + timed_out:
548 + fw_notice(card, "unsolicited response (source %x, tlabel %x)\n",
549 + source, tlabel);
550 +diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
551 +index 6bac03999fd49..d418a71faf0b1 100644
552 +--- a/drivers/firewire/sbp2.c
553 ++++ b/drivers/firewire/sbp2.c
554 +@@ -421,7 +421,7 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request,
555 + void *payload, size_t length, void *callback_data)
556 + {
557 + struct sbp2_logical_unit *lu = callback_data;
558 +- struct sbp2_orb *orb;
559 ++ struct sbp2_orb *orb = NULL, *iter;
560 + struct sbp2_status status;
561 + unsigned long flags;
562 +
563 +@@ -446,17 +446,18 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request,
564 +
565 + /* Lookup the orb corresponding to this status write. */
566 + spin_lock_irqsave(&lu->tgt->lock, flags);
567 +- list_for_each_entry(orb, &lu->orb_list, link) {
568 ++ list_for_each_entry(iter, &lu->orb_list, link) {
569 + if (STATUS_GET_ORB_HIGH(status) == 0 &&
570 +- STATUS_GET_ORB_LOW(status) == orb->request_bus) {
571 +- orb->rcode = RCODE_COMPLETE;
572 +- list_del(&orb->link);
573 ++ STATUS_GET_ORB_LOW(status) == iter->request_bus) {
574 ++ iter->rcode = RCODE_COMPLETE;
575 ++ list_del(&iter->link);
576 ++ orb = iter;
577 + break;
578 + }
579 + }
580 + spin_unlock_irqrestore(&lu->tgt->lock, flags);
581 +
582 +- if (&orb->link != &lu->orb_list) {
583 ++ if (orb) {
584 + orb->callback(orb, &status);
585 + kref_put(&orb->kref, free_orb); /* orb callback reference */
586 + } else {
587 +diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
588 +index 6e60ca53406e7..474f226e0891b 100644
589 +--- a/drivers/hwmon/adt7470.c
590 ++++ b/drivers/hwmon/adt7470.c
591 +@@ -33,6 +33,7 @@
592 + #include <linux/kthread.h>
593 + #include <linux/slab.h>
594 + #include <linux/util_macros.h>
595 ++#include <linux/sched.h>
596 +
597 + /* Addresses to scan */
598 + static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END };
599 +@@ -273,11 +274,10 @@ static int adt7470_update_thread(void *p)
600 + adt7470_read_temperatures(client, data);
601 + mutex_unlock(&data->lock);
602 +
603 +- set_current_state(TASK_INTERRUPTIBLE);
604 + if (kthread_should_stop())
605 + break;
606 +
607 +- schedule_timeout(msecs_to_jiffies(data->auto_update_interval));
608 ++ schedule_timeout_interruptible(msecs_to_jiffies(data->auto_update_interval));
609 + }
610 +
611 + return 0;
612 +diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c
613 +index d3a3d62869d83..86de972f41b11 100644
614 +--- a/drivers/iio/dac/ad5446.c
615 ++++ b/drivers/iio/dac/ad5446.c
616 +@@ -171,7 +171,7 @@ static int ad5446_read_raw(struct iio_dev *indio_dev,
617 +
618 + switch (m) {
619 + case IIO_CHAN_INFO_RAW:
620 +- *val = st->cached_val;
621 ++ *val = st->cached_val >> chan->scan_type.shift;
622 + return IIO_VAL_INT;
623 + case IIO_CHAN_INFO_SCALE:
624 + *val = st->vref_mv;
625 +diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c
626 +index 5c998ac8c840b..126bb8349363c 100644
627 +--- a/drivers/iio/dac/ad5592r-base.c
628 ++++ b/drivers/iio/dac/ad5592r-base.c
629 +@@ -532,7 +532,7 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st)
630 + if (!ret)
631 + st->channel_modes[reg] = tmp;
632 +
633 +- fwnode_property_read_u32(child, "adi,off-state", &tmp);
634 ++ ret = fwnode_property_read_u32(child, "adi,off-state", &tmp);
635 + if (!ret)
636 + st->channel_offstate[reg] = tmp;
637 + }
638 +diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
639 +index 2a4e23e20ebc6..a0787b1835e55 100644
640 +--- a/drivers/iio/magnetometer/ak8975.c
641 ++++ b/drivers/iio/magnetometer/ak8975.c
642 +@@ -404,6 +404,7 @@ static int ak8975_power_on(const struct ak8975_data *data)
643 + if (ret) {
644 + dev_warn(&data->client->dev,
645 + "Failed to enable specified Vid supply\n");
646 ++ regulator_disable(data->vdd);
647 + return ret;
648 + }
649 + /*
650 +diff --git a/drivers/lightnvm/Kconfig b/drivers/lightnvm/Kconfig
651 +index 2f5d5f4a4c75b..c2823d84cfa6a 100644
652 +--- a/drivers/lightnvm/Kconfig
653 ++++ b/drivers/lightnvm/Kconfig
654 +@@ -4,7 +4,7 @@
655 +
656 + menuconfig NVM
657 + bool "Open-Channel SSD target support"
658 +- depends on BLOCK && HAS_DMA
659 ++ depends on BLOCK && HAS_DMA && BROKEN
660 + help
661 + Say Y here to get to enable Open-channel SSDs.
662 +
663 +diff --git a/drivers/md/dm.c b/drivers/md/dm.c
664 +index dd154027adc9d..ec6c2b566621c 100644
665 +--- a/drivers/md/dm.c
666 ++++ b/drivers/md/dm.c
667 +@@ -524,20 +524,19 @@ static void start_io_acct(struct dm_io *io)
668 + false, 0, &io->stats_aux);
669 + }
670 +
671 +-static void end_io_acct(struct dm_io *io)
672 ++static void end_io_acct(struct mapped_device *md, struct bio *bio,
673 ++ unsigned long start_time, struct dm_stats_aux *stats_aux)
674 + {
675 +- struct mapped_device *md = io->md;
676 +- struct bio *bio = io->bio;
677 +- unsigned long duration = jiffies - io->start_time;
678 ++ unsigned long duration = jiffies - start_time;
679 + int pending;
680 + int rw = bio_data_dir(bio);
681 +
682 +- generic_end_io_acct(rw, &dm_disk(md)->part0, io->start_time);
683 ++ generic_end_io_acct(rw, &dm_disk(md)->part0, start_time);
684 +
685 + if (unlikely(dm_stats_used(&md->stats)))
686 + dm_stats_account_io(&md->stats, bio_data_dir(bio),
687 + bio->bi_iter.bi_sector, bio_sectors(bio),
688 +- true, duration, &io->stats_aux);
689 ++ true, duration, stats_aux);
690 +
691 + /*
692 + * After this is decremented the bio must not be touched if it is
693 +@@ -768,6 +767,8 @@ static void dec_pending(struct dm_io *io, int error)
694 + int io_error;
695 + struct bio *bio;
696 + struct mapped_device *md = io->md;
697 ++ unsigned long start_time = 0;
698 ++ struct dm_stats_aux stats_aux;
699 +
700 + /* Push-back supersedes any I/O errors */
701 + if (unlikely(error)) {
702 +@@ -793,8 +794,10 @@ static void dec_pending(struct dm_io *io, int error)
703 +
704 + io_error = io->error;
705 + bio = io->bio;
706 +- end_io_acct(io);
707 ++ start_time = io->start_time;
708 ++ stats_aux = io->stats_aux;
709 + free_io(md, io);
710 ++ end_io_acct(md, bio, start_time, &stats_aux);
711 +
712 + if (io_error == DM_ENDIO_REQUEUE)
713 + return;
714 +@@ -2024,6 +2027,8 @@ static int dm_wait_for_completion(struct mapped_device *md, long task_state)
715 + }
716 + finish_wait(&md->wait, &wait);
717 +
718 ++ smp_rmb(); /* paired with atomic_dec_return in end_io_acct */
719 ++
720 + return r;
721 + }
722 +
723 +diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
724 +index 31f98acdba073..17e15bd054421 100644
725 +--- a/drivers/mtd/nand/sh_flctl.c
726 ++++ b/drivers/mtd/nand/sh_flctl.c
727 +@@ -399,7 +399,8 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf,
728 + dma_addr_t dma_addr;
729 + dma_cookie_t cookie;
730 + uint32_t reg;
731 +- int ret;
732 ++ int ret = 0;
733 ++ unsigned long time_left;
734 +
735 + if (dir == DMA_FROM_DEVICE) {
736 + chan = flctl->chan_fifo0_rx;
737 +@@ -440,13 +441,14 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf,
738 + goto out;
739 + }
740 +
741 +- ret =
742 ++ time_left =
743 + wait_for_completion_timeout(&flctl->dma_complete,
744 + msecs_to_jiffies(3000));
745 +
746 +- if (ret <= 0) {
747 ++ if (time_left == 0) {
748 + dmaengine_terminate_all(chan);
749 + dev_err(&flctl->pdev->dev, "wait_for_completion_timeout\n");
750 ++ ret = -ETIMEDOUT;
751 + }
752 +
753 + out:
754 +@@ -456,7 +458,7 @@ out:
755 +
756 + dma_unmap_single(chan->device->dev, dma_addr, len, dir);
757 +
758 +- /* ret > 0 is success */
759 ++ /* ret == 0 is success */
760 + return ret;
761 + }
762 +
763 +@@ -480,7 +482,7 @@ static void read_fiforeg(struct sh_flctl *flctl, int rlen, int offset)
764 +
765 + /* initiate DMA transfer */
766 + if (flctl->chan_fifo0_rx && rlen >= 32 &&
767 +- flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE) > 0)
768 ++ !flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE))
769 + goto convert; /* DMA success */
770 +
771 + /* do polling transfer */
772 +@@ -539,7 +541,7 @@ static void write_ec_fiforeg(struct sh_flctl *flctl, int rlen,
773 +
774 + /* initiate DMA transfer */
775 + if (flctl->chan_fifo0_tx && rlen >= 32 &&
776 +- flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE) > 0)
777 ++ !flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE))
778 + return; /* DMA success */
779 +
780 + /* do polling transfer */
781 +diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
782 +index db9538d4b3586..a2dbd7ae9db24 100644
783 +--- a/drivers/net/can/grcan.c
784 ++++ b/drivers/net/can/grcan.c
785 +@@ -252,6 +252,7 @@ struct grcan_device_config {
786 + struct grcan_priv {
787 + struct can_priv can; /* must be the first member */
788 + struct net_device *dev;
789 ++ struct device *ofdev_dev;
790 + struct napi_struct napi;
791 +
792 + struct grcan_registers __iomem *regs; /* ioremap'ed registers */
793 +@@ -928,7 +929,7 @@ static void grcan_free_dma_buffers(struct net_device *dev)
794 + struct grcan_priv *priv = netdev_priv(dev);
795 + struct grcan_dma *dma = &priv->dma;
796 +
797 +- dma_free_coherent(&dev->dev, dma->base_size, dma->base_buf,
798 ++ dma_free_coherent(priv->ofdev_dev, dma->base_size, dma->base_buf,
799 + dma->base_handle);
800 + memset(dma, 0, sizeof(*dma));
801 + }
802 +@@ -953,7 +954,7 @@ static int grcan_allocate_dma_buffers(struct net_device *dev,
803 +
804 + /* Extra GRCAN_BUFFER_ALIGNMENT to allow for alignment */
805 + dma->base_size = lsize + ssize + GRCAN_BUFFER_ALIGNMENT;
806 +- dma->base_buf = dma_alloc_coherent(&dev->dev,
807 ++ dma->base_buf = dma_alloc_coherent(priv->ofdev_dev,
808 + dma->base_size,
809 + &dma->base_handle,
810 + GFP_KERNEL);
811 +@@ -1117,8 +1118,10 @@ static int grcan_close(struct net_device *dev)
812 +
813 + priv->closing = true;
814 + if (priv->need_txbug_workaround) {
815 ++ spin_unlock_irqrestore(&priv->lock, flags);
816 + del_timer_sync(&priv->hang_timer);
817 + del_timer_sync(&priv->rr_timer);
818 ++ spin_lock_irqsave(&priv->lock, flags);
819 + }
820 + netif_stop_queue(dev);
821 + grcan_stop_hardware(dev);
822 +@@ -1604,6 +1607,7 @@ static int grcan_setup_netdev(struct platform_device *ofdev,
823 + memcpy(&priv->config, &grcan_module_config,
824 + sizeof(struct grcan_device_config));
825 + priv->dev = dev;
826 ++ priv->ofdev_dev = &ofdev->dev;
827 + priv->regs = base;
828 + priv->can.bittiming_const = &grcan_bittiming_const;
829 + priv->can.do_set_bittiming = grcan_set_bittiming;
830 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
831 +index 8d17d464c0677..398928642a97a 100644
832 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
833 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
834 +@@ -14314,10 +14314,6 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
835 +
836 + /* Stop Tx */
837 + bnx2x_tx_disable(bp);
838 +- /* Delete all NAPI objects */
839 +- bnx2x_del_all_napi(bp);
840 +- if (CNIC_LOADED(bp))
841 +- bnx2x_del_all_napi_cnic(bp);
842 + netdev_reset_tc(bp->dev);
843 +
844 + del_timer_sync(&bp->timer);
845 +@@ -14422,6 +14418,11 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev)
846 + bnx2x_drain_tx_queues(bp);
847 + bnx2x_send_unload_req(bp, UNLOAD_RECOVERY);
848 + bnx2x_netif_stop(bp, 1);
849 ++ bnx2x_del_all_napi(bp);
850 ++
851 ++ if (CNIC_LOADED(bp))
852 ++ bnx2x_del_all_napi_cnic(bp);
853 ++
854 + bnx2x_free_irq(bp);
855 +
856 + /* Report UNLOAD_DONE to MCP */
857 +diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
858 +index 264136dba6741..5eaee7a3ac177 100644
859 +--- a/drivers/net/ethernet/smsc/smsc911x.c
860 ++++ b/drivers/net/ethernet/smsc/smsc911x.c
861 +@@ -2441,7 +2441,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
862 + if (irq == -EPROBE_DEFER) {
863 + retval = -EPROBE_DEFER;
864 + goto out_0;
865 +- } else if (irq <= 0) {
866 ++ } else if (irq < 0) {
867 + pr_warn("Could not allocate irq resource\n");
868 + retval = -ENODEV;
869 + goto out_0;
870 +diff --git a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c
871 +index 6ca428a702f16..6a9c954492f22 100644
872 +--- a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c
873 ++++ b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c
874 +@@ -68,6 +68,10 @@
875 + #define TSE_PCS_USE_SGMII_ENA BIT(0)
876 + #define TSE_PCS_IF_USE_SGMII 0x03
877 +
878 ++#define SGMII_ADAPTER_CTRL_REG 0x00
879 ++#define SGMII_ADAPTER_DISABLE 0x0001
880 ++#define SGMII_ADAPTER_ENABLE 0x0000
881 ++
882 + #define AUTONEGO_LINK_TIMER 20
883 +
884 + static int tse_pcs_reset(void __iomem *base, struct tse_pcs *pcs)
885 +@@ -211,8 +215,12 @@ void tse_pcs_fix_mac_speed(struct tse_pcs *pcs, struct phy_device *phy_dev,
886 + unsigned int speed)
887 + {
888 + void __iomem *tse_pcs_base = pcs->tse_pcs_base;
889 ++ void __iomem *sgmii_adapter_base = pcs->sgmii_adapter_base;
890 + u32 val;
891 +
892 ++ writew(SGMII_ADAPTER_ENABLE,
893 ++ sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
894 ++
895 + pcs->autoneg = phy_dev->autoneg;
896 +
897 + if (phy_dev->autoneg == AUTONEG_ENABLE) {
898 +diff --git a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h
899 +index 254199f2efdbf..2f5882450b06a 100644
900 +--- a/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h
901 ++++ b/drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.h
902 +@@ -21,10 +21,6 @@
903 + #include <linux/phy.h>
904 + #include <linux/timer.h>
905 +
906 +-#define SGMII_ADAPTER_CTRL_REG 0x00
907 +-#define SGMII_ADAPTER_ENABLE 0x0000
908 +-#define SGMII_ADAPTER_DISABLE 0x0001
909 +-
910 + struct tse_pcs {
911 + struct device *dev;
912 + void __iomem *tse_pcs_base;
913 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
914 +index b138968b8672a..c3a78c1134240 100644
915 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
916 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
917 +@@ -29,6 +29,9 @@
918 +
919 + #include "altr_tse_pcs.h"
920 +
921 ++#define SGMII_ADAPTER_CTRL_REG 0x00
922 ++#define SGMII_ADAPTER_DISABLE 0x0001
923 ++
924 + #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII 0x0
925 + #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII 0x1
926 + #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RMII 0x2
927 +@@ -62,14 +65,16 @@ static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed)
928 + {
929 + struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)priv;
930 + void __iomem *splitter_base = dwmac->splitter_base;
931 ++ void __iomem *tse_pcs_base = dwmac->pcs.tse_pcs_base;
932 + void __iomem *sgmii_adapter_base = dwmac->pcs.sgmii_adapter_base;
933 + struct device *dev = dwmac->dev;
934 + struct net_device *ndev = dev_get_drvdata(dev);
935 + struct phy_device *phy_dev = ndev->phydev;
936 + u32 val;
937 +
938 +- writew(SGMII_ADAPTER_DISABLE,
939 +- sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
940 ++ if ((tse_pcs_base) && (sgmii_adapter_base))
941 ++ writew(SGMII_ADAPTER_DISABLE,
942 ++ sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
943 +
944 + if (splitter_base) {
945 + val = readl(splitter_base + EMAC_SPLITTER_CTRL_REG);
946 +@@ -91,9 +96,7 @@ static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed)
947 + writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG);
948 + }
949 +
950 +- writew(SGMII_ADAPTER_ENABLE,
951 +- sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
952 +- if (phy_dev)
953 ++ if (tse_pcs_base && sgmii_adapter_base)
954 + tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed);
955 + }
956 +
957 +diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
958 +index 1f9a6ea356b02..cdcc860607492 100644
959 +--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
960 ++++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
961 +@@ -817,10 +817,10 @@ static int xemaclite_mdio_write(struct mii_bus *bus, int phy_id, int reg,
962 + static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
963 + {
964 + struct mii_bus *bus;
965 +- int rc;
966 + struct resource res;
967 + struct device_node *np = of_get_parent(lp->phy_node);
968 + struct device_node *npp;
969 ++ int rc, ret;
970 +
971 + /* Don't register the MDIO bus if the phy_node or its parent node
972 + * can't be found.
973 +@@ -830,8 +830,14 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
974 + return -ENODEV;
975 + }
976 + npp = of_get_parent(np);
977 +-
978 +- of_address_to_resource(npp, 0, &res);
979 ++ ret = of_address_to_resource(npp, 0, &res);
980 ++ of_node_put(npp);
981 ++ if (ret) {
982 ++ dev_err(dev, "%s resource error!\n",
983 ++ dev->of_node->full_name);
984 ++ of_node_put(np);
985 ++ return ret;
986 ++ }
987 + if (lp->ndev->mem_start != res.start) {
988 + struct phy_device *phydev;
989 + phydev = of_phy_find_device(lp->phy_node);
990 +@@ -840,6 +846,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
991 + "MDIO of the phy is not registered yet\n");
992 + else
993 + put_device(&phydev->mdio.dev);
994 ++ of_node_put(np);
995 + return 0;
996 + }
997 +
998 +@@ -852,6 +859,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
999 + bus = mdiobus_alloc();
1000 + if (!bus) {
1001 + dev_err(dev, "Failed to allocate mdiobus\n");
1002 ++ of_node_put(np);
1003 + return -ENOMEM;
1004 + }
1005 +
1006 +@@ -866,6 +874,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
1007 + lp->mii_bus = bus;
1008 +
1009 + rc = of_mdiobus_register(bus, np);
1010 ++ of_node_put(np);
1011 + if (rc) {
1012 + dev_err(dev, "Failed to register mdio bus.\n");
1013 + goto err_register;
1014 +diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
1015 +index 6f3519123eb66..0e1a422d9567e 100644
1016 +--- a/drivers/net/hippi/rrunner.c
1017 ++++ b/drivers/net/hippi/rrunner.c
1018 +@@ -1354,7 +1354,9 @@ static int rr_close(struct net_device *dev)
1019 +
1020 + rrpriv->fw_running = 0;
1021 +
1022 ++ spin_unlock_irqrestore(&rrpriv->lock, flags);
1023 + del_timer_sync(&rrpriv->timer);
1024 ++ spin_lock_irqsave(&rrpriv->lock, flags);
1025 +
1026 + writel(0, &regs->TxPi);
1027 + writel(0, &regs->IpRxPi);
1028 +diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c
1029 +index a446590a71caf..cd44c1d27b12f 100644
1030 +--- a/drivers/nfc/nfcmrvl/main.c
1031 ++++ b/drivers/nfc/nfcmrvl/main.c
1032 +@@ -194,6 +194,7 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
1033 + {
1034 + struct nci_dev *ndev = priv->ndev;
1035 +
1036 ++ nci_unregister_device(ndev);
1037 + if (priv->ndev->nfc_dev->fw_download_in_progress)
1038 + nfcmrvl_fw_dnld_abort(priv);
1039 +
1040 +@@ -202,7 +203,6 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
1041 + if (priv->config.reset_n_io)
1042 + gpio_free(priv->config.reset_n_io);
1043 +
1044 +- nci_unregister_device(ndev);
1045 + nci_free_device(ndev);
1046 + kfree(priv);
1047 + }
1048 +diff --git a/drivers/phy/phy-exynos5250-sata.c b/drivers/phy/phy-exynos5250-sata.c
1049 +index 60e13afcd9b84..2c39d2fd3cd80 100644
1050 +--- a/drivers/phy/phy-exynos5250-sata.c
1051 ++++ b/drivers/phy/phy-exynos5250-sata.c
1052 +@@ -193,6 +193,7 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
1053 + return -EINVAL;
1054 +
1055 + sata_phy->client = of_find_i2c_device_by_node(node);
1056 ++ of_node_put(node);
1057 + if (!sata_phy->client)
1058 + return -EPROBE_DEFER;
1059 +
1060 +@@ -201,20 +202,21 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
1061 + sata_phy->phyclk = devm_clk_get(dev, "sata_phyctrl");
1062 + if (IS_ERR(sata_phy->phyclk)) {
1063 + dev_err(dev, "failed to get clk for PHY\n");
1064 +- return PTR_ERR(sata_phy->phyclk);
1065 ++ ret = PTR_ERR(sata_phy->phyclk);
1066 ++ goto put_dev;
1067 + }
1068 +
1069 + ret = clk_prepare_enable(sata_phy->phyclk);
1070 + if (ret < 0) {
1071 + dev_err(dev, "failed to enable source clk\n");
1072 +- return ret;
1073 ++ goto put_dev;
1074 + }
1075 +
1076 + sata_phy->phy = devm_phy_create(dev, NULL, &exynos_sata_phy_ops);
1077 + if (IS_ERR(sata_phy->phy)) {
1078 +- clk_disable_unprepare(sata_phy->phyclk);
1079 + dev_err(dev, "failed to create PHY\n");
1080 +- return PTR_ERR(sata_phy->phy);
1081 ++ ret = PTR_ERR(sata_phy->phy);
1082 ++ goto clk_disable;
1083 + }
1084 +
1085 + phy_set_drvdata(sata_phy->phy, sata_phy);
1086 +@@ -222,11 +224,18 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
1087 + phy_provider = devm_of_phy_provider_register(dev,
1088 + of_phy_simple_xlate);
1089 + if (IS_ERR(phy_provider)) {
1090 +- clk_disable_unprepare(sata_phy->phyclk);
1091 +- return PTR_ERR(phy_provider);
1092 ++ ret = PTR_ERR(phy_provider);
1093 ++ goto clk_disable;
1094 + }
1095 +
1096 + return 0;
1097 ++
1098 ++clk_disable:
1099 ++ clk_disable_unprepare(sata_phy->phyclk);
1100 ++put_dev:
1101 ++ put_device(&sata_phy->client->dev);
1102 ++
1103 ++ return ret;
1104 + }
1105 +
1106 + static const struct of_device_id exynos_sata_phy_of_match[] = {
1107 +diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c
1108 +index b2b7e238bda97..fc8c57527fb78 100644
1109 +--- a/drivers/pinctrl/pinctrl-pistachio.c
1110 ++++ b/drivers/pinctrl/pinctrl-pistachio.c
1111 +@@ -1374,10 +1374,10 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
1112 + }
1113 +
1114 + irq = irq_of_parse_and_map(child, 0);
1115 +- if (irq < 0) {
1116 +- dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq);
1117 ++ if (!irq) {
1118 ++ dev_err(pctl->dev, "No IRQ for bank %u\n", i);
1119 + of_node_put(child);
1120 +- ret = irq;
1121 ++ ret = -EINVAL;
1122 + goto err;
1123 + }
1124 +
1125 +diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
1126 +index 2311f8a635a6f..3badb10229ef5 100644
1127 +--- a/drivers/tty/n_gsm.c
1128 ++++ b/drivers/tty/n_gsm.c
1129 +@@ -84,6 +84,8 @@ module_param(debug, int, 0600);
1130 + */
1131 + #define MAX_MRU 1500
1132 + #define MAX_MTU 1500
1133 ++/* SOF, ADDR, CTRL, LEN1, LEN2, ..., FCS, EOF */
1134 ++#define PROT_OVERHEAD 7
1135 + #define GSM_NET_TX_TIMEOUT (HZ*10)
1136 +
1137 + /**
1138 +@@ -839,7 +841,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci)
1139 + break;
1140 + case 2: /* Unstructed with modem bits.
1141 + Always one byte as we never send inline break data */
1142 +- *dp++ = gsm_encode_modem(dlci);
1143 ++ *dp++ = (gsm_encode_modem(dlci) << 1) | EA;
1144 + break;
1145 + }
1146 + WARN_ON(kfifo_out_locked(dlci->fifo, dp , len, &dlci->lock) != len);
1147 +@@ -1316,11 +1318,12 @@ static void gsm_control_response(struct gsm_mux *gsm, unsigned int command,
1148 +
1149 + static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control *ctrl)
1150 + {
1151 +- struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, gsm->ftype);
1152 ++ struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 2, gsm->ftype);
1153 + if (msg == NULL)
1154 + return;
1155 +- msg->data[0] = (ctrl->cmd << 1) | 2 | EA; /* command */
1156 +- memcpy(msg->data + 1, ctrl->data, ctrl->len);
1157 ++ msg->data[0] = (ctrl->cmd << 1) | CR | EA; /* command */
1158 ++ msg->data[1] = (ctrl->len << 1) | EA;
1159 ++ memcpy(msg->data + 2, ctrl->data, ctrl->len);
1160 + gsm_data_queue(gsm->dlci[0], msg);
1161 + }
1162 +
1163 +@@ -1343,7 +1346,6 @@ static void gsm_control_retransmit(unsigned long data)
1164 + spin_lock_irqsave(&gsm->control_lock, flags);
1165 + ctrl = gsm->pending_cmd;
1166 + if (ctrl) {
1167 +- gsm->cretries--;
1168 + if (gsm->cretries == 0) {
1169 + gsm->pending_cmd = NULL;
1170 + ctrl->error = -ETIMEDOUT;
1171 +@@ -1352,6 +1354,7 @@ static void gsm_control_retransmit(unsigned long data)
1172 + wake_up(&gsm->event);
1173 + return;
1174 + }
1175 ++ gsm->cretries--;
1176 + gsm_control_transmit(gsm, ctrl);
1177 + mod_timer(&gsm->t2_timer, jiffies + gsm->t2 * HZ / 100);
1178 + }
1179 +@@ -1392,7 +1395,7 @@ retry:
1180 +
1181 + /* If DLCI0 is in ADM mode skip retries, it won't respond */
1182 + if (gsm->dlci[0]->mode == DLCI_MODE_ADM)
1183 +- gsm->cretries = 1;
1184 ++ gsm->cretries = 0;
1185 + else
1186 + gsm->cretries = gsm->n2;
1187 +
1188 +@@ -1826,7 +1829,6 @@ static void gsm_queue(struct gsm_mux *gsm)
1189 + gsm_response(gsm, address, UA);
1190 + gsm_dlci_close(dlci);
1191 + break;
1192 +- case UA:
1193 + case UA|PF:
1194 + if (cr == 0 || dlci == NULL)
1195 + break;
1196 +@@ -1977,7 +1979,8 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c)
1197 + }
1198 + /* Any partial frame was a runt so go back to start */
1199 + if (gsm->state != GSM_START) {
1200 +- gsm->malformed++;
1201 ++ if (gsm->state != GSM_SEARCH)
1202 ++ gsm->malformed++;
1203 + gsm->state = GSM_START;
1204 + }
1205 + /* A SOF in GSM_START means we are still reading idling or
1206 +@@ -2098,6 +2101,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm)
1207 + gsm_dlci_release(gsm->dlci[i]);
1208 + mutex_unlock(&gsm->mutex);
1209 + /* Now wipe the queues */
1210 ++ tty_ldisc_flush(gsm->tty);
1211 + list_for_each_entry_safe(txq, ntxq, &gsm->tx_list, list)
1212 + kfree(txq);
1213 + INIT_LIST_HEAD(&gsm->tx_list);
1214 +@@ -2198,7 +2202,7 @@ static struct gsm_mux *gsm_alloc_mux(void)
1215 + kfree(gsm);
1216 + return NULL;
1217 + }
1218 +- gsm->txframe = kmalloc(2 * MAX_MRU + 2, GFP_KERNEL);
1219 ++ gsm->txframe = kmalloc(2 * (MAX_MTU + PROT_OVERHEAD - 1), GFP_KERNEL);
1220 + if (gsm->txframe == NULL) {
1221 + kfree(gsm->buf);
1222 + kfree(gsm);
1223 +@@ -2515,7 +2519,7 @@ static int gsmld_config(struct tty_struct *tty, struct gsm_mux *gsm,
1224 + /* Check the MRU/MTU range looks sane */
1225 + if (c->mru > MAX_MRU || c->mtu > MAX_MTU || c->mru < 8 || c->mtu < 8)
1226 + return -EINVAL;
1227 +- if (c->n2 < 3)
1228 ++ if (c->n2 > 255)
1229 + return -EINVAL;
1230 + if (c->encapsulation > 1) /* Basic, advanced, no I */
1231 + return -EINVAL;
1232 +@@ -2860,19 +2864,17 @@ static struct tty_ldisc_ops tty_ldisc_packet = {
1233 +
1234 + static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk)
1235 + {
1236 +- u8 modembits[5];
1237 ++ u8 modembits[3];
1238 + struct gsm_control *ctrl;
1239 + int len = 2;
1240 +
1241 +- if (brk)
1242 ++ modembits[0] = (dlci->addr << 2) | 2 | EA; /* DLCI, Valid, EA */
1243 ++ modembits[1] = (gsm_encode_modem(dlci) << 1) | EA;
1244 ++ if (brk) {
1245 ++ modembits[2] = (brk << 4) | 2 | EA; /* Length, Break, EA */
1246 + len++;
1247 +-
1248 +- modembits[0] = len << 1 | EA; /* Data bytes */
1249 +- modembits[1] = dlci->addr << 2 | 3; /* DLCI, EA, 1 */
1250 +- modembits[2] = gsm_encode_modem(dlci) << 1 | EA;
1251 +- if (brk)
1252 +- modembits[3] = brk << 4 | 2 | EA; /* Valid, EA */
1253 +- ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len + 1);
1254 ++ }
1255 ++ ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len);
1256 + if (ctrl == NULL)
1257 + return -ENOMEM;
1258 + return gsm_control_wait(dlci->gsm, ctrl);
1259 +diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
1260 +index 3973bbd5ee553..a54dc0375ac68 100644
1261 +--- a/drivers/tty/serial/8250/8250_pci.c
1262 ++++ b/drivers/tty/serial/8250/8250_pci.c
1263 +@@ -2915,7 +2915,7 @@ enum pci_board_num_t {
1264 + pbn_panacom2,
1265 + pbn_panacom4,
1266 + pbn_plx_romulus,
1267 +- pbn_endrun_2_4000000,
1268 ++ pbn_endrun_2_3906250,
1269 + pbn_oxsemi,
1270 + pbn_oxsemi_1_4000000,
1271 + pbn_oxsemi_2_4000000,
1272 +@@ -3479,10 +3479,10 @@ static struct pciserial_board pci_boards[] = {
1273 + * signal now many ports are available
1274 + * 2 port 952 Uart support
1275 + */
1276 +- [pbn_endrun_2_4000000] = {
1277 ++ [pbn_endrun_2_3906250] = {
1278 + .flags = FL_BASE0,
1279 + .num_ports = 2,
1280 +- .base_baud = 4000000,
1281 ++ .base_baud = 3906250,
1282 + .uart_offset = 0x200,
1283 + .first_offset = 0x1000,
1284 + },
1285 +@@ -4430,7 +4430,7 @@ static struct pci_device_id serial_pci_tbl[] = {
1286 + */
1287 + { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588,
1288 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
1289 +- pbn_endrun_2_4000000 },
1290 ++ pbn_endrun_2_3906250 },
1291 + /*
1292 + * Quatech cards. These actually have configurable clocks but for
1293 + * now we just use the default.
1294 +diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
1295 +index 460c35b2b54d9..2d83f1dfb4d69 100644
1296 +--- a/drivers/tty/serial/8250/8250_port.c
1297 ++++ b/drivers/tty/serial/8250/8250_port.c
1298 +@@ -3150,7 +3150,7 @@ static void serial8250_console_restore(struct uart_8250_port *up)
1299 +
1300 + serial8250_set_divisor(port, baud, quot, frac);
1301 + serial_port_out(port, UART_LCR, up->lcr);
1302 +- serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS);
1303 ++ serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS);
1304 + }
1305 +
1306 + /*
1307 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1308 +index 2ca6ed207e26e..bba74e9b7da0f 100644
1309 +--- a/drivers/usb/core/quirks.c
1310 ++++ b/drivers/usb/core/quirks.c
1311 +@@ -243,6 +243,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1312 + { USB_DEVICE(0x0b05, 0x17e0), .driver_info =
1313 + USB_QUIRK_IGNORE_REMOTE_WAKEUP },
1314 +
1315 ++ /* Realtek Semiconductor Corp. Mass Storage Device (Multicard Reader)*/
1316 ++ { USB_DEVICE(0x0bda, 0x0151), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
1317 ++
1318 + /* Realtek hub in Dell WD19 (Type-C) */
1319 + { USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM },
1320 + { USB_DEVICE(0x0bda, 0x5487), .driver_info = USB_QUIRK_RESET_RESUME },
1321 +@@ -325,6 +328,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1322 + /* DJI CineSSD */
1323 + { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
1324 +
1325 ++ /* VCOM device */
1326 ++ { USB_DEVICE(0x4296, 0x7570), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
1327 ++
1328 + /* INTEL VALUE SSD */
1329 + { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
1330 +
1331 +diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
1332 +index fe1b54a8fb0c8..4653eeb10e0e4 100644
1333 +--- a/drivers/usb/gadget/configfs.c
1334 ++++ b/drivers/usb/gadget/configfs.c
1335 +@@ -1409,6 +1409,8 @@ static void configfs_composite_unbind(struct usb_gadget *gadget)
1336 + usb_ep_autoconfig_reset(cdev->gadget);
1337 + spin_lock_irqsave(&gi->spinlock, flags);
1338 + cdev->gadget = NULL;
1339 ++ cdev->deactivations = 0;
1340 ++ gadget->deactivated = false;
1341 + set_gadget_data(gadget, NULL);
1342 + spin_unlock_irqrestore(&gi->spinlock, flags);
1343 + }
1344 +diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c
1345 +index 6377e9fee6e59..dadf6e5073801 100644
1346 +--- a/drivers/usb/gadget/function/uvc_queue.c
1347 ++++ b/drivers/usb/gadget/function/uvc_queue.c
1348 +@@ -246,6 +246,8 @@ void uvcg_queue_cancel(struct uvc_video_queue *queue, int disconnect)
1349 + buf->state = UVC_BUF_STATE_ERROR;
1350 + vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_ERROR);
1351 + }
1352 ++ queue->buf_used = 0;
1353 ++
1354 + /* This must be protected by the irqlock spinlock to avoid race
1355 + * conditions between uvc_queue_buffer and the disconnection event that
1356 + * could result in an interruptible wait in uvc_dequeue_buffer. Do not
1357 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1358 +index a08369cb3462f..ebf09503be394 100644
1359 +--- a/drivers/usb/host/xhci.c
1360 ++++ b/drivers/usb/host/xhci.c
1361 +@@ -746,6 +746,17 @@ void xhci_shutdown(struct usb_hcd *hcd)
1362 + if (xhci->quirks & XHCI_SPURIOUS_REBOOT)
1363 + usb_disable_xhci_ports(to_pci_dev(hcd->self.controller));
1364 +
1365 ++ /* Don't poll the roothubs after shutdown. */
1366 ++ xhci_dbg(xhci, "%s: stopping usb%d port polling.\n",
1367 ++ __func__, hcd->self.busnum);
1368 ++ clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
1369 ++ del_timer_sync(&hcd->rh_timer);
1370 ++
1371 ++ if (xhci->shared_hcd) {
1372 ++ clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags);
1373 ++ del_timer_sync(&xhci->shared_hcd->rh_timer);
1374 ++ }
1375 ++
1376 + spin_lock_irq(&xhci->lock);
1377 + xhci_halt(xhci);
1378 + /* Workaround for spurious wakeups at shutdown with HSW */
1379 +diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
1380 +index 0ec6d76d1563b..08517d475d463 100644
1381 +--- a/drivers/usb/misc/uss720.c
1382 ++++ b/drivers/usb/misc/uss720.c
1383 +@@ -87,6 +87,7 @@ static void destroy_priv(struct kref *kref)
1384 +
1385 + dev_dbg(&priv->usbdev->dev, "destroying priv datastructure\n");
1386 + usb_put_dev(priv->usbdev);
1387 ++ priv->usbdev = NULL;
1388 + kfree(priv);
1389 + }
1390 +
1391 +@@ -750,7 +751,6 @@ static int uss720_probe(struct usb_interface *intf,
1392 + parport_announce_port(pp);
1393 +
1394 + usb_set_intfdata(intf, pp);
1395 +- usb_put_dev(usbdev);
1396 + return 0;
1397 +
1398 + probe_abort:
1399 +@@ -770,7 +770,6 @@ static void uss720_disconnect(struct usb_interface *intf)
1400 + if (pp) {
1401 + priv = pp->private_data;
1402 + usbdev = priv->usbdev;
1403 +- priv->usbdev = NULL;
1404 + priv->pp = NULL;
1405 + dev_dbg(&intf->dev, "parport_remove_port\n");
1406 + parport_remove_port(pp);
1407 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1408 +index ddee42e44a33b..b0c98c61c53af 100644
1409 +--- a/drivers/usb/serial/cp210x.c
1410 ++++ b/drivers/usb/serial/cp210x.c
1411 +@@ -192,6 +192,8 @@ static const struct usb_device_id id_table[] = {
1412 + { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */
1413 + { USB_DEVICE(0x17A8, 0x0001) }, /* Kamstrup Optical Eye/3-wire */
1414 + { USB_DEVICE(0x17A8, 0x0005) }, /* Kamstrup M-Bus Master MultiPort 250D */
1415 ++ { USB_DEVICE(0x17A8, 0x0101) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Int Ant) */
1416 ++ { USB_DEVICE(0x17A8, 0x0102) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Ext Ant) */
1417 + { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
1418 + { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
1419 + { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
1420 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1421 +index c5d0d9e2bff2d..3fcf53e85adbb 100644
1422 +--- a/drivers/usb/serial/option.c
1423 ++++ b/drivers/usb/serial/option.c
1424 +@@ -430,6 +430,8 @@ static void option_instat_callback(struct urb *urb);
1425 + #define CINTERION_PRODUCT_CLS8 0x00b0
1426 + #define CINTERION_PRODUCT_MV31_MBIM 0x00b3
1427 + #define CINTERION_PRODUCT_MV31_RMNET 0x00b7
1428 ++#define CINTERION_PRODUCT_MV32_WA 0x00f1
1429 ++#define CINTERION_PRODUCT_MV32_WB 0x00f2
1430 +
1431 + /* Olivetti products */
1432 + #define OLIVETTI_VENDOR_ID 0x0b3c
1433 +@@ -1193,6 +1195,10 @@ static const struct usb_device_id option_ids[] = {
1434 + .driver_info = NCTRL(0) | RSVD(1) },
1435 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff), /* Telit FD980 */
1436 + .driver_info = NCTRL(2) | RSVD(3) },
1437 ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1057, 0xff), /* Telit FN980 */
1438 ++ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1439 ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1058, 0xff), /* Telit FN980 (PCIe) */
1440 ++ .driver_info = NCTRL(0) | RSVD(1) },
1441 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1060, 0xff), /* Telit LN920 (rmnet) */
1442 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1443 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1061, 0xff), /* Telit LN920 (MBIM) */
1444 +@@ -1209,6 +1215,8 @@ static const struct usb_device_id option_ids[] = {
1445 + .driver_info = NCTRL(2) | RSVD(3) },
1446 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990 (ECM) */
1447 + .driver_info = NCTRL(0) | RSVD(1) },
1448 ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990 (PCIe) */
1449 ++ .driver_info = RSVD(0) },
1450 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910),
1451 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) },
1452 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
1453 +@@ -1945,6 +1953,10 @@ static const struct usb_device_id option_ids[] = {
1454 + .driver_info = RSVD(3)},
1455 + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_RMNET, 0xff),
1456 + .driver_info = RSVD(0)},
1457 ++ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA, 0xff),
1458 ++ .driver_info = RSVD(3)},
1459 ++ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB, 0xff),
1460 ++ .driver_info = RSVD(3)},
1461 + { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100),
1462 + .driver_info = RSVD(4) },
1463 + { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120),
1464 +diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
1465 +index 345211f1a4915..1dd65019eea14 100644
1466 +--- a/drivers/usb/serial/whiteheat.c
1467 ++++ b/drivers/usb/serial/whiteheat.c
1468 +@@ -644,9 +644,8 @@ static int firm_send_command(struct usb_serial_port *port, __u8 command,
1469 + switch (command) {
1470 + case WHITEHEAT_GET_DTR_RTS:
1471 + info = usb_get_serial_port_data(port);
1472 +- memcpy(&info->mcr, command_info->result_buffer,
1473 +- sizeof(struct whiteheat_dr_info));
1474 +- break;
1475 ++ info->mcr = command_info->result_buffer[0];
1476 ++ break;
1477 + }
1478 + }
1479 + exit:
1480 +diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
1481 +index cc91b0c564a38..312c050d0dbde 100644
1482 +--- a/fs/btrfs/tree-log.c
1483 ++++ b/fs/btrfs/tree-log.c
1484 +@@ -4696,6 +4696,18 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
1485 + mutex_lock(&BTRFS_I(inode)->log_mutex);
1486 + }
1487 +
1488 ++ /*
1489 ++ * For symlinks, we must always log their content, which is stored in an
1490 ++ * inline extent, otherwise we could end up with an empty symlink after
1491 ++ * log replay, which is invalid on linux (symlink(2) returns -ENOENT if
1492 ++ * one attempts to create an empty symlink).
1493 ++ * We don't need to worry about flushing delalloc, because when we create
1494 ++ * the inline extent when the symlink is created (we never have delalloc
1495 ++ * for symlinks).
1496 ++ */
1497 ++ if (S_ISLNK(inode->i_mode))
1498 ++ inode_only = LOG_INODE_ALL;
1499 ++
1500 + /*
1501 + * a brute force approach to making sure we get the most uptodate
1502 + * copies of everything.
1503 +@@ -5271,7 +5283,7 @@ process_leaf:
1504 + }
1505 +
1506 + ctx->log_new_dentries = false;
1507 +- if (type == BTRFS_FT_DIR || type == BTRFS_FT_SYMLINK)
1508 ++ if (type == BTRFS_FT_DIR)
1509 + log_mode = LOG_INODE_ALL;
1510 + ret = btrfs_log_inode(trans, root, di_inode,
1511 + log_mode, 0, LLONG_MAX, ctx);
1512 +diff --git a/include/linux/kernel.h b/include/linux/kernel.h
1513 +index d83fc669eeac7..e779833096347 100644
1514 +--- a/include/linux/kernel.h
1515 ++++ b/include/linux/kernel.h
1516 +@@ -530,7 +530,7 @@ static inline char *hex_byte_pack_upper(char *buf, u8 byte)
1517 + return buf;
1518 + }
1519 +
1520 +-extern int hex_to_bin(char ch);
1521 ++extern int hex_to_bin(unsigned char ch);
1522 + extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
1523 + extern char *bin2hex(char *dst, const void *src, size_t count);
1524 +
1525 +diff --git a/include/net/tcp.h b/include/net/tcp.h
1526 +index f26f075250b48..97df2f6fcbd79 100644
1527 +--- a/include/net/tcp.h
1528 ++++ b/include/net/tcp.h
1529 +@@ -579,6 +579,7 @@ void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req);
1530 + void tcp_reset(struct sock *sk);
1531 + void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb);
1532 + void tcp_fin(struct sock *sk);
1533 ++void tcp_check_space(struct sock *sk);
1534 +
1535 + /* tcp_timer.c */
1536 + void tcp_init_xmit_timers(struct sock *);
1537 +diff --git a/lib/hexdump.c b/lib/hexdump.c
1538 +index 992457b1284c1..570b232757047 100644
1539 +--- a/lib/hexdump.c
1540 ++++ b/lib/hexdump.c
1541 +@@ -24,15 +24,33 @@ EXPORT_SYMBOL(hex_asc_upper);
1542 + *
1543 + * hex_to_bin() converts one hex digit to its actual value or -1 in case of bad
1544 + * input.
1545 ++ *
1546 ++ * This function is used to load cryptographic keys, so it is coded in such a
1547 ++ * way that there are no conditions or memory accesses that depend on data.
1548 ++ *
1549 ++ * Explanation of the logic:
1550 ++ * (ch - '9' - 1) is negative if ch <= '9'
1551 ++ * ('0' - 1 - ch) is negative if ch >= '0'
1552 ++ * we "and" these two values, so the result is negative if ch is in the range
1553 ++ * '0' ... '9'
1554 ++ * we are only interested in the sign, so we do a shift ">> 8"; note that right
1555 ++ * shift of a negative value is implementation-defined, so we cast the
1556 ++ * value to (unsigned) before the shift --- we have 0xffffff if ch is in
1557 ++ * the range '0' ... '9', 0 otherwise
1558 ++ * we "and" this value with (ch - '0' + 1) --- we have a value 1 ... 10 if ch is
1559 ++ * in the range '0' ... '9', 0 otherwise
1560 ++ * we add this value to -1 --- we have a value 0 ... 9 if ch is in the range '0'
1561 ++ * ... '9', -1 otherwise
1562 ++ * the next line is similar to the previous one, but we need to decode both
1563 ++ * uppercase and lowercase letters, so we use (ch & 0xdf), which converts
1564 ++ * lowercase to uppercase
1565 + */
1566 +-int hex_to_bin(char ch)
1567 ++int hex_to_bin(unsigned char ch)
1568 + {
1569 +- if ((ch >= '0') && (ch <= '9'))
1570 +- return ch - '0';
1571 +- ch = tolower(ch);
1572 +- if ((ch >= 'a') && (ch <= 'f'))
1573 +- return ch - 'a' + 10;
1574 +- return -1;
1575 ++ unsigned char cu = ch & 0xdf;
1576 ++ return -1 +
1577 ++ ((ch - '0' + 1) & (unsigned)((ch - '9' - 1) & ('0' - 1 - ch)) >> 8) +
1578 ++ ((cu - 'A' + 11) & (unsigned)((cu - 'F' - 1) & ('A' - 1 - cu)) >> 8);
1579 + }
1580 + EXPORT_SYMBOL(hex_to_bin);
1581 +
1582 +@@ -47,10 +65,13 @@ EXPORT_SYMBOL(hex_to_bin);
1583 + int hex2bin(u8 *dst, const char *src, size_t count)
1584 + {
1585 + while (count--) {
1586 +- int hi = hex_to_bin(*src++);
1587 +- int lo = hex_to_bin(*src++);
1588 ++ int hi, lo;
1589 +
1590 +- if ((hi < 0) || (lo < 0))
1591 ++ hi = hex_to_bin(*src++);
1592 ++ if (unlikely(hi < 0))
1593 ++ return -1;
1594 ++ lo = hex_to_bin(*src++);
1595 ++ if (unlikely(lo < 0))
1596 + return -1;
1597 +
1598 + *dst++ = (hi << 4) | lo;
1599 +diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
1600 +index 381fc854ad199..75f961425639e 100644
1601 +--- a/net/ipv4/igmp.c
1602 ++++ b/net/ipv4/igmp.c
1603 +@@ -2360,9 +2360,10 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
1604 + newpsl->sl_addr[i] = psl->sl_addr[i];
1605 + /* decrease mem now to avoid the memleak warning */
1606 + atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
1607 +- kfree_rcu(psl, rcu);
1608 + }
1609 + rcu_assign_pointer(pmc->sflist, newpsl);
1610 ++ if (psl)
1611 ++ kfree_rcu(psl, rcu);
1612 + psl = newpsl;
1613 + }
1614 + rv = 1; /* > 0 for insert logic below if sl_count is 0 */
1615 +@@ -2460,11 +2461,13 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex)
1616 + psl->sl_count, psl->sl_addr, 0);
1617 + /* decrease mem now to avoid the memleak warning */
1618 + atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
1619 +- kfree_rcu(psl, rcu);
1620 +- } else
1621 ++ } else {
1622 + (void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode,
1623 + 0, NULL, 0);
1624 ++ }
1625 + rcu_assign_pointer(pmc->sflist, newpsl);
1626 ++ if (psl)
1627 ++ kfree_rcu(psl, rcu);
1628 + pmc->sfmode = msf->imsf_fmode;
1629 + err = 0;
1630 + done:
1631 +diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
1632 +index fe1801d9f0598..eec225c637f05 100644
1633 +--- a/net/ipv4/ip_gre.c
1634 ++++ b/net/ipv4/ip_gre.c
1635 +@@ -339,14 +339,12 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev,
1636 + __be16 proto)
1637 + {
1638 + struct ip_tunnel *tunnel = netdev_priv(dev);
1639 +-
1640 +- if (tunnel->parms.o_flags & TUNNEL_SEQ)
1641 +- tunnel->o_seqno++;
1642 ++ __be16 flags = tunnel->parms.o_flags;
1643 +
1644 + /* Push GRE header. */
1645 + gre_build_header(skb, tunnel->tun_hlen,
1646 +- tunnel->parms.o_flags, proto, tunnel->parms.o_key,
1647 +- htonl(tunnel->o_seqno));
1648 ++ flags, proto, tunnel->parms.o_key,
1649 ++ (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0);
1650 +
1651 + ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol);
1652 + }
1653 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
1654 +index 01c73775ed007..7f48f85042843 100644
1655 +--- a/net/ipv4/tcp_input.c
1656 ++++ b/net/ipv4/tcp_input.c
1657 +@@ -5159,7 +5159,17 @@ static void tcp_new_space(struct sock *sk)
1658 + sk->sk_write_space(sk);
1659 + }
1660 +
1661 +-static void tcp_check_space(struct sock *sk)
1662 ++/* Caller made space either from:
1663 ++ * 1) Freeing skbs in rtx queues (after tp->snd_una has advanced)
1664 ++ * 2) Sent skbs from output queue (and thus advancing tp->snd_nxt)
1665 ++ *
1666 ++ * We might be able to generate EPOLLOUT to the application if:
1667 ++ * 1) Space consumed in output/rtx queues is below sk->sk_sndbuf/2
1668 ++ * 2) notsent amount (tp->write_seq - tp->snd_nxt) became
1669 ++ * small enough that tcp_stream_memory_free() decides it
1670 ++ * is time to generate EPOLLOUT.
1671 ++ */
1672 ++void tcp_check_space(struct sock *sk)
1673 + {
1674 + if (sock_flag(sk, SOCK_QUEUE_SHRUNK)) {
1675 + sock_reset_flag(sk, SOCK_QUEUE_SHRUNK);
1676 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
1677 +index aafea53c7c068..95b0f486cb105 100644
1678 +--- a/net/ipv4/tcp_output.c
1679 ++++ b/net/ipv4/tcp_output.c
1680 +@@ -83,6 +83,7 @@ static void tcp_event_new_data_sent(struct sock *sk, const struct sk_buff *skb)
1681 +
1682 + NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPORIGDATASENT,
1683 + tcp_skb_pcount(skb));
1684 ++ tcp_check_space(sk);
1685 + }
1686 +
1687 + /* SND.NXT, if window was not shrunk.
1688 +diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
1689 +index 6119ab33a56ea..30ca73c781253 100644
1690 +--- a/net/ipv6/addrconf.c
1691 ++++ b/net/ipv6/addrconf.c
1692 +@@ -3539,6 +3539,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
1693 + struct list_head del_list;
1694 + int _keep_addr;
1695 + bool keep_addr;
1696 ++ bool was_ready;
1697 + int state, i;
1698 +
1699 + ASSERT_RTNL();
1700 +@@ -3602,7 +3603,10 @@ restart:
1701 +
1702 + addrconf_del_rs_timer(idev);
1703 +
1704 +- /* Step 2: clear flags for stateless addrconf */
1705 ++ /* Step 2: clear flags for stateless addrconf, repeated down
1706 ++ * detection
1707 ++ */
1708 ++ was_ready = idev->if_flags & IF_READY;
1709 + if (!how)
1710 + idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY);
1711 +
1712 +@@ -3689,7 +3693,7 @@ restart:
1713 + if (how) {
1714 + ipv6_ac_destroy_dev(idev);
1715 + ipv6_mc_destroy_dev(idev);
1716 +- } else {
1717 ++ } else if (was_ready) {
1718 + ipv6_mc_down(idev);
1719 + }
1720 +
1721 +diff --git a/net/nfc/core.c b/net/nfc/core.c
1722 +index 32a2dfc08f480..8c38a21fb0c69 100644
1723 +--- a/net/nfc/core.c
1724 ++++ b/net/nfc/core.c
1725 +@@ -50,7 +50,7 @@ int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name)
1726 +
1727 + device_lock(&dev->dev);
1728 +
1729 +- if (!device_is_registered(&dev->dev)) {
1730 ++ if (dev->shutting_down) {
1731 + rc = -ENODEV;
1732 + goto error;
1733 + }
1734 +@@ -106,7 +106,7 @@ int nfc_dev_up(struct nfc_dev *dev)
1735 +
1736 + device_lock(&dev->dev);
1737 +
1738 +- if (!device_is_registered(&dev->dev)) {
1739 ++ if (dev->shutting_down) {
1740 + rc = -ENODEV;
1741 + goto error;
1742 + }
1743 +@@ -154,7 +154,7 @@ int nfc_dev_down(struct nfc_dev *dev)
1744 +
1745 + device_lock(&dev->dev);
1746 +
1747 +- if (!device_is_registered(&dev->dev)) {
1748 ++ if (dev->shutting_down) {
1749 + rc = -ENODEV;
1750 + goto error;
1751 + }
1752 +@@ -218,7 +218,7 @@ int nfc_start_poll(struct nfc_dev *dev, u32 im_protocols, u32 tm_protocols)
1753 +
1754 + device_lock(&dev->dev);
1755 +
1756 +- if (!device_is_registered(&dev->dev)) {
1757 ++ if (dev->shutting_down) {
1758 + rc = -ENODEV;
1759 + goto error;
1760 + }
1761 +@@ -257,7 +257,7 @@ int nfc_stop_poll(struct nfc_dev *dev)
1762 +
1763 + device_lock(&dev->dev);
1764 +
1765 +- if (!device_is_registered(&dev->dev)) {
1766 ++ if (dev->shutting_down) {
1767 + rc = -ENODEV;
1768 + goto error;
1769 + }
1770 +@@ -302,7 +302,7 @@ int nfc_dep_link_up(struct nfc_dev *dev, int target_index, u8 comm_mode)
1771 +
1772 + device_lock(&dev->dev);
1773 +
1774 +- if (!device_is_registered(&dev->dev)) {
1775 ++ if (dev->shutting_down) {
1776 + rc = -ENODEV;
1777 + goto error;
1778 + }
1779 +@@ -346,7 +346,7 @@ int nfc_dep_link_down(struct nfc_dev *dev)
1780 +
1781 + device_lock(&dev->dev);
1782 +
1783 +- if (!device_is_registered(&dev->dev)) {
1784 ++ if (dev->shutting_down) {
1785 + rc = -ENODEV;
1786 + goto error;
1787 + }
1788 +@@ -412,7 +412,7 @@ int nfc_activate_target(struct nfc_dev *dev, u32 target_idx, u32 protocol)
1789 +
1790 + device_lock(&dev->dev);
1791 +
1792 +- if (!device_is_registered(&dev->dev)) {
1793 ++ if (dev->shutting_down) {
1794 + rc = -ENODEV;
1795 + goto error;
1796 + }
1797 +@@ -458,7 +458,7 @@ int nfc_deactivate_target(struct nfc_dev *dev, u32 target_idx, u8 mode)
1798 +
1799 + device_lock(&dev->dev);
1800 +
1801 +- if (!device_is_registered(&dev->dev)) {
1802 ++ if (dev->shutting_down) {
1803 + rc = -ENODEV;
1804 + goto error;
1805 + }
1806 +@@ -505,7 +505,7 @@ int nfc_data_exchange(struct nfc_dev *dev, u32 target_idx, struct sk_buff *skb,
1807 +
1808 + device_lock(&dev->dev);
1809 +
1810 +- if (!device_is_registered(&dev->dev)) {
1811 ++ if (dev->shutting_down) {
1812 + rc = -ENODEV;
1813 + kfree_skb(skb);
1814 + goto error;
1815 +@@ -562,7 +562,7 @@ int nfc_enable_se(struct nfc_dev *dev, u32 se_idx)
1816 +
1817 + device_lock(&dev->dev);
1818 +
1819 +- if (!device_is_registered(&dev->dev)) {
1820 ++ if (dev->shutting_down) {
1821 + rc = -ENODEV;
1822 + goto error;
1823 + }
1824 +@@ -611,7 +611,7 @@ int nfc_disable_se(struct nfc_dev *dev, u32 se_idx)
1825 +
1826 + device_lock(&dev->dev);
1827 +
1828 +- if (!device_is_registered(&dev->dev)) {
1829 ++ if (dev->shutting_down) {
1830 + rc = -ENODEV;
1831 + goto error;
1832 + }
1833 +@@ -1142,6 +1142,7 @@ int nfc_register_device(struct nfc_dev *dev)
1834 + dev->rfkill = NULL;
1835 + }
1836 + }
1837 ++ dev->shutting_down = false;
1838 + device_unlock(&dev->dev);
1839 +
1840 + rc = nfc_genl_device_added(dev);
1841 +@@ -1174,12 +1175,10 @@ void nfc_unregister_device(struct nfc_dev *dev)
1842 + rfkill_unregister(dev->rfkill);
1843 + rfkill_destroy(dev->rfkill);
1844 + }
1845 ++ dev->shutting_down = true;
1846 + device_unlock(&dev->dev);
1847 +
1848 + if (dev->ops->check_presence) {
1849 +- device_lock(&dev->dev);
1850 +- dev->shutting_down = true;
1851 +- device_unlock(&dev->dev);
1852 + del_timer_sync(&dev->check_pres_timer);
1853 + cancel_work_sync(&dev->check_pres_work);
1854 + }
1855 +diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
1856 +index 6e771022d43e1..9750997643bba 100644
1857 +--- a/net/nfc/netlink.c
1858 ++++ b/net/nfc/netlink.c
1859 +@@ -1254,7 +1254,7 @@ int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name,
1860 + struct sk_buff *msg;
1861 + void *hdr;
1862 +
1863 +- msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
1864 ++ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
1865 + if (!msg)
1866 + return -ENOMEM;
1867 +
1868 +@@ -1270,7 +1270,7 @@ int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name,
1869 +
1870 + genlmsg_end(msg, hdr);
1871 +
1872 +- genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL);
1873 ++ genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC);
1874 +
1875 + return 0;
1876 +
1877 +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
1878 +index c1a4b5d30814a..330a2c9d19074 100644
1879 +--- a/net/sched/cls_api.c
1880 ++++ b/net/sched/cls_api.c
1881 +@@ -268,10 +268,13 @@ replay:
1882 + err = -ENOENT;
1883 + tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND]);
1884 + if (tp_ops == NULL) {
1885 +-#ifdef CONFIG_MODULES
1886 + struct nlattr *kind = tca[TCA_KIND];
1887 + char name[IFNAMSIZ];
1888 +
1889 ++ if (cl)
1890 ++ cops->put(q, cl);
1891 ++ cl = 0;
1892 ++#ifdef CONFIG_MODULES
1893 + if (kind != NULL &&
1894 + nla_strlcpy(name, kind, IFNAMSIZ) < IFNAMSIZ) {
1895 + rtnl_unlock();
1896 +diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
1897 +index bf20ea2606389..4e2c49cb692c8 100644
1898 +--- a/net/sunrpc/xprtsock.c
1899 ++++ b/net/sunrpc/xprtsock.c
1900 +@@ -2882,9 +2882,6 @@ static struct rpc_xprt *xs_setup_local(struct xprt_create *args)
1901 + }
1902 + xprt_set_bound(xprt);
1903 + xs_format_peer_addresses(xprt, "local", RPCBIND_NETID_LOCAL);
1904 +- ret = ERR_PTR(xs_local_setup_socket(transport));
1905 +- if (ret)
1906 +- goto out_err;
1907 + break;
1908 + default:
1909 + ret = ERR_PTR(-EAFNOSUPPORT);
1910 +diff --git a/sound/firewire/fireworks/fireworks_hwdep.c b/sound/firewire/fireworks/fireworks_hwdep.c
1911 +index 2e1d9a23920c0..09ba61f60699b 100644
1912 +--- a/sound/firewire/fireworks/fireworks_hwdep.c
1913 ++++ b/sound/firewire/fireworks/fireworks_hwdep.c
1914 +@@ -35,6 +35,7 @@ hwdep_read_resp_buf(struct snd_efw *efw, char __user *buf, long remained,
1915 + type = SNDRV_FIREWIRE_EVENT_EFW_RESPONSE;
1916 + if (copy_to_user(buf, &type, sizeof(type)))
1917 + return -EFAULT;
1918 ++ count += sizeof(type);
1919 + remained -= sizeof(type);
1920 + buf += sizeof(type);
1921 +
1922 +diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
1923 +index 4f9a1eb281204..abe5e77ba171b 100644
1924 +--- a/sound/soc/codecs/wm8731.c
1925 ++++ b/sound/soc/codecs/wm8731.c
1926 +@@ -604,7 +604,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
1927 + ret = wm8731_reset(wm8731->regmap);
1928 + if (ret < 0) {
1929 + dev_err(dev, "Failed to issue reset: %d\n", ret);
1930 +- goto err_regulator_enable;
1931 ++ goto err;
1932 + }
1933 +
1934 + /* Clear POWEROFF, keep everything else disabled */
1935 +@@ -621,10 +621,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
1936 +
1937 + regcache_mark_dirty(wm8731->regmap);
1938 +
1939 +-err_regulator_enable:
1940 +- /* Regulators will be enabled by bias management */
1941 +- regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
1942 +-
1943 ++err:
1944 + return ret;
1945 + }
1946 +
1947 +@@ -768,21 +765,27 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
1948 + ret = PTR_ERR(wm8731->regmap);
1949 + dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
1950 + ret);
1951 +- return ret;
1952 ++ goto err_regulator_enable;
1953 + }
1954 +
1955 + ret = wm8731_hw_init(&i2c->dev, wm8731);
1956 + if (ret != 0)
1957 +- return ret;
1958 ++ goto err_regulator_enable;
1959 +
1960 + ret = snd_soc_register_codec(&i2c->dev,
1961 + &soc_codec_dev_wm8731, &wm8731_dai, 1);
1962 + if (ret != 0) {
1963 + dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
1964 +- return ret;
1965 ++ goto err_regulator_enable;
1966 + }
1967 +
1968 + return 0;
1969 ++
1970 ++err_regulator_enable:
1971 ++ /* Regulators will be enabled by bias management */
1972 ++ regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
1973 ++
1974 ++ return ret;
1975 + }
1976 +
1977 + static int wm8731_i2c_remove(struct i2c_client *client)
1978 +diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c
1979 +index 6b864c0fc2b67..fa803cef23245 100644
1980 +--- a/sound/soc/codecs/wm8958-dsp2.c
1981 ++++ b/sound/soc/codecs/wm8958-dsp2.c
1982 +@@ -533,7 +533,7 @@ static int wm8958_mbc_put(struct snd_kcontrol *kcontrol,
1983 +
1984 + wm8958_dsp_apply(codec, mbc, wm8994->mbc_ena[mbc]);
1985 +
1986 +- return 0;
1987 ++ return 1;
1988 + }
1989 +
1990 + #define WM8958_MBC_SWITCH(xname, xval) {\
1991 +@@ -659,7 +659,7 @@ static int wm8958_vss_put(struct snd_kcontrol *kcontrol,
1992 +
1993 + wm8958_dsp_apply(codec, vss, wm8994->vss_ena[vss]);
1994 +
1995 +- return 0;
1996 ++ return 1;
1997 + }
1998 +
1999 +
2000 +@@ -733,7 +733,7 @@ static int wm8958_hpf_put(struct snd_kcontrol *kcontrol,
2001 +
2002 + wm8958_dsp_apply(codec, hpf % 3, ucontrol->value.integer.value[0]);
2003 +
2004 +- return 0;
2005 ++ return 1;
2006 + }
2007 +
2008 + #define WM8958_HPF_SWITCH(xname, xval) {\
2009 +@@ -827,7 +827,7 @@ static int wm8958_enh_eq_put(struct snd_kcontrol *kcontrol,
2010 +
2011 + wm8958_dsp_apply(codec, eq, ucontrol->value.integer.value[0]);
2012 +
2013 +- return 0;
2014 ++ return 1;
2015 + }
2016 +
2017 + #define WM8958_ENH_EQ_SWITCH(xname, xval) {\
2018 +diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
2019 +index 61f0c9d6f6dce..67d22b4baeb05 100644
2020 +--- a/sound/soc/soc-generic-dmaengine-pcm.c
2021 ++++ b/sound/soc/soc-generic-dmaengine-pcm.c
2022 +@@ -98,10 +98,10 @@ static int dmaengine_pcm_hw_params(struct snd_pcm_substream *substream,
2023 +
2024 + memset(&slave_config, 0, sizeof(slave_config));
2025 +
2026 +- if (pcm->config && pcm->config->prepare_slave_config)
2027 +- prepare_slave_config = pcm->config->prepare_slave_config;
2028 +- else
2029 ++ if (!pcm->config)
2030 + prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
2031 ++ else
2032 ++ prepare_slave_config = pcm->config->prepare_slave_config;
2033 +
2034 + if (prepare_slave_config) {
2035 + ret = prepare_slave_config(substream, params, &slave_config);