Gentoo Archives: gentoo-commits

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