Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.7 commit in: /
Date: Sat, 08 Oct 2016 11:37:58
Message-Id: 1475926532.62792f42f1f905a8040f299e7ad492de6b237028.alicef@gentoo
1 commit: 62792f42f1f905a8040f299e7ad492de6b237028
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 8 11:35:32 2016 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 8 11:35:32 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=62792f42
7
8 Linux patch 4.7.7.
9
10 0000_README | 4 +
11 1006_linux-4.7.7.patch | 3811 ++++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 3815 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 87048e9..01abfe8 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -67,6 +67,10 @@ Patch: 1005_linux-4.7.6.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.7.6
21
22 +Patch: 1006_linux-4.7.7.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.7.7
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1006_linux-4.7.7.patch b/1006_linux-4.7.7.patch
31 new file mode 100644
32 index 0000000..3bee058
33 --- /dev/null
34 +++ b/1006_linux-4.7.7.patch
35 @@ -0,0 +1,3811 @@
36 +diff --git a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
37 +index 46c6f3ed1a1c..0fa3b0fac129 100644
38 +--- a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
39 ++++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
40 +@@ -113,9 +113,9 @@ pm8916:
41 + l14, l15, l16, l17, l18
42 +
43 + pm8941:
44 +- s1, s2, s3, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14,
45 +- l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3,
46 +- mvs1, mvs2
47 ++ s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,
48 ++ l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3,
49 ++ 5vs1, 5vs2
50 +
51 + pm8994:
52 + s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5,
53 +diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt
54 +index 4976389e432d..dd15a699ee1c 100644
55 +--- a/Documentation/pinctrl.txt
56 ++++ b/Documentation/pinctrl.txt
57 +@@ -831,7 +831,7 @@ separate memory range only intended for GPIO driving, and the register
58 + range dealing with pin config and pin multiplexing get placed into a
59 + different memory range and a separate section of the data sheet.
60 +
61 +-A flag "strict" in struct pinctrl_desc is available to check and deny
62 ++A flag "strict" in struct pinmux_ops is available to check and deny
63 + simultaneous access to the same pin from GPIO and pin multiplexing
64 + consumers on hardware of this type. The pinctrl driver should set this flag
65 + accordingly.
66 +diff --git a/Makefile b/Makefile
67 +index 48b0120be59b..320a9308470b 100644
68 +--- a/Makefile
69 ++++ b/Makefile
70 +@@ -1,6 +1,6 @@
71 + VERSION = 4
72 + PATCHLEVEL = 7
73 +-SUBLEVEL = 6
74 ++SUBLEVEL = 7
75 + EXTRAVERSION =
76 + NAME = Psychotic Stoned Sheep
77 +
78 +diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
79 +index af11c2f8f3b7..fc6d541549a2 100644
80 +--- a/arch/arm/boot/compressed/head.S
81 ++++ b/arch/arm/boot/compressed/head.S
82 +@@ -779,7 +779,7 @@ __armv7_mmu_cache_on:
83 + orrne r0, r0, #1 @ MMU enabled
84 + movne r1, #0xfffffffd @ domain 0 = client
85 + bic r6, r6, #1 << 31 @ 32-bit translation system
86 +- bic r6, r6, #3 << 0 @ use only ttbr0
87 ++ bic r6, r6, #(7 << 0) | (1 << 4) @ use only ttbr0
88 + mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer
89 + mcrne p15, 0, r1, c3, c0, 0 @ load domain access control
90 + mcrne p15, 0, r6, c2, c0, 2 @ load ttb control
91 +diff --git a/arch/arm/boot/dts/imx6sx-sabreauto.dts b/arch/arm/boot/dts/imx6sx-sabreauto.dts
92 +index 96ea936eeeb0..240a2864d044 100644
93 +--- a/arch/arm/boot/dts/imx6sx-sabreauto.dts
94 ++++ b/arch/arm/boot/dts/imx6sx-sabreauto.dts
95 +@@ -64,7 +64,7 @@
96 + cd-gpios = <&gpio7 11 GPIO_ACTIVE_LOW>;
97 + no-1-8-v;
98 + keep-power-in-suspend;
99 +- enable-sdio-wakup;
100 ++ wakeup-source;
101 + status = "okay";
102 + };
103 +
104 +diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
105 +index 263d46dbc7e6..2d78eee7cb55 100644
106 +--- a/arch/arm/boot/dts/sun5i-a13.dtsi
107 ++++ b/arch/arm/boot/dts/sun5i-a13.dtsi
108 +@@ -84,7 +84,7 @@
109 + trips {
110 + cpu_alert0: cpu_alert0 {
111 + /* milliCelsius */
112 +- temperature = <850000>;
113 ++ temperature = <85000>;
114 + hysteresis = <2000>;
115 + type = "passive";
116 + };
117 +diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
118 +index fb0a0a4dfea4..0e437189b095 100644
119 +--- a/arch/arm/common/sa1111.c
120 ++++ b/arch/arm/common/sa1111.c
121 +@@ -869,9 +869,9 @@ struct sa1111_save_data {
122 +
123 + #ifdef CONFIG_PM
124 +
125 +-static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
126 ++static int sa1111_suspend_noirq(struct device *dev)
127 + {
128 +- struct sa1111 *sachip = platform_get_drvdata(dev);
129 ++ struct sa1111 *sachip = dev_get_drvdata(dev);
130 + struct sa1111_save_data *save;
131 + unsigned long flags;
132 + unsigned int val;
133 +@@ -934,9 +934,9 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
134 + * restored by their respective drivers, and must be called
135 + * via LDM after this function.
136 + */
137 +-static int sa1111_resume(struct platform_device *dev)
138 ++static int sa1111_resume_noirq(struct device *dev)
139 + {
140 +- struct sa1111 *sachip = platform_get_drvdata(dev);
141 ++ struct sa1111 *sachip = dev_get_drvdata(dev);
142 + struct sa1111_save_data *save;
143 + unsigned long flags, id;
144 + void __iomem *base;
145 +@@ -952,7 +952,7 @@ static int sa1111_resume(struct platform_device *dev)
146 + id = sa1111_readl(sachip->base + SA1111_SKID);
147 + if ((id & SKID_ID_MASK) != SKID_SA1111_ID) {
148 + __sa1111_remove(sachip);
149 +- platform_set_drvdata(dev, NULL);
150 ++ dev_set_drvdata(dev, NULL);
151 + kfree(save);
152 + return 0;
153 + }
154 +@@ -1003,8 +1003,8 @@ static int sa1111_resume(struct platform_device *dev)
155 + }
156 +
157 + #else
158 +-#define sa1111_suspend NULL
159 +-#define sa1111_resume NULL
160 ++#define sa1111_suspend_noirq NULL
161 ++#define sa1111_resume_noirq NULL
162 + #endif
163 +
164 + static int sa1111_probe(struct platform_device *pdev)
165 +@@ -1038,6 +1038,11 @@ static int sa1111_remove(struct platform_device *pdev)
166 + return 0;
167 + }
168 +
169 ++static struct dev_pm_ops sa1111_pm_ops = {
170 ++ .suspend_noirq = sa1111_suspend_noirq,
171 ++ .resume_noirq = sa1111_resume_noirq,
172 ++};
173 ++
174 + /*
175 + * Not sure if this should be on the system bus or not yet.
176 + * We really want some way to register a system device at
177 +@@ -1050,10 +1055,9 @@ static int sa1111_remove(struct platform_device *pdev)
178 + static struct platform_driver sa1111_device_driver = {
179 + .probe = sa1111_probe,
180 + .remove = sa1111_remove,
181 +- .suspend = sa1111_suspend,
182 +- .resume = sa1111_resume,
183 + .driver = {
184 + .name = "sa1111",
185 ++ .pm = &sa1111_pm_ops,
186 + },
187 + };
188 +
189 +diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
190 +index a83570f10124..8ec98fc4eb2a 100644
191 +--- a/arch/arm/include/asm/dma-mapping.h
192 ++++ b/arch/arm/include/asm/dma-mapping.h
193 +@@ -112,7 +112,7 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
194 + /* The ARM override for dma_max_pfn() */
195 + static inline unsigned long dma_max_pfn(struct device *dev)
196 + {
197 +- return PHYS_PFN_OFFSET + dma_to_pfn(dev, *dev->dma_mask);
198 ++ return dma_to_pfn(dev, *dev->dma_mask);
199 + }
200 + #define dma_max_pfn(dev) dma_max_pfn(dev)
201 +
202 +diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
203 +index 2e26016a91a5..5204978ec4fa 100644
204 +--- a/arch/arm/kernel/devtree.c
205 ++++ b/arch/arm/kernel/devtree.c
206 +@@ -87,6 +87,8 @@ void __init arm_dt_init_cpu_maps(void)
207 + return;
208 +
209 + for_each_child_of_node(cpus, cpu) {
210 ++ const __be32 *cell;
211 ++ int prop_bytes;
212 + u32 hwid;
213 +
214 + if (of_node_cmp(cpu->type, "cpu"))
215 +@@ -98,7 +100,8 @@ void __init arm_dt_init_cpu_maps(void)
216 + * properties is considered invalid to build the
217 + * cpu_logical_map.
218 + */
219 +- if (of_property_read_u32(cpu, "reg", &hwid)) {
220 ++ cell = of_get_property(cpu, "reg", &prop_bytes);
221 ++ if (!cell || prop_bytes < sizeof(*cell)) {
222 + pr_debug(" * %s missing reg property\n",
223 + cpu->full_name);
224 + of_node_put(cpu);
225 +@@ -106,10 +109,15 @@ void __init arm_dt_init_cpu_maps(void)
226 + }
227 +
228 + /*
229 +- * 8 MSBs must be set to 0 in the DT since the reg property
230 ++ * Bits n:24 must be set to 0 in the DT since the reg property
231 + * defines the MPIDR[23:0].
232 + */
233 +- if (hwid & ~MPIDR_HWID_BITMASK) {
234 ++ do {
235 ++ hwid = be32_to_cpu(*cell++);
236 ++ prop_bytes -= sizeof(*cell);
237 ++ } while (!hwid && prop_bytes > 0);
238 ++
239 ++ if (prop_bytes || (hwid & ~MPIDR_HWID_BITMASK)) {
240 + of_node_put(cpu);
241 + return;
242 + }
243 +diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
244 +index cbf53bb9c814..0db46895c82a 100644
245 +--- a/arch/arm/mach-sa1100/clock.c
246 ++++ b/arch/arm/mach-sa1100/clock.c
247 +@@ -125,6 +125,8 @@ static unsigned long clk_36864_get_rate(struct clk *clk)
248 + }
249 +
250 + static struct clkops clk_36864_ops = {
251 ++ .enable = clk_cpu_enable,
252 ++ .disable = clk_cpu_disable,
253 + .get_rate = clk_36864_get_rate,
254 + };
255 +
256 +@@ -140,9 +142,8 @@ static struct clk_lookup sa11xx_clkregs[] = {
257 + CLKDEV_INIT(NULL, "OSTIMER0", &clk_36864),
258 + };
259 +
260 +-static int __init sa11xx_clk_init(void)
261 ++int __init sa11xx_clk_init(void)
262 + {
263 + clkdev_add_table(sa11xx_clkregs, ARRAY_SIZE(sa11xx_clkregs));
264 + return 0;
265 + }
266 +-core_initcall(sa11xx_clk_init);
267 +diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
268 +index 345e63f4eb71..3e09beddb6e8 100644
269 +--- a/arch/arm/mach-sa1100/generic.c
270 ++++ b/arch/arm/mach-sa1100/generic.c
271 +@@ -34,6 +34,7 @@
272 +
273 + #include <mach/hardware.h>
274 + #include <mach/irqs.h>
275 ++#include <mach/reset.h>
276 +
277 + #include "generic.h"
278 + #include <clocksource/pxa.h>
279 +@@ -95,6 +96,8 @@ static void sa1100_power_off(void)
280 +
281 + void sa11x0_restart(enum reboot_mode mode, const char *cmd)
282 + {
283 ++ clear_reset_status(RESET_STATUS_ALL);
284 ++
285 + if (mode == REBOOT_SOFT) {
286 + /* Jump into ROM at address 0 */
287 + soft_restart(0);
288 +@@ -388,6 +391,7 @@ void __init sa1100_init_irq(void)
289 + sa11x0_init_irq_nodt(IRQ_GPIO0_SC, irq_resource.start);
290 +
291 + sa1100_init_gpio();
292 ++ sa11xx_clk_init();
293 + }
294 +
295 + /*
296 +diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
297 +index 0d92e119b36b..68199b603ff7 100644
298 +--- a/arch/arm/mach-sa1100/generic.h
299 ++++ b/arch/arm/mach-sa1100/generic.h
300 +@@ -44,3 +44,5 @@ int sa11x0_pm_init(void);
301 + #else
302 + static inline int sa11x0_pm_init(void) { return 0; }
303 + #endif
304 ++
305 ++int sa11xx_clk_init(void);
306 +diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
307 +index 62437b57813e..73e3adbc1330 100644
308 +--- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
309 ++++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
310 +@@ -41,39 +41,26 @@
311 +
312 + #define REGULATOR_IRQ_MASK BIT(2) /* IRQ2, active low */
313 +
314 +-static void __iomem *irqc;
315 +-
316 +-static const u8 da9063_mask_regs[] = {
317 +- DA9063_REG_IRQ_MASK_A,
318 +- DA9063_REG_IRQ_MASK_B,
319 +- DA9063_REG_IRQ_MASK_C,
320 +- DA9063_REG_IRQ_MASK_D,
321 +-};
322 +-
323 +-/* DA9210 System Control and Event Registers */
324 ++/* start of DA9210 System Control and Event Registers */
325 + #define DA9210_REG_MASK_A 0x54
326 +-#define DA9210_REG_MASK_B 0x55
327 +-
328 +-static const u8 da9210_mask_regs[] = {
329 +- DA9210_REG_MASK_A,
330 +- DA9210_REG_MASK_B,
331 +-};
332 +-
333 +-static void da9xxx_mask_irqs(struct i2c_client *client, const u8 regs[],
334 +- unsigned int nregs)
335 +-{
336 +- unsigned int i;
337 +
338 +- dev_info(&client->dev, "Masking %s interrupt sources\n", client->name);
339 ++static void __iomem *irqc;
340 +
341 +- for (i = 0; i < nregs; i++) {
342 +- int error = i2c_smbus_write_byte_data(client, regs[i], ~0);
343 +- if (error) {
344 +- dev_err(&client->dev, "i2c error %d\n", error);
345 +- return;
346 +- }
347 +- }
348 +-}
349 ++/* first byte sets the memory pointer, following are consecutive reg values */
350 ++static u8 da9063_irq_clr[] = { DA9063_REG_IRQ_MASK_A, 0xff, 0xff, 0xff, 0xff };
351 ++static u8 da9210_irq_clr[] = { DA9210_REG_MASK_A, 0xff, 0xff };
352 ++
353 ++static struct i2c_msg da9xxx_msgs[2] = {
354 ++ {
355 ++ .addr = 0x58,
356 ++ .len = ARRAY_SIZE(da9063_irq_clr),
357 ++ .buf = da9063_irq_clr,
358 ++ }, {
359 ++ .addr = 0x68,
360 ++ .len = ARRAY_SIZE(da9210_irq_clr),
361 ++ .buf = da9210_irq_clr,
362 ++ },
363 ++};
364 +
365 + static int regulator_quirk_notify(struct notifier_block *nb,
366 + unsigned long action, void *data)
367 +@@ -93,12 +80,15 @@ static int regulator_quirk_notify(struct notifier_block *nb,
368 + client = to_i2c_client(dev);
369 + dev_dbg(dev, "Detected %s\n", client->name);
370 +
371 +- if ((client->addr == 0x58 && !strcmp(client->name, "da9063")))
372 +- da9xxx_mask_irqs(client, da9063_mask_regs,
373 +- ARRAY_SIZE(da9063_mask_regs));
374 +- else if (client->addr == 0x68 && !strcmp(client->name, "da9210"))
375 +- da9xxx_mask_irqs(client, da9210_mask_regs,
376 +- ARRAY_SIZE(da9210_mask_regs));
377 ++ if ((client->addr == 0x58 && !strcmp(client->name, "da9063")) ||
378 ++ (client->addr == 0x68 && !strcmp(client->name, "da9210"))) {
379 ++ int ret;
380 ++
381 ++ dev_info(&client->dev, "clearing da9063/da9210 interrupts\n");
382 ++ ret = i2c_transfer(client->adapter, da9xxx_msgs, ARRAY_SIZE(da9xxx_msgs));
383 ++ if (ret != ARRAY_SIZE(da9xxx_msgs))
384 ++ dev_err(&client->dev, "i2c error %d\n", ret);
385 ++ }
386 +
387 + mon = ioread32(irqc + IRQC_MONITOR);
388 + if (mon & REGULATOR_IRQ_MASK)
389 +diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
390 +index 0800d23e2fdd..b463607bc816 100644
391 +--- a/arch/arm64/kernel/debug-monitors.c
392 ++++ b/arch/arm64/kernel/debug-monitors.c
393 +@@ -417,8 +417,10 @@ int kernel_active_single_step(void)
394 + /* ptrace API */
395 + void user_enable_single_step(struct task_struct *task)
396 + {
397 +- set_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP);
398 +- set_regs_spsr_ss(task_pt_regs(task));
399 ++ struct thread_info *ti = task_thread_info(task);
400 ++
401 ++ if (!test_and_set_ti_thread_flag(ti, TIF_SINGLESTEP))
402 ++ set_regs_spsr_ss(task_pt_regs(task));
403 + }
404 +
405 + void user_disable_single_step(struct task_struct *task)
406 +diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
407 +index 83c2a0021b56..13d3fc4270b7 100644
408 +--- a/arch/avr32/mach-at32ap/pio.c
409 ++++ b/arch/avr32/mach-at32ap/pio.c
410 +@@ -435,7 +435,7 @@ void __init at32_init_pio(struct platform_device *pdev)
411 + struct resource *regs;
412 + struct pio_device *pio;
413 +
414 +- if (pdev->id > MAX_NR_PIO_DEVICES) {
415 ++ if (pdev->id >= MAX_NR_PIO_DEVICES) {
416 + dev_err(&pdev->dev, "only %d PIO devices supported\n",
417 + MAX_NR_PIO_DEVICES);
418 + return;
419 +diff --git a/arch/mips/include/asm/uprobes.h b/arch/mips/include/asm/uprobes.h
420 +index 34c325c674c4..70a4a2f173ff 100644
421 +--- a/arch/mips/include/asm/uprobes.h
422 ++++ b/arch/mips/include/asm/uprobes.h
423 +@@ -36,7 +36,6 @@ struct arch_uprobe {
424 + unsigned long resume_epc;
425 + u32 insn[2];
426 + u32 ixol[2];
427 +- union mips_instruction orig_inst[MAX_UINSN_BYTES / 4];
428 + };
429 +
430 + struct arch_uprobe_task {
431 +diff --git a/arch/mips/kernel/uprobes.c b/arch/mips/kernel/uprobes.c
432 +index 8452d933a645..4e7b89f2e244 100644
433 +--- a/arch/mips/kernel/uprobes.c
434 ++++ b/arch/mips/kernel/uprobes.c
435 +@@ -157,7 +157,6 @@ bool is_trap_insn(uprobe_opcode_t *insn)
436 + int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs)
437 + {
438 + struct uprobe_task *utask = current->utask;
439 +- union mips_instruction insn;
440 +
441 + /*
442 + * Now find the EPC where to resume after the breakpoint has been
443 +@@ -168,10 +167,10 @@ int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs)
444 + unsigned long epc;
445 +
446 + epc = regs->cp0_epc;
447 +- __compute_return_epc_for_insn(regs, insn);
448 ++ __compute_return_epc_for_insn(regs,
449 ++ (union mips_instruction) aup->insn[0]);
450 + aup->resume_epc = regs->cp0_epc;
451 + }
452 +-
453 + utask->autask.saved_trap_nr = current->thread.trap_nr;
454 + current->thread.trap_nr = UPROBE_TRAP_NR;
455 + regs->cp0_epc = current->utask->xol_vaddr;
456 +@@ -257,7 +256,7 @@ unsigned long arch_uretprobe_hijack_return_addr(
457 + ra = regs->regs[31];
458 +
459 + /* Replace the return address with the trampoline address */
460 +- regs->regs[31] = ra;
461 ++ regs->regs[31] = trampoline_vaddr;
462 +
463 + return ra;
464 + }
465 +@@ -280,24 +279,6 @@ int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm,
466 + return uprobe_write_opcode(mm, vaddr, UPROBE_SWBP_INSN);
467 + }
468 +
469 +-/**
470 +- * set_orig_insn - Restore the original instruction.
471 +- * @mm: the probed process address space.
472 +- * @auprobe: arch specific probepoint information.
473 +- * @vaddr: the virtual address to insert the opcode.
474 +- *
475 +- * For mm @mm, restore the original opcode (opcode) at @vaddr.
476 +- * Return 0 (success) or a negative errno.
477 +- *
478 +- * This overrides the weak version in kernel/events/uprobes.c.
479 +- */
480 +-int set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm,
481 +- unsigned long vaddr)
482 +-{
483 +- return uprobe_write_opcode(mm, vaddr,
484 +- *(uprobe_opcode_t *)&auprobe->orig_inst[0].word);
485 +-}
486 +-
487 + void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
488 + void *src, unsigned long len)
489 + {
490 +diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
491 +index 33d5ff5069e5..18b37a573eb4 100644
492 +--- a/arch/mips/mti-malta/malta-setup.c
493 ++++ b/arch/mips/mti-malta/malta-setup.c
494 +@@ -39,6 +39,9 @@
495 + #include <linux/console.h>
496 + #endif
497 +
498 ++#define ROCIT_CONFIG_GEN0 0x1f403000
499 ++#define ROCIT_CONFIG_GEN0_PCI_IOCU BIT(7)
500 ++
501 + extern void malta_be_init(void);
502 + extern int malta_be_handler(struct pt_regs *regs, int is_fixup);
503 +
504 +@@ -107,6 +110,8 @@ static void __init fd_activate(void)
505 + static int __init plat_enable_iocoherency(void)
506 + {
507 + int supported = 0;
508 ++ u32 cfg;
509 ++
510 + if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
511 + if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
512 + BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
513 +@@ -129,7 +134,8 @@ static int __init plat_enable_iocoherency(void)
514 + } else if (mips_cm_numiocu() != 0) {
515 + /* Nothing special needs to be done to enable coherency */
516 + pr_info("CMP IOCU detected\n");
517 +- if ((*(unsigned int *)0xbf403000 & 0x81) != 0x81) {
518 ++ cfg = __raw_readl((u32 *)CKSEG1ADDR(ROCIT_CONFIG_GEN0));
519 ++ if (!(cfg & ROCIT_CONFIG_GEN0_PCI_IOCU)) {
520 + pr_crit("IOCU OPERATION DISABLED BY SWITCH - DEFAULTING TO SW IO COHERENCY\n");
521 + return 0;
522 + }
523 +diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
524 +index 6ee4b72cda42..e97925ffa6c7 100644
525 +--- a/arch/powerpc/kernel/prom_init.c
526 ++++ b/arch/powerpc/kernel/prom_init.c
527 +@@ -695,7 +695,7 @@ unsigned char ibm_architecture_vec[] = {
528 + OV4_MIN_ENT_CAP, /* minimum VP entitled capacity */
529 +
530 + /* option vector 5: PAPR/OF options */
531 +- VECTOR_LENGTH(18), /* length */
532 ++ VECTOR_LENGTH(21), /* length */
533 + 0, /* don't ignore, don't halt */
534 + OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) |
535 + OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) |
536 +@@ -726,8 +726,11 @@ unsigned char ibm_architecture_vec[] = {
537 + 0,
538 + 0,
539 + OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) |
540 +- OV5_FEAT(OV5_PFO_HW_842),
541 +- OV5_FEAT(OV5_SUB_PROCESSORS),
542 ++ OV5_FEAT(OV5_PFO_HW_842), /* Byte 17 */
543 ++ 0, /* Byte 18 */
544 ++ 0, /* Byte 19 */
545 ++ 0, /* Byte 20 */
546 ++ OV5_FEAT(OV5_SUB_PROCESSORS), /* Byte 21 */
547 +
548 + /* option vector 6: IBM PAPR hints */
549 + VECTOR_LENGTH(3), /* length */
550 +diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
551 +index c505d77e4d06..e9d54a06736f 100644
552 +--- a/arch/tile/include/asm/elf.h
553 ++++ b/arch/tile/include/asm/elf.h
554 +@@ -129,6 +129,7 @@ extern int dump_task_regs(struct task_struct *, elf_gregset_t *);
555 + struct linux_binprm;
556 + extern int arch_setup_additional_pages(struct linux_binprm *bprm,
557 + int executable_stack);
558 ++/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
559 + #define ARCH_DLINFO \
560 + do { \
561 + NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \
562 +diff --git a/arch/tile/include/uapi/asm/auxvec.h b/arch/tile/include/uapi/asm/auxvec.h
563 +index c93e92709f14..f497123ed980 100644
564 +--- a/arch/tile/include/uapi/asm/auxvec.h
565 ++++ b/arch/tile/include/uapi/asm/auxvec.h
566 +@@ -18,4 +18,6 @@
567 + /* The vDSO location. */
568 + #define AT_SYSINFO_EHDR 33
569 +
570 ++#define AT_VECTOR_SIZE_ARCH 1 /* entries in ARCH_DLINFO */
571 ++
572 + #endif /* _ASM_TILE_AUXVEC_H */
573 +diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
574 +index 6fa85944af83..dee8a70382ba 100644
575 +--- a/arch/x86/include/asm/tlbflush.h
576 ++++ b/arch/x86/include/asm/tlbflush.h
577 +@@ -81,7 +81,7 @@ DECLARE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate);
578 + /* Initialize cr4 shadow for this CPU. */
579 + static inline void cr4_init_shadow(void)
580 + {
581 +- this_cpu_write(cpu_tlbstate.cr4, __read_cr4());
582 ++ this_cpu_write(cpu_tlbstate.cr4, __read_cr4_safe());
583 + }
584 +
585 + /* Set in this cpu's CR4. */
586 +diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
587 +index 0fe6953f421c..41f3f7dd6323 100644
588 +--- a/arch/x86/kernel/cpu/common.c
589 ++++ b/arch/x86/kernel/cpu/common.c
590 +@@ -804,21 +804,20 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
591 + identify_cpu_without_cpuid(c);
592 +
593 + /* cyrix could have cpuid enabled via c_identify()*/
594 +- if (!have_cpuid_p())
595 +- return;
596 ++ if (have_cpuid_p()) {
597 ++ cpu_detect(c);
598 ++ get_cpu_vendor(c);
599 ++ get_cpu_cap(c);
600 +
601 +- cpu_detect(c);
602 +- get_cpu_vendor(c);
603 +- get_cpu_cap(c);
604 +-
605 +- if (this_cpu->c_early_init)
606 +- this_cpu->c_early_init(c);
607 ++ if (this_cpu->c_early_init)
608 ++ this_cpu->c_early_init(c);
609 +
610 +- c->cpu_index = 0;
611 +- filter_cpuid_features(c, false);
612 ++ c->cpu_index = 0;
613 ++ filter_cpuid_features(c, false);
614 +
615 +- if (this_cpu->c_bsp_init)
616 +- this_cpu->c_bsp_init(c);
617 ++ if (this_cpu->c_bsp_init)
618 ++ this_cpu->c_bsp_init(c);
619 ++ }
620 +
621 + setup_force_cpu_cap(X86_FEATURE_ALWAYS);
622 + fpu__init_system(c);
623 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
624 +index 8326d6891395..9ed64d2b9ab1 100644
625 +--- a/arch/x86/kvm/vmx.c
626 ++++ b/arch/x86/kvm/vmx.c
627 +@@ -409,6 +409,7 @@ struct nested_vmx {
628 + struct list_head vmcs02_pool;
629 + int vmcs02_num;
630 + u64 vmcs01_tsc_offset;
631 ++ bool change_vmcs01_virtual_x2apic_mode;
632 + /* L2 must run next, and mustn't decide to exit to L1. */
633 + bool nested_run_pending;
634 + /*
635 +@@ -8284,6 +8285,12 @@ static void vmx_set_virtual_x2apic_mode(struct kvm_vcpu *vcpu, bool set)
636 + {
637 + u32 sec_exec_control;
638 +
639 ++ /* Postpone execution until vmcs01 is the current VMCS. */
640 ++ if (is_guest_mode(vcpu)) {
641 ++ to_vmx(vcpu)->nested.change_vmcs01_virtual_x2apic_mode = true;
642 ++ return;
643 ++ }
644 ++
645 + /*
646 + * There is not point to enable virtualize x2apic without enable
647 + * apicv
648 +@@ -10601,6 +10608,12 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
649 + /* Update TSC_OFFSET if TSC was changed while L2 ran */
650 + vmcs_write64(TSC_OFFSET, vmx->nested.vmcs01_tsc_offset);
651 +
652 ++ if (vmx->nested.change_vmcs01_virtual_x2apic_mode) {
653 ++ vmx->nested.change_vmcs01_virtual_x2apic_mode = false;
654 ++ vmx_set_virtual_x2apic_mode(vcpu,
655 ++ vcpu->arch.apic_base & X2APIC_ENABLE);
656 ++ }
657 ++
658 + /* This is needed for same reason as it was needed in prepare_vmcs02 */
659 + vmx->host_rsp = 0;
660 +
661 +diff --git a/block/blk-mq.c b/block/blk-mq.c
662 +index f9b9049b1284..27dafb3a7a0e 100644
663 +--- a/block/blk-mq.c
664 ++++ b/block/blk-mq.c
665 +@@ -784,7 +784,7 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
666 + switch (ret) {
667 + case BLK_MQ_RQ_QUEUE_OK:
668 + queued++;
669 +- continue;
670 ++ break;
671 + case BLK_MQ_RQ_QUEUE_BUSY:
672 + list_add(&rq->queuelist, &rq_list);
673 + __blk_mq_requeue_request(rq);
674 +diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
675 +index aa56af87d941..b11af3f2c1db 100644
676 +--- a/drivers/base/regmap/regcache-rbtree.c
677 ++++ b/drivers/base/regmap/regcache-rbtree.c
678 +@@ -404,6 +404,7 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg,
679 + unsigned int new_base_reg, new_top_reg;
680 + unsigned int min, max;
681 + unsigned int max_dist;
682 ++ unsigned int dist, best_dist = UINT_MAX;
683 +
684 + max_dist = map->reg_stride * sizeof(*rbnode_tmp) /
685 + map->cache_word_size;
686 +@@ -423,24 +424,41 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg,
687 + &base_reg, &top_reg);
688 +
689 + if (base_reg <= max && top_reg >= min) {
690 +- new_base_reg = min(reg, base_reg);
691 +- new_top_reg = max(reg, top_reg);
692 +- } else {
693 +- if (max < base_reg)
694 +- node = node->rb_left;
695 ++ if (reg < base_reg)
696 ++ dist = base_reg - reg;
697 ++ else if (reg > top_reg)
698 ++ dist = reg - top_reg;
699 + else
700 +- node = node->rb_right;
701 +-
702 +- continue;
703 ++ dist = 0;
704 ++ if (dist < best_dist) {
705 ++ rbnode = rbnode_tmp;
706 ++ best_dist = dist;
707 ++ new_base_reg = min(reg, base_reg);
708 ++ new_top_reg = max(reg, top_reg);
709 ++ }
710 + }
711 +
712 +- ret = regcache_rbtree_insert_to_block(map, rbnode_tmp,
713 ++ /*
714 ++ * Keep looking, we want to choose the closest block,
715 ++ * otherwise we might end up creating overlapping
716 ++ * blocks, which breaks the rbtree.
717 ++ */
718 ++ if (reg < base_reg)
719 ++ node = node->rb_left;
720 ++ else if (reg > top_reg)
721 ++ node = node->rb_right;
722 ++ else
723 ++ break;
724 ++ }
725 ++
726 ++ if (rbnode) {
727 ++ ret = regcache_rbtree_insert_to_block(map, rbnode,
728 + new_base_reg,
729 + new_top_reg, reg,
730 + value);
731 + if (ret)
732 + return ret;
733 +- rbtree_ctx->cached_rbnode = rbnode_tmp;
734 ++ rbtree_ctx->cached_rbnode = rbnode;
735 + return 0;
736 + }
737 +
738 +diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
739 +index 8a1432e8bb80..01d4be2c354b 100644
740 +--- a/drivers/char/hw_random/omap-rng.c
741 ++++ b/drivers/char/hw_random/omap-rng.c
742 +@@ -384,7 +384,12 @@ static int omap_rng_probe(struct platform_device *pdev)
743 + }
744 +
745 + pm_runtime_enable(&pdev->dev);
746 +- pm_runtime_get_sync(&pdev->dev);
747 ++ ret = pm_runtime_get_sync(&pdev->dev);
748 ++ if (ret) {
749 ++ dev_err(&pdev->dev, "Failed to runtime_get device: %d\n", ret);
750 ++ pm_runtime_put_noidle(&pdev->dev);
751 ++ goto err_ioremap;
752 ++ }
753 +
754 + ret = (dev->of_node) ? of_get_omap_rng_device_details(priv, pdev) :
755 + get_omap_rng_device_details(priv);
756 +@@ -435,8 +440,15 @@ static int __maybe_unused omap_rng_suspend(struct device *dev)
757 + static int __maybe_unused omap_rng_resume(struct device *dev)
758 + {
759 + struct omap_rng_dev *priv = dev_get_drvdata(dev);
760 ++ int ret;
761 ++
762 ++ ret = pm_runtime_get_sync(dev);
763 ++ if (ret) {
764 ++ dev_err(dev, "Failed to runtime_get device: %d\n", ret);
765 ++ pm_runtime_put_noidle(dev);
766 ++ return ret;
767 ++ }
768 +
769 +- pm_runtime_get_sync(dev);
770 + priv->pdata->init(priv);
771 +
772 + return 0;
773 +diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
774 +index b28e4da3d2cf..ca2d2386a4eb 100644
775 +--- a/drivers/char/tpm/tpm2-cmd.c
776 ++++ b/drivers/char/tpm/tpm2-cmd.c
777 +@@ -703,7 +703,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value,
778 +
779 + rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc);
780 + if (!rc)
781 +- *value = cmd.params.get_tpm_pt_out.value;
782 ++ *value = be32_to_cpu(cmd.params.get_tpm_pt_out.value);
783 +
784 + return rc;
785 + }
786 +diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
787 +index e9fd1d83f9f1..0f7ec0deed6c 100644
788 +--- a/drivers/char/tpm/tpm_crb.c
789 ++++ b/drivers/char/tpm/tpm_crb.c
790 +@@ -77,7 +77,6 @@ enum crb_flags {
791 +
792 + struct crb_priv {
793 + unsigned int flags;
794 +- struct resource res;
795 + void __iomem *iobase;
796 + struct crb_control_area __iomem *cca;
797 + u8 __iomem *cmd;
798 +@@ -224,19 +223,19 @@ static int crb_init(struct acpi_device *device, struct crb_priv *priv)
799 +
800 + static int crb_check_resource(struct acpi_resource *ares, void *data)
801 + {
802 +- struct crb_priv *priv = data;
803 ++ struct resource *io_res = data;
804 + struct resource res;
805 +
806 + if (acpi_dev_resource_memory(ares, &res)) {
807 +- priv->res = res;
808 +- priv->res.name = NULL;
809 ++ *io_res = res;
810 ++ io_res->name = NULL;
811 + }
812 +
813 + return 1;
814 + }
815 +
816 + static void __iomem *crb_map_res(struct device *dev, struct crb_priv *priv,
817 +- u64 start, u32 size)
818 ++ struct resource *io_res, u64 start, u32 size)
819 + {
820 + struct resource new_res = {
821 + .start = start,
822 +@@ -248,51 +247,72 @@ static void __iomem *crb_map_res(struct device *dev, struct crb_priv *priv,
823 + if (start != new_res.start)
824 + return (void __iomem *) ERR_PTR(-EINVAL);
825 +
826 +- if (!resource_contains(&priv->res, &new_res))
827 ++ if (!resource_contains(io_res, &new_res))
828 + return devm_ioremap_resource(dev, &new_res);
829 +
830 +- return priv->iobase + (new_res.start - priv->res.start);
831 ++ return priv->iobase + (new_res.start - io_res->start);
832 + }
833 +
834 + static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,
835 + struct acpi_table_tpm2 *buf)
836 + {
837 + struct list_head resources;
838 ++ struct resource io_res;
839 + struct device *dev = &device->dev;
840 +- u64 pa;
841 ++ u64 cmd_pa;
842 ++ u32 cmd_size;
843 ++ u64 rsp_pa;
844 ++ u32 rsp_size;
845 + int ret;
846 +
847 + INIT_LIST_HEAD(&resources);
848 + ret = acpi_dev_get_resources(device, &resources, crb_check_resource,
849 +- priv);
850 ++ &io_res);
851 + if (ret < 0)
852 + return ret;
853 + acpi_dev_free_resource_list(&resources);
854 +
855 +- if (resource_type(&priv->res) != IORESOURCE_MEM) {
856 ++ if (resource_type(&io_res) != IORESOURCE_MEM) {
857 + dev_err(dev,
858 + FW_BUG "TPM2 ACPI table does not define a memory resource\n");
859 + return -EINVAL;
860 + }
861 +
862 +- priv->iobase = devm_ioremap_resource(dev, &priv->res);
863 ++ priv->iobase = devm_ioremap_resource(dev, &io_res);
864 + if (IS_ERR(priv->iobase))
865 + return PTR_ERR(priv->iobase);
866 +
867 +- priv->cca = crb_map_res(dev, priv, buf->control_address, 0x1000);
868 ++ priv->cca = crb_map_res(dev, priv, &io_res, buf->control_address,
869 ++ sizeof(struct crb_control_area));
870 + if (IS_ERR(priv->cca))
871 + return PTR_ERR(priv->cca);
872 +
873 +- pa = ((u64) ioread32(&priv->cca->cmd_pa_high) << 32) |
874 +- (u64) ioread32(&priv->cca->cmd_pa_low);
875 +- priv->cmd = crb_map_res(dev, priv, pa, ioread32(&priv->cca->cmd_size));
876 ++ cmd_pa = ((u64) ioread32(&priv->cca->cmd_pa_high) << 32) |
877 ++ (u64) ioread32(&priv->cca->cmd_pa_low);
878 ++ cmd_size = ioread32(&priv->cca->cmd_size);
879 ++ priv->cmd = crb_map_res(dev, priv, &io_res, cmd_pa, cmd_size);
880 + if (IS_ERR(priv->cmd))
881 + return PTR_ERR(priv->cmd);
882 +
883 +- memcpy_fromio(&pa, &priv->cca->rsp_pa, 8);
884 +- pa = le64_to_cpu(pa);
885 +- priv->rsp = crb_map_res(dev, priv, pa, ioread32(&priv->cca->rsp_size));
886 +- return PTR_ERR_OR_ZERO(priv->rsp);
887 ++ memcpy_fromio(&rsp_pa, &priv->cca->rsp_pa, 8);
888 ++ rsp_pa = le64_to_cpu(rsp_pa);
889 ++ rsp_size = ioread32(&priv->cca->rsp_size);
890 ++
891 ++ if (cmd_pa != rsp_pa) {
892 ++ priv->rsp = crb_map_res(dev, priv, &io_res, rsp_pa, rsp_size);
893 ++ return PTR_ERR_OR_ZERO(priv->rsp);
894 ++ }
895 ++
896 ++ /* According to the PTP specification, overlapping command and response
897 ++ * buffer sizes must be identical.
898 ++ */
899 ++ if (cmd_size != rsp_size) {
900 ++ dev_err(dev, FW_BUG "overlapping command and response buffer sizes are not identical");
901 ++ return -EINVAL;
902 ++ }
903 ++
904 ++ priv->rsp = priv->cmd;
905 ++ return 0;
906 + }
907 +
908 + static int crb_acpi_add(struct acpi_device *device)
909 +diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
910 +index 75bd6621dc5d..de9a3d7505a4 100644
911 +--- a/drivers/dma/at_xdmac.c
912 ++++ b/drivers/dma/at_xdmac.c
913 +@@ -1195,8 +1195,8 @@ static struct at_xdmac_desc *at_xdmac_memset_create_desc(struct dma_chan *chan,
914 + desc->lld.mbr_cfg = chan_cc;
915 +
916 + dev_dbg(chan2dev(chan),
917 +- "%s: lld: mbr_da=%pad, mbr_ds=%pad, mbr_ubc=0x%08x, mbr_cfg=0x%08x\n",
918 +- __func__, &desc->lld.mbr_da, &desc->lld.mbr_ds, desc->lld.mbr_ubc,
919 ++ "%s: lld: mbr_da=%pad, mbr_ds=0x%08x, mbr_ubc=0x%08x, mbr_cfg=0x%08x\n",
920 ++ __func__, &desc->lld.mbr_da, desc->lld.mbr_ds, desc->lld.mbr_ubc,
921 + desc->lld.mbr_cfg);
922 +
923 + return desc;
924 +@@ -2067,7 +2067,7 @@ err_dma_unregister:
925 + err_clk_disable:
926 + clk_disable_unprepare(atxdmac->clk);
927 + err_free_irq:
928 +- free_irq(atxdmac->irq, atxdmac->dma.dev);
929 ++ free_irq(atxdmac->irq, atxdmac);
930 + return ret;
931 + }
932 +
933 +@@ -2081,7 +2081,7 @@ static int at_xdmac_remove(struct platform_device *pdev)
934 + dma_async_device_unregister(&atxdmac->dma);
935 + clk_disable_unprepare(atxdmac->clk);
936 +
937 +- free_irq(atxdmac->irq, atxdmac->dma.dev);
938 ++ free_irq(atxdmac->irq, atxdmac);
939 +
940 + for (i = 0; i < atxdmac->dma.chancnt; i++) {
941 + struct at_xdmac_chan *atchan = &atxdmac->chan[i];
942 +diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
943 +index 6149b27c33ad..c8dd5b00c1b4 100644
944 +--- a/drivers/dma/bcm2835-dma.c
945 ++++ b/drivers/dma/bcm2835-dma.c
946 +@@ -393,11 +393,12 @@ static void bcm2835_dma_fill_cb_chain_with_sg(
947 + unsigned int sg_len)
948 + {
949 + struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
950 +- size_t max_len = bcm2835_dma_max_frame_length(c);
951 +- unsigned int i, len;
952 ++ size_t len, max_len;
953 ++ unsigned int i;
954 + dma_addr_t addr;
955 + struct scatterlist *sgent;
956 +
957 ++ max_len = bcm2835_dma_max_frame_length(c);
958 + for_each_sg(sgl, sgent, sg_len, i) {
959 + for (addr = sg_dma_address(sgent), len = sg_dma_len(sgent);
960 + len > 0;
961 +diff --git a/drivers/gpio/gpio-sa1100.c b/drivers/gpio/gpio-sa1100.c
962 +index 0c99e8fb9af3..8d8ee0ebf14c 100644
963 +--- a/drivers/gpio/gpio-sa1100.c
964 ++++ b/drivers/gpio/gpio-sa1100.c
965 +@@ -155,7 +155,7 @@ static int sa1100_gpio_irqdomain_map(struct irq_domain *d,
966 + {
967 + irq_set_chip_and_handler(irq, &sa1100_gpio_irq_chip,
968 + handle_edge_irq);
969 +- irq_set_noprobe(irq);
970 ++ irq_set_probe(irq);
971 +
972 + return 0;
973 + }
974 +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c
975 +index edec30fd3ecd..0a7b6ed5ed28 100644
976 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c
977 ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c
978 +@@ -37,7 +37,10 @@ nv04_fifo_dma_object_dtor(struct nvkm_fifo_chan *base, int cookie)
979 + {
980 + struct nv04_fifo_chan *chan = nv04_fifo_chan(base);
981 + struct nvkm_instmem *imem = chan->fifo->base.engine.subdev.device->imem;
982 ++
983 ++ mutex_lock(&chan->fifo->base.engine.subdev.mutex);
984 + nvkm_ramht_remove(imem->ramht, cookie);
985 ++ mutex_unlock(&chan->fifo->base.engine.subdev.mutex);
986 + }
987 +
988 + static int
989 +diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
990 +index e6abc09b67e3..1f78ec2548ec 100644
991 +--- a/drivers/gpu/drm/radeon/si_dpm.c
992 ++++ b/drivers/gpu/drm/radeon/si_dpm.c
993 +@@ -3015,6 +3015,12 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
994 + if (rdev->pdev->device == 0x6811 &&
995 + rdev->pdev->revision == 0x81)
996 + max_mclk = 120000;
997 ++ /* limit sclk/mclk on Jet parts for stability */
998 ++ if (rdev->pdev->device == 0x6665 &&
999 ++ rdev->pdev->revision == 0xc3) {
1000 ++ max_sclk = 75000;
1001 ++ max_mclk = 80000;
1002 ++ }
1003 +
1004 + if (rps->vce_active) {
1005 + rps->evclk = rdev->pm.dpm.vce_states[rdev->pm.dpm.vce_level].evclk;
1006 +diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
1007 +index d5df555aeba0..cc2dabab270b 100644
1008 +--- a/drivers/gpu/drm/udl/udl_fb.c
1009 ++++ b/drivers/gpu/drm/udl/udl_fb.c
1010 +@@ -122,7 +122,7 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
1011 + return 0;
1012 + cmd = urb->transfer_buffer;
1013 +
1014 +- for (i = y; i < height ; i++) {
1015 ++ for (i = y; i < y + height ; i++) {
1016 + const int line_offset = fb->base.pitches[0] * i;
1017 + const int byte_offset = line_offset + (x * bpp);
1018 + const int dev_byte_offset = (fb->base.width * bpp * i) + (x * bpp);
1019 +diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c
1020 +index 827c03703128..a7f886961830 100644
1021 +--- a/drivers/hwmon/adt7411.c
1022 ++++ b/drivers/hwmon/adt7411.c
1023 +@@ -30,6 +30,7 @@
1024 +
1025 + #define ADT7411_REG_CFG1 0x18
1026 + #define ADT7411_CFG1_START_MONITOR (1 << 0)
1027 ++#define ADT7411_CFG1_RESERVED_BIT3 (1 << 3)
1028 +
1029 + #define ADT7411_REG_CFG2 0x19
1030 + #define ADT7411_CFG2_DISABLE_AVG (1 << 5)
1031 +@@ -296,8 +297,10 @@ static int adt7411_probe(struct i2c_client *client,
1032 + mutex_init(&data->device_lock);
1033 + mutex_init(&data->update_lock);
1034 +
1035 ++ /* According to the datasheet, we must only write 1 to bit 3 */
1036 + ret = adt7411_modify_bit(client, ADT7411_REG_CFG1,
1037 +- ADT7411_CFG1_START_MONITOR, 1);
1038 ++ ADT7411_CFG1_RESERVED_BIT3
1039 ++ | ADT7411_CFG1_START_MONITOR, 1);
1040 + if (ret < 0)
1041 + return ret;
1042 +
1043 +diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
1044 +index 215ac87f606d..e999125ce37d 100644
1045 +--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
1046 ++++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
1047 +@@ -37,8 +37,6 @@ struct i2c_demux_pinctrl_priv {
1048 + struct i2c_demux_pinctrl_chan chan[];
1049 + };
1050 +
1051 +-static struct property status_okay = { .name = "status", .length = 3, .value = "ok" };
1052 +-
1053 + static int i2c_demux_master_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
1054 + {
1055 + struct i2c_demux_pinctrl_priv *priv = adap->algo_data;
1056 +@@ -192,6 +190,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
1057 + {
1058 + struct device_node *np = pdev->dev.of_node;
1059 + struct i2c_demux_pinctrl_priv *priv;
1060 ++ struct property *props;
1061 + int num_chan, i, j, err;
1062 +
1063 + num_chan = of_count_phandle_with_args(np, "i2c-parent", NULL);
1064 +@@ -202,7 +201,10 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
1065 +
1066 + priv = devm_kzalloc(&pdev->dev, sizeof(*priv)
1067 + + num_chan * sizeof(struct i2c_demux_pinctrl_chan), GFP_KERNEL);
1068 +- if (!priv)
1069 ++
1070 ++ props = devm_kcalloc(&pdev->dev, num_chan, sizeof(*props), GFP_KERNEL);
1071 ++
1072 ++ if (!priv || !props)
1073 + return -ENOMEM;
1074 +
1075 + err = of_property_read_string(np, "i2c-bus-name", &priv->bus_name);
1076 +@@ -220,8 +222,12 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
1077 + }
1078 + priv->chan[i].parent_np = adap_np;
1079 +
1080 ++ props[i].name = devm_kstrdup(&pdev->dev, "status", GFP_KERNEL);
1081 ++ props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL);
1082 ++ props[i].length = 3;
1083 ++
1084 + of_changeset_init(&priv->chan[i].chgset);
1085 +- of_changeset_update_property(&priv->chan[i].chgset, adap_np, &status_okay);
1086 ++ of_changeset_update_property(&priv->chan[i].chgset, adap_np, &props[i]);
1087 + }
1088 +
1089 + priv->num_chan = num_chan;
1090 +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
1091 +index ad1b1adcf6f0..8b5abc4ce202 100644
1092 +--- a/drivers/infiniband/core/cma.c
1093 ++++ b/drivers/infiniband/core/cma.c
1094 +@@ -2452,18 +2452,24 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
1095 +
1096 + if (addr->dev_addr.bound_dev_if) {
1097 + ndev = dev_get_by_index(&init_net, addr->dev_addr.bound_dev_if);
1098 +- if (!ndev)
1099 +- return -ENODEV;
1100 ++ if (!ndev) {
1101 ++ ret = -ENODEV;
1102 ++ goto err2;
1103 ++ }
1104 +
1105 + if (ndev->flags & IFF_LOOPBACK) {
1106 + dev_put(ndev);
1107 +- if (!id_priv->id.device->get_netdev)
1108 +- return -EOPNOTSUPP;
1109 ++ if (!id_priv->id.device->get_netdev) {
1110 ++ ret = -EOPNOTSUPP;
1111 ++ goto err2;
1112 ++ }
1113 +
1114 + ndev = id_priv->id.device->get_netdev(id_priv->id.device,
1115 + id_priv->id.port_num);
1116 +- if (!ndev)
1117 +- return -ENODEV;
1118 ++ if (!ndev) {
1119 ++ ret = -ENODEV;
1120 ++ goto err2;
1121 ++ }
1122 + }
1123 +
1124 + route->path_rec->net = &init_net;
1125 +diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c
1126 +index a83ec28a147b..365cb53cc8b2 100644
1127 +--- a/drivers/infiniband/core/multicast.c
1128 ++++ b/drivers/infiniband/core/multicast.c
1129 +@@ -118,7 +118,6 @@ struct mcast_group {
1130 + atomic_t refcount;
1131 + enum mcast_group_state state;
1132 + struct ib_sa_query *query;
1133 +- int query_id;
1134 + u16 pkey_index;
1135 + u8 leave_state;
1136 + int retries;
1137 +@@ -352,11 +351,7 @@ static int send_join(struct mcast_group *group, struct mcast_member *member)
1138 + member->multicast.comp_mask,
1139 + 3000, GFP_KERNEL, join_handler, group,
1140 + &group->query);
1141 +- if (ret >= 0) {
1142 +- group->query_id = ret;
1143 +- ret = 0;
1144 +- }
1145 +- return ret;
1146 ++ return (ret > 0) ? 0 : ret;
1147 + }
1148 +
1149 + static int send_leave(struct mcast_group *group, u8 leave_state)
1150 +@@ -376,11 +371,7 @@ static int send_leave(struct mcast_group *group, u8 leave_state)
1151 + IB_SA_MCMEMBER_REC_JOIN_STATE,
1152 + 3000, GFP_KERNEL, leave_handler,
1153 + group, &group->query);
1154 +- if (ret >= 0) {
1155 +- group->query_id = ret;
1156 +- ret = 0;
1157 +- }
1158 +- return ret;
1159 ++ return (ret > 0) ? 0 : ret;
1160 + }
1161 +
1162 + static void join_group(struct mcast_group *group, struct mcast_member *member,
1163 +diff --git a/drivers/infiniband/hw/i40iw/i40iw.h b/drivers/infiniband/hw/i40iw/i40iw.h
1164 +index b738acdb9b02..8ec09e470f84 100644
1165 +--- a/drivers/infiniband/hw/i40iw/i40iw.h
1166 ++++ b/drivers/infiniband/hw/i40iw/i40iw.h
1167 +@@ -232,7 +232,7 @@ struct i40iw_device {
1168 + struct i40e_client *client;
1169 + struct i40iw_hw hw;
1170 + struct i40iw_cm_core cm_core;
1171 +- unsigned long *mem_resources;
1172 ++ u8 *mem_resources;
1173 + unsigned long *allocated_qps;
1174 + unsigned long *allocated_cqs;
1175 + unsigned long *allocated_mrs;
1176 +@@ -435,8 +435,8 @@ static inline int i40iw_alloc_resource(struct i40iw_device *iwdev,
1177 + *next = resource_num + 1;
1178 + if (*next == max_resources)
1179 + *next = 0;
1180 +- spin_unlock_irqrestore(&iwdev->resource_lock, flags);
1181 + *req_resource_num = resource_num;
1182 ++ spin_unlock_irqrestore(&iwdev->resource_lock, flags);
1183 +
1184 + return 0;
1185 + }
1186 +diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c
1187 +index d2fa72516960..406a345227c3 100644
1188 +--- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
1189 ++++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
1190 +@@ -535,8 +535,8 @@ static struct i40iw_puda_buf *i40iw_form_cm_frame(struct i40iw_cm_node *cm_node,
1191 + buf += hdr_len;
1192 + }
1193 +
1194 +- if (pd_len)
1195 +- memcpy(buf, pdata->addr, pd_len);
1196 ++ if (pdata && pdata->addr)
1197 ++ memcpy(buf, pdata->addr, pdata->size);
1198 +
1199 + atomic_set(&sqbuf->refcount, 1);
1200 +
1201 +@@ -3347,26 +3347,6 @@ int i40iw_cm_disconn(struct i40iw_qp *iwqp)
1202 + }
1203 +
1204 + /**
1205 +- * i40iw_loopback_nop - Send a nop
1206 +- * @qp: associated hw qp
1207 +- */
1208 +-static void i40iw_loopback_nop(struct i40iw_sc_qp *qp)
1209 +-{
1210 +- u64 *wqe;
1211 +- u64 header;
1212 +-
1213 +- wqe = qp->qp_uk.sq_base->elem;
1214 +- set_64bit_val(wqe, 0, 0);
1215 +- set_64bit_val(wqe, 8, 0);
1216 +- set_64bit_val(wqe, 16, 0);
1217 +-
1218 +- header = LS_64(I40IWQP_OP_NOP, I40IWQPSQ_OPCODE) |
1219 +- LS_64(0, I40IWQPSQ_SIGCOMPL) |
1220 +- LS_64(qp->qp_uk.swqe_polarity, I40IWQPSQ_VALID);
1221 +- set_64bit_val(wqe, 24, header);
1222 +-}
1223 +-
1224 +-/**
1225 + * i40iw_qp_disconnect - free qp and close cm
1226 + * @iwqp: associate qp for the connection
1227 + */
1228 +@@ -3638,7 +3618,7 @@ int i40iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
1229 + } else {
1230 + if (iwqp->page)
1231 + iwqp->sc_qp.qp_uk.sq_base = kmap(iwqp->page);
1232 +- i40iw_loopback_nop(&iwqp->sc_qp);
1233 ++ dev->iw_priv_qp_ops->qp_send_lsmm(&iwqp->sc_qp, NULL, 0, 0);
1234 + }
1235 +
1236 + if (iwqp->page)
1237 +diff --git a/drivers/infiniband/hw/i40iw/i40iw_hw.c b/drivers/infiniband/hw/i40iw/i40iw_hw.c
1238 +index 3ee0cad96bc6..0c92a40b3e86 100644
1239 +--- a/drivers/infiniband/hw/i40iw/i40iw_hw.c
1240 ++++ b/drivers/infiniband/hw/i40iw/i40iw_hw.c
1241 +@@ -265,6 +265,7 @@ void i40iw_next_iw_state(struct i40iw_qp *iwqp,
1242 + info.dont_send_fin = false;
1243 + if (iwqp->sc_qp.term_flags && (state == I40IW_QP_STATE_ERROR))
1244 + info.reset_tcp_conn = true;
1245 ++ iwqp->hw_iwarp_state = state;
1246 + i40iw_hw_modify_qp(iwqp->iwdev, iwqp, &info, 0);
1247 + }
1248 +
1249 +diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c
1250 +index 6e9081380a27..445e230d5ff8 100644
1251 +--- a/drivers/infiniband/hw/i40iw/i40iw_main.c
1252 ++++ b/drivers/infiniband/hw/i40iw/i40iw_main.c
1253 +@@ -100,7 +100,7 @@ static struct notifier_block i40iw_net_notifier = {
1254 + .notifier_call = i40iw_net_event
1255 + };
1256 +
1257 +-static int i40iw_notifiers_registered;
1258 ++static atomic_t i40iw_notifiers_registered;
1259 +
1260 + /**
1261 + * i40iw_find_i40e_handler - find a handler given a client info
1262 +@@ -1342,12 +1342,11 @@ exit:
1263 + */
1264 + static void i40iw_register_notifiers(void)
1265 + {
1266 +- if (!i40iw_notifiers_registered) {
1267 ++ if (atomic_inc_return(&i40iw_notifiers_registered) == 1) {
1268 + register_inetaddr_notifier(&i40iw_inetaddr_notifier);
1269 + register_inet6addr_notifier(&i40iw_inetaddr6_notifier);
1270 + register_netevent_notifier(&i40iw_net_notifier);
1271 + }
1272 +- i40iw_notifiers_registered++;
1273 + }
1274 +
1275 + /**
1276 +@@ -1429,8 +1428,7 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev, bool reset, bool del
1277 + i40iw_del_macip_entry(iwdev, (u8)iwdev->mac_ip_table_idx);
1278 + /* fallthrough */
1279 + case INET_NOTIFIER:
1280 +- if (i40iw_notifiers_registered > 0) {
1281 +- i40iw_notifiers_registered--;
1282 ++ if (!atomic_dec_return(&i40iw_notifiers_registered)) {
1283 + unregister_netevent_notifier(&i40iw_net_notifier);
1284 + unregister_inetaddr_notifier(&i40iw_inetaddr_notifier);
1285 + unregister_inet6addr_notifier(&i40iw_inetaddr6_notifier);
1286 +@@ -1558,6 +1556,10 @@ static int i40iw_open(struct i40e_info *ldev, struct i40e_client *client)
1287 + enum i40iw_status_code status;
1288 + struct i40iw_handler *hdl;
1289 +
1290 ++ hdl = i40iw_find_netdev(ldev->netdev);
1291 ++ if (hdl)
1292 ++ return 0;
1293 ++
1294 + hdl = kzalloc(sizeof(*hdl), GFP_KERNEL);
1295 + if (!hdl)
1296 + return -ENOMEM;
1297 +diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c
1298 +index 0e8db0a35141..6fd043b1d714 100644
1299 +--- a/drivers/infiniband/hw/i40iw/i40iw_utils.c
1300 ++++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c
1301 +@@ -673,8 +673,11 @@ enum i40iw_status_code i40iw_free_virt_mem(struct i40iw_hw *hw,
1302 + {
1303 + if (!mem)
1304 + return I40IW_ERR_PARAM;
1305 ++ /*
1306 ++ * mem->va points to the parent of mem, so both mem and mem->va
1307 ++ * can not be touched once mem->va is freed
1308 ++ */
1309 + kfree(mem->va);
1310 +- mem->va = NULL;
1311 + return 0;
1312 + }
1313 +
1314 +diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
1315 +index 283b64c942ee..f24bfbdddfaa 100644
1316 +--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
1317 ++++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
1318 +@@ -794,7 +794,6 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd,
1319 + return &iwqp->ibqp;
1320 + error:
1321 + i40iw_free_qp_resources(iwdev, iwqp, qp_num);
1322 +- kfree(mem);
1323 + return ERR_PTR(err_code);
1324 + }
1325 +
1326 +@@ -1925,8 +1924,7 @@ static int i40iw_dereg_mr(struct ib_mr *ib_mr)
1327 + }
1328 + if (iwpbl->pbl_allocated)
1329 + i40iw_free_pble(iwdev->pble_rsrc, palloc);
1330 +- kfree(iwpbl->iwmr);
1331 +- iwpbl->iwmr = NULL;
1332 ++ kfree(iwmr);
1333 + return 0;
1334 + }
1335 +
1336 +diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
1337 +index 9c2e53d28f98..0f21c3a25552 100644
1338 +--- a/drivers/infiniband/hw/mlx4/mad.c
1339 ++++ b/drivers/infiniband/hw/mlx4/mad.c
1340 +@@ -1128,6 +1128,27 @@ void handle_port_mgmt_change_event(struct work_struct *work)
1341 +
1342 + /* Generate GUID changed event */
1343 + if (changed_attr & MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK) {
1344 ++ if (mlx4_is_master(dev->dev)) {
1345 ++ union ib_gid gid;
1346 ++ int err = 0;
1347 ++
1348 ++ if (!eqe->event.port_mgmt_change.params.port_info.gid_prefix)
1349 ++ err = __mlx4_ib_query_gid(&dev->ib_dev, port, 0, &gid, 1);
1350 ++ else
1351 ++ gid.global.subnet_prefix =
1352 ++ eqe->event.port_mgmt_change.params.port_info.gid_prefix;
1353 ++ if (err) {
1354 ++ pr_warn("Could not change QP1 subnet prefix for port %d: query_gid error (%d)\n",
1355 ++ port, err);
1356 ++ } else {
1357 ++ pr_debug("Changing QP1 subnet prefix for port %d. old=0x%llx. new=0x%llx\n",
1358 ++ port,
1359 ++ (u64)atomic64_read(&dev->sriov.demux[port - 1].subnet_prefix),
1360 ++ be64_to_cpu(gid.global.subnet_prefix));
1361 ++ atomic64_set(&dev->sriov.demux[port - 1].subnet_prefix,
1362 ++ be64_to_cpu(gid.global.subnet_prefix));
1363 ++ }
1364 ++ }
1365 + mlx4_ib_dispatch_event(dev, port, IB_EVENT_GID_CHANGE);
1366 + /*if master, notify all slaves*/
1367 + if (mlx4_is_master(dev->dev))
1368 +@@ -2202,6 +2223,8 @@ int mlx4_ib_init_sriov(struct mlx4_ib_dev *dev)
1369 + if (err)
1370 + goto demux_err;
1371 + dev->sriov.demux[i].guid_cache[0] = gid.global.interface_id;
1372 ++ atomic64_set(&dev->sriov.demux[i].subnet_prefix,
1373 ++ be64_to_cpu(gid.global.subnet_prefix));
1374 + err = alloc_pv_object(dev, mlx4_master_func_num(dev->dev), i + 1,
1375 + &dev->sriov.sqps[i]);
1376 + if (err)
1377 +diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c
1378 +index 8f7ad07915b0..097bfcc4ee99 100644
1379 +--- a/drivers/infiniband/hw/mlx4/mcg.c
1380 ++++ b/drivers/infiniband/hw/mlx4/mcg.c
1381 +@@ -489,7 +489,7 @@ static u8 get_leave_state(struct mcast_group *group)
1382 + if (!group->members[i])
1383 + leave_state |= (1 << i);
1384 +
1385 +- return leave_state & (group->rec.scope_join_state & 7);
1386 ++ return leave_state & (group->rec.scope_join_state & 0xf);
1387 + }
1388 +
1389 + static int join_group(struct mcast_group *group, int slave, u8 join_mask)
1390 +@@ -564,8 +564,8 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work)
1391 + } else
1392 + mcg_warn_group(group, "DRIVER BUG\n");
1393 + } else if (group->state == MCAST_LEAVE_SENT) {
1394 +- if (group->rec.scope_join_state & 7)
1395 +- group->rec.scope_join_state &= 0xf8;
1396 ++ if (group->rec.scope_join_state & 0xf)
1397 ++ group->rec.scope_join_state &= 0xf0;
1398 + group->state = MCAST_IDLE;
1399 + mutex_unlock(&group->lock);
1400 + if (release_group(group, 1))
1401 +@@ -605,7 +605,7 @@ static int handle_leave_req(struct mcast_group *group, u8 leave_mask,
1402 + static int handle_join_req(struct mcast_group *group, u8 join_mask,
1403 + struct mcast_req *req)
1404 + {
1405 +- u8 group_join_state = group->rec.scope_join_state & 7;
1406 ++ u8 group_join_state = group->rec.scope_join_state & 0xf;
1407 + int ref = 0;
1408 + u16 status;
1409 + struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data;
1410 +@@ -690,8 +690,8 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work)
1411 + u8 cur_join_state;
1412 +
1413 + resp_join_state = ((struct ib_sa_mcmember_data *)
1414 +- group->response_sa_mad.data)->scope_join_state & 7;
1415 +- cur_join_state = group->rec.scope_join_state & 7;
1416 ++ group->response_sa_mad.data)->scope_join_state & 0xf;
1417 ++ cur_join_state = group->rec.scope_join_state & 0xf;
1418 +
1419 + if (method == IB_MGMT_METHOD_GET_RESP) {
1420 + /* successfull join */
1421 +@@ -710,7 +710,7 @@ process_requests:
1422 + req = list_first_entry(&group->pending_list, struct mcast_req,
1423 + group_list);
1424 + sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data;
1425 +- req_join_state = sa_data->scope_join_state & 0x7;
1426 ++ req_join_state = sa_data->scope_join_state & 0xf;
1427 +
1428 + /* For a leave request, we will immediately answer the VF, and
1429 + * update our internal counters. The actual leave will be sent
1430 +diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h
1431 +index 29acda249612..d4ca38103cec 100644
1432 +--- a/drivers/infiniband/hw/mlx4/mlx4_ib.h
1433 ++++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h
1434 +@@ -448,7 +448,7 @@ struct mlx4_ib_demux_ctx {
1435 + struct workqueue_struct *wq;
1436 + struct workqueue_struct *ud_wq;
1437 + spinlock_t ud_lock;
1438 +- __be64 subnet_prefix;
1439 ++ atomic64_t subnet_prefix;
1440 + __be64 guid_cache[128];
1441 + struct mlx4_ib_dev *dev;
1442 + /* the following lock protects both mcg_table and mcg_mgid0_list */
1443 +diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
1444 +index 8db8405c1e99..d995222e661f 100644
1445 +--- a/drivers/infiniband/hw/mlx4/qp.c
1446 ++++ b/drivers/infiniband/hw/mlx4/qp.c
1447 +@@ -2492,24 +2492,27 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr,
1448 + sqp->ud_header.grh.flow_label =
1449 + ah->av.ib.sl_tclass_flowlabel & cpu_to_be32(0xfffff);
1450 + sqp->ud_header.grh.hop_limit = ah->av.ib.hop_limit;
1451 +- if (is_eth)
1452 ++ if (is_eth) {
1453 + memcpy(sqp->ud_header.grh.source_gid.raw, sgid.raw, 16);
1454 +- else {
1455 +- if (mlx4_is_mfunc(to_mdev(ib_dev)->dev)) {
1456 +- /* When multi-function is enabled, the ib_core gid
1457 +- * indexes don't necessarily match the hw ones, so
1458 +- * we must use our own cache */
1459 +- sqp->ud_header.grh.source_gid.global.subnet_prefix =
1460 +- to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1].
1461 +- subnet_prefix;
1462 +- sqp->ud_header.grh.source_gid.global.interface_id =
1463 +- to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1].
1464 +- guid_cache[ah->av.ib.gid_index];
1465 +- } else
1466 +- ib_get_cached_gid(ib_dev,
1467 +- be32_to_cpu(ah->av.ib.port_pd) >> 24,
1468 +- ah->av.ib.gid_index,
1469 +- &sqp->ud_header.grh.source_gid, NULL);
1470 ++ } else {
1471 ++ if (mlx4_is_mfunc(to_mdev(ib_dev)->dev)) {
1472 ++ /* When multi-function is enabled, the ib_core gid
1473 ++ * indexes don't necessarily match the hw ones, so
1474 ++ * we must use our own cache
1475 ++ */
1476 ++ sqp->ud_header.grh.source_gid.global.subnet_prefix =
1477 ++ cpu_to_be64(atomic64_read(&(to_mdev(ib_dev)->sriov.
1478 ++ demux[sqp->qp.port - 1].
1479 ++ subnet_prefix)));
1480 ++ sqp->ud_header.grh.source_gid.global.interface_id =
1481 ++ to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1].
1482 ++ guid_cache[ah->av.ib.gid_index];
1483 ++ } else {
1484 ++ ib_get_cached_gid(ib_dev,
1485 ++ be32_to_cpu(ah->av.ib.port_pd) >> 24,
1486 ++ ah->av.ib.gid_index,
1487 ++ &sqp->ud_header.grh.source_gid, NULL);
1488 ++ }
1489 + }
1490 + memcpy(sqp->ud_header.grh.destination_gid.raw,
1491 + ah->av.ib.dgid, 16);
1492 +diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
1493 +index b48ad85315dc..c90f57579a92 100644
1494 +--- a/drivers/infiniband/hw/mlx5/main.c
1495 ++++ b/drivers/infiniband/hw/mlx5/main.c
1496 +@@ -287,7 +287,9 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num,
1497 +
1498 + static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev)
1499 + {
1500 +- return !MLX5_CAP_GEN(dev->mdev, ib_virt);
1501 ++ if (MLX5_CAP_GEN(dev->mdev, port_type) == MLX5_CAP_PORT_TYPE_IB)
1502 ++ return !MLX5_CAP_GEN(dev->mdev, ib_virt);
1503 ++ return 0;
1504 + }
1505 +
1506 + enum {
1507 +@@ -1275,6 +1277,13 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v,
1508 + dmac_47_16),
1509 + ib_spec->eth.val.dst_mac);
1510 +
1511 ++ ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, outer_headers_c,
1512 ++ smac_47_16),
1513 ++ ib_spec->eth.mask.src_mac);
1514 ++ ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, outer_headers_v,
1515 ++ smac_47_16),
1516 ++ ib_spec->eth.val.src_mac);
1517 ++
1518 + if (ib_spec->eth.mask.vlan_tag) {
1519 + MLX5_SET(fte_match_set_lyr_2_4, outer_headers_c,
1520 + vlan_tag, 1);
1521 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
1522 +index 4f7d9b48df64..9dbfcc0ab577 100644
1523 +--- a/drivers/infiniband/ulp/ipoib/ipoib.h
1524 ++++ b/drivers/infiniband/ulp/ipoib/ipoib.h
1525 +@@ -478,6 +478,7 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
1526 + struct ipoib_ah *address, u32 qpn);
1527 + void ipoib_reap_ah(struct work_struct *work);
1528 +
1529 ++struct ipoib_path *__path_find(struct net_device *dev, void *gid);
1530 + void ipoib_mark_paths_invalid(struct net_device *dev);
1531 + void ipoib_flush_paths(struct net_device *dev);
1532 + int ipoib_check_sm_sendonly_fullmember_support(struct ipoib_dev_priv *priv);
1533 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1534 +index 951d9abcca8b..4ad297d3de89 100644
1535 +--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1536 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1537 +@@ -1318,6 +1318,8 @@ void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx)
1538 + }
1539 + }
1540 +
1541 ++#define QPN_AND_OPTIONS_OFFSET 4
1542 ++
1543 + static void ipoib_cm_tx_start(struct work_struct *work)
1544 + {
1545 + struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv,
1546 +@@ -1326,6 +1328,7 @@ static void ipoib_cm_tx_start(struct work_struct *work)
1547 + struct ipoib_neigh *neigh;
1548 + struct ipoib_cm_tx *p;
1549 + unsigned long flags;
1550 ++ struct ipoib_path *path;
1551 + int ret;
1552 +
1553 + struct ib_sa_path_rec pathrec;
1554 +@@ -1338,7 +1341,19 @@ static void ipoib_cm_tx_start(struct work_struct *work)
1555 + p = list_entry(priv->cm.start_list.next, typeof(*p), list);
1556 + list_del_init(&p->list);
1557 + neigh = p->neigh;
1558 ++
1559 + qpn = IPOIB_QPN(neigh->daddr);
1560 ++ /*
1561 ++ * As long as the search is with these 2 locks,
1562 ++ * path existence indicates its validity.
1563 ++ */
1564 ++ path = __path_find(dev, neigh->daddr + QPN_AND_OPTIONS_OFFSET);
1565 ++ if (!path) {
1566 ++ pr_info("%s ignore not valid path %pI6\n",
1567 ++ __func__,
1568 ++ neigh->daddr + QPN_AND_OPTIONS_OFFSET);
1569 ++ goto free_neigh;
1570 ++ }
1571 + memcpy(&pathrec, &p->path->pathrec, sizeof pathrec);
1572 +
1573 + spin_unlock_irqrestore(&priv->lock, flags);
1574 +@@ -1350,6 +1365,7 @@ static void ipoib_cm_tx_start(struct work_struct *work)
1575 + spin_lock_irqsave(&priv->lock, flags);
1576 +
1577 + if (ret) {
1578 ++free_neigh:
1579 + neigh = p->neigh;
1580 + if (neigh) {
1581 + neigh->cm = NULL;
1582 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1583 +index dc6d241b9406..be11d5d5b8c1 100644
1584 +--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1585 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1586 +@@ -1161,8 +1161,17 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,
1587 + }
1588 +
1589 + if (level == IPOIB_FLUSH_LIGHT) {
1590 ++ int oper_up;
1591 + ipoib_mark_paths_invalid(dev);
1592 ++ /* Set IPoIB operation as down to prevent races between:
1593 ++ * the flush flow which leaves MCG and on the fly joins
1594 ++ * which can happen during that time. mcast restart task
1595 ++ * should deal with join requests we missed.
1596 ++ */
1597 ++ oper_up = test_and_clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags);
1598 + ipoib_mcast_dev_flush(dev);
1599 ++ if (oper_up)
1600 ++ set_bit(IPOIB_FLAG_OPER_UP, &priv->flags);
1601 + ipoib_flush_ah(dev);
1602 + }
1603 +
1604 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1605 +index 5f58c41ef787..ddebda53e147 100644
1606 +--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
1607 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1608 +@@ -485,7 +485,7 @@ int ipoib_set_mode(struct net_device *dev, const char *buf)
1609 + return -EINVAL;
1610 + }
1611 +
1612 +-static struct ipoib_path *__path_find(struct net_device *dev, void *gid)
1613 ++struct ipoib_path *__path_find(struct net_device *dev, void *gid)
1614 + {
1615 + struct ipoib_dev_priv *priv = netdev_priv(dev);
1616 + struct rb_node *n = priv->path_tree.rb_node;
1617 +diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
1618 +index 2c5ba0e704bf..53891c34fe19 100644
1619 +--- a/drivers/irqchip/irq-gic-v3.c
1620 ++++ b/drivers/irqchip/irq-gic-v3.c
1621 +@@ -558,7 +558,7 @@ static struct notifier_block gic_cpu_notifier = {
1622 + static u16 gic_compute_target_list(int *base_cpu, const struct cpumask *mask,
1623 + unsigned long cluster_id)
1624 + {
1625 +- int cpu = *base_cpu;
1626 ++ int next_cpu, cpu = *base_cpu;
1627 + unsigned long mpidr = cpu_logical_map(cpu);
1628 + u16 tlist = 0;
1629 +
1630 +@@ -572,9 +572,10 @@ static u16 gic_compute_target_list(int *base_cpu, const struct cpumask *mask,
1631 +
1632 + tlist |= 1 << (mpidr & 0xf);
1633 +
1634 +- cpu = cpumask_next(cpu, mask);
1635 +- if (cpu >= nr_cpu_ids)
1636 ++ next_cpu = cpumask_next(cpu, mask);
1637 ++ if (next_cpu >= nr_cpu_ids)
1638 + goto out;
1639 ++ cpu = next_cpu;
1640 +
1641 + mpidr = cpu_logical_map(cpu);
1642 +
1643 +diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
1644 +index 58d04726cdd7..9ca96e9db6bf 100644
1645 +--- a/drivers/mailbox/mailbox-test.c
1646 ++++ b/drivers/mailbox/mailbox-test.c
1647 +@@ -133,6 +133,7 @@ static ssize_t mbox_test_message_write(struct file *filp,
1648 + out:
1649 + kfree(tdev->signal);
1650 + kfree(tdev->message);
1651 ++ tdev->signal = NULL;
1652 +
1653 + return ret < 0 ? ret : count;
1654 + }
1655 +diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c
1656 +index d8f8cc85f96c..dd230752b08a 100644
1657 +--- a/drivers/md/dm-log-writes.c
1658 ++++ b/drivers/md/dm-log-writes.c
1659 +@@ -259,7 +259,7 @@ static int log_one_block(struct log_writes_c *lc,
1660 + sector++;
1661 +
1662 + atomic_inc(&lc->io_blocks);
1663 +- bio = bio_alloc(GFP_KERNEL, block->vec_cnt);
1664 ++ bio = bio_alloc(GFP_KERNEL, min(block->vec_cnt, BIO_MAX_PAGES));
1665 + if (!bio) {
1666 + DMERR("Couldn't alloc log bio");
1667 + goto error;
1668 +@@ -280,7 +280,7 @@ static int log_one_block(struct log_writes_c *lc,
1669 + if (ret != block->vecs[i].bv_len) {
1670 + atomic_inc(&lc->io_blocks);
1671 + submit_bio(WRITE, bio);
1672 +- bio = bio_alloc(GFP_KERNEL, block->vec_cnt - i);
1673 ++ bio = bio_alloc(GFP_KERNEL, min(block->vec_cnt - i, BIO_MAX_PAGES));
1674 + if (!bio) {
1675 + DMERR("Couldn't alloc log bio");
1676 + goto error;
1677 +diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c b/drivers/media/platform/vsp1/vsp1_pipe.c
1678 +index 4f3b4a1d028a..3c8f40bd8b9d 100644
1679 +--- a/drivers/media/platform/vsp1/vsp1_pipe.c
1680 ++++ b/drivers/media/platform/vsp1/vsp1_pipe.c
1681 +@@ -172,13 +172,17 @@ void vsp1_pipeline_reset(struct vsp1_pipeline *pipe)
1682 + bru->inputs[i].rpf = NULL;
1683 + }
1684 +
1685 +- for (i = 0; i < pipe->num_inputs; ++i) {
1686 +- pipe->inputs[i]->pipe = NULL;
1687 +- pipe->inputs[i] = NULL;
1688 ++ for (i = 0; i < ARRAY_SIZE(pipe->inputs); ++i) {
1689 ++ if (pipe->inputs[i]) {
1690 ++ pipe->inputs[i]->pipe = NULL;
1691 ++ pipe->inputs[i] = NULL;
1692 ++ }
1693 + }
1694 +
1695 +- pipe->output->pipe = NULL;
1696 +- pipe->output = NULL;
1697 ++ if (pipe->output) {
1698 ++ pipe->output->pipe = NULL;
1699 ++ pipe->output = NULL;
1700 ++ }
1701 +
1702 + INIT_LIST_HEAD(&pipe->entities);
1703 + pipe->state = VSP1_PIPELINE_STOPPED;
1704 +diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
1705 +index a19b5c8b56ff..1a9e1e556706 100644
1706 +--- a/drivers/media/usb/em28xx/em28xx-i2c.c
1707 ++++ b/drivers/media/usb/em28xx/em28xx-i2c.c
1708 +@@ -507,9 +507,8 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
1709 + if (dev->disconnected)
1710 + return -ENODEV;
1711 +
1712 +- rc = rt_mutex_trylock(&dev->i2c_bus_lock);
1713 +- if (rc < 0)
1714 +- return rc;
1715 ++ if (!rt_mutex_trylock(&dev->i2c_bus_lock))
1716 ++ return -EAGAIN;
1717 +
1718 + /* Switch I2C bus if needed */
1719 + if (bus != dev->cur_i2c_bus &&
1720 +diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c
1721 +index f23df4a9d8c5..52b88e9e656b 100644
1722 +--- a/drivers/media/usb/gspca/cpia1.c
1723 ++++ b/drivers/media/usb/gspca/cpia1.c
1724 +@@ -1624,7 +1624,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
1725 +
1726 + static void sd_stopN(struct gspca_dev *gspca_dev)
1727 + {
1728 +- struct sd *sd = (struct sd *) gspca_dev;
1729 ++ struct sd *sd __maybe_unused = (struct sd *) gspca_dev;
1730 +
1731 + command_pause(gspca_dev);
1732 +
1733 +diff --git a/drivers/media/usb/gspca/konica.c b/drivers/media/usb/gspca/konica.c
1734 +index 39c96bb4c985..0712b1bc90b4 100644
1735 +--- a/drivers/media/usb/gspca/konica.c
1736 ++++ b/drivers/media/usb/gspca/konica.c
1737 +@@ -243,7 +243,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
1738 +
1739 + static void sd_stopN(struct gspca_dev *gspca_dev)
1740 + {
1741 +- struct sd *sd = (struct sd *) gspca_dev;
1742 ++ struct sd *sd __maybe_unused = (struct sd *) gspca_dev;
1743 +
1744 + konica_stream_off(gspca_dev);
1745 + #if IS_ENABLED(CONFIG_INPUT)
1746 +diff --git a/drivers/media/usb/gspca/t613.c b/drivers/media/usb/gspca/t613.c
1747 +index e2cc4e5a0ccb..bb52fc1fe598 100644
1748 +--- a/drivers/media/usb/gspca/t613.c
1749 ++++ b/drivers/media/usb/gspca/t613.c
1750 +@@ -837,7 +837,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1751 + u8 *data, /* isoc packet */
1752 + int len) /* iso packet length */
1753 + {
1754 +- struct sd *sd = (struct sd *) gspca_dev;
1755 ++ struct sd *sd __maybe_unused = (struct sd *) gspca_dev;
1756 + int pkt_type;
1757 +
1758 + if (data[0] == 0x5a) {
1759 +diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
1760 +index bc8d0b9870eb..df651935ed6f 100644
1761 +--- a/drivers/misc/cxl/guest.c
1762 ++++ b/drivers/misc/cxl/guest.c
1763 +@@ -1052,16 +1052,18 @@ static void free_adapter(struct cxl *adapter)
1764 + struct irq_avail *cur;
1765 + int i;
1766 +
1767 +- if (adapter->guest->irq_avail) {
1768 +- for (i = 0; i < adapter->guest->irq_nranges; i++) {
1769 +- cur = &adapter->guest->irq_avail[i];
1770 +- kfree(cur->bitmap);
1771 ++ if (adapter->guest) {
1772 ++ if (adapter->guest->irq_avail) {
1773 ++ for (i = 0; i < adapter->guest->irq_nranges; i++) {
1774 ++ cur = &adapter->guest->irq_avail[i];
1775 ++ kfree(cur->bitmap);
1776 ++ }
1777 ++ kfree(adapter->guest->irq_avail);
1778 + }
1779 +- kfree(adapter->guest->irq_avail);
1780 ++ kfree(adapter->guest->status);
1781 ++ kfree(adapter->guest);
1782 + }
1783 +- kfree(adapter->guest->status);
1784 + cxl_remove_adapter_nr(adapter);
1785 +- kfree(adapter->guest);
1786 + kfree(adapter);
1787 + }
1788 +
1789 +diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
1790 +index bcc0de47fe7e..bd1199825f9f 100644
1791 +--- a/drivers/mmc/host/sdhci-tegra.c
1792 ++++ b/drivers/mmc/host/sdhci-tegra.c
1793 +@@ -148,28 +148,37 @@ static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask)
1794 + return;
1795 +
1796 + misc_ctrl = sdhci_readl(host, SDHCI_TEGRA_VENDOR_MISC_CTRL);
1797 +- /* Erratum: Enable SDHCI spec v3.00 support */
1798 +- if (soc_data->nvquirks & NVQUIRK_ENABLE_SDHCI_SPEC_300)
1799 +- misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDHCI_SPEC_300;
1800 +- /* Advertise UHS modes as supported by host */
1801 +- if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR50)
1802 +- misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDR50;
1803 +- else
1804 +- misc_ctrl &= ~SDHCI_MISC_CTRL_ENABLE_SDR50;
1805 +- if (soc_data->nvquirks & NVQUIRK_ENABLE_DDR50)
1806 +- misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_DDR50;
1807 +- else
1808 +- misc_ctrl &= ~SDHCI_MISC_CTRL_ENABLE_DDR50;
1809 +- if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR104)
1810 +- misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDR104;
1811 +- else
1812 +- misc_ctrl &= ~SDHCI_MISC_CTRL_ENABLE_SDR104;
1813 +- sdhci_writel(host, misc_ctrl, SDHCI_TEGRA_VENDOR_MISC_CTRL);
1814 +-
1815 + clk_ctrl = sdhci_readl(host, SDHCI_TEGRA_VENDOR_CLOCK_CTRL);
1816 ++
1817 ++ misc_ctrl &= ~(SDHCI_MISC_CTRL_ENABLE_SDHCI_SPEC_300 |
1818 ++ SDHCI_MISC_CTRL_ENABLE_SDR50 |
1819 ++ SDHCI_MISC_CTRL_ENABLE_DDR50 |
1820 ++ SDHCI_MISC_CTRL_ENABLE_SDR104);
1821 ++
1822 + clk_ctrl &= ~SDHCI_CLOCK_CTRL_SPI_MODE_CLKEN_OVERRIDE;
1823 +- if (soc_data->nvquirks & SDHCI_MISC_CTRL_ENABLE_SDR50)
1824 +- clk_ctrl |= SDHCI_CLOCK_CTRL_SDR50_TUNING_OVERRIDE;
1825 ++
1826 ++ /*
1827 ++ * If the board does not define a regulator for the SDHCI
1828 ++ * IO voltage, then don't advertise support for UHS modes
1829 ++ * even if the device supports it because the IO voltage
1830 ++ * cannot be configured.
1831 ++ */
1832 ++ if (!IS_ERR(host->mmc->supply.vqmmc)) {
1833 ++ /* Erratum: Enable SDHCI spec v3.00 support */
1834 ++ if (soc_data->nvquirks & NVQUIRK_ENABLE_SDHCI_SPEC_300)
1835 ++ misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDHCI_SPEC_300;
1836 ++ /* Advertise UHS modes as supported by host */
1837 ++ if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR50)
1838 ++ misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDR50;
1839 ++ if (soc_data->nvquirks & NVQUIRK_ENABLE_DDR50)
1840 ++ misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_DDR50;
1841 ++ if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR104)
1842 ++ misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDR104;
1843 ++ if (soc_data->nvquirks & SDHCI_MISC_CTRL_ENABLE_SDR50)
1844 ++ clk_ctrl |= SDHCI_CLOCK_CTRL_SDR50_TUNING_OVERRIDE;
1845 ++ }
1846 ++
1847 ++ sdhci_writel(host, misc_ctrl, SDHCI_TEGRA_VENDOR_MISC_CTRL);
1848 + sdhci_writel(host, clk_ctrl, SDHCI_TEGRA_VENDOR_CLOCK_CTRL);
1849 +
1850 + if (soc_data->nvquirks & NVQUIRK_HAS_PADCALIB)
1851 +diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
1852 +index cc07ba0f044d..27fa8b87cd5f 100644
1853 +--- a/drivers/mtd/nand/davinci_nand.c
1854 ++++ b/drivers/mtd/nand/davinci_nand.c
1855 +@@ -240,6 +240,9 @@ static void nand_davinci_hwctl_4bit(struct mtd_info *mtd, int mode)
1856 + unsigned long flags;
1857 + u32 val;
1858 +
1859 ++ /* Reset ECC hardware */
1860 ++ davinci_nand_readl(info, NAND_4BIT_ECC1_OFFSET);
1861 ++
1862 + spin_lock_irqsave(&davinci_nand_lock, flags);
1863 +
1864 + /* Start 4-bit ECC calculation for read/write */
1865 +diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
1866 +index ad535a854e5c..eab132778e67 100644
1867 +--- a/drivers/net/can/dev.c
1868 ++++ b/drivers/net/can/dev.c
1869 +@@ -21,6 +21,7 @@
1870 + #include <linux/slab.h>
1871 + #include <linux/netdevice.h>
1872 + #include <linux/if_arp.h>
1873 ++#include <linux/workqueue.h>
1874 + #include <linux/can.h>
1875 + #include <linux/can/dev.h>
1876 + #include <linux/can/skb.h>
1877 +@@ -471,9 +472,8 @@ EXPORT_SYMBOL_GPL(can_free_echo_skb);
1878 + /*
1879 + * CAN device restart for bus-off recovery
1880 + */
1881 +-static void can_restart(unsigned long data)
1882 ++static void can_restart(struct net_device *dev)
1883 + {
1884 +- struct net_device *dev = (struct net_device *)data;
1885 + struct can_priv *priv = netdev_priv(dev);
1886 + struct net_device_stats *stats = &dev->stats;
1887 + struct sk_buff *skb;
1888 +@@ -513,6 +513,14 @@ restart:
1889 + netdev_err(dev, "Error %d during restart", err);
1890 + }
1891 +
1892 ++static void can_restart_work(struct work_struct *work)
1893 ++{
1894 ++ struct delayed_work *dwork = to_delayed_work(work);
1895 ++ struct can_priv *priv = container_of(dwork, struct can_priv, restart_work);
1896 ++
1897 ++ can_restart(priv->dev);
1898 ++}
1899 ++
1900 + int can_restart_now(struct net_device *dev)
1901 + {
1902 + struct can_priv *priv = netdev_priv(dev);
1903 +@@ -526,8 +534,8 @@ int can_restart_now(struct net_device *dev)
1904 + if (priv->state != CAN_STATE_BUS_OFF)
1905 + return -EBUSY;
1906 +
1907 +- /* Runs as soon as possible in the timer context */
1908 +- mod_timer(&priv->restart_timer, jiffies);
1909 ++ cancel_delayed_work_sync(&priv->restart_work);
1910 ++ can_restart(dev);
1911 +
1912 + return 0;
1913 + }
1914 +@@ -548,8 +556,8 @@ void can_bus_off(struct net_device *dev)
1915 + netif_carrier_off(dev);
1916 +
1917 + if (priv->restart_ms)
1918 +- mod_timer(&priv->restart_timer,
1919 +- jiffies + (priv->restart_ms * HZ) / 1000);
1920 ++ schedule_delayed_work(&priv->restart_work,
1921 ++ msecs_to_jiffies(priv->restart_ms));
1922 + }
1923 + EXPORT_SYMBOL_GPL(can_bus_off);
1924 +
1925 +@@ -658,6 +666,7 @@ struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max)
1926 + return NULL;
1927 +
1928 + priv = netdev_priv(dev);
1929 ++ priv->dev = dev;
1930 +
1931 + if (echo_skb_max) {
1932 + priv->echo_skb_max = echo_skb_max;
1933 +@@ -667,7 +676,7 @@ struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max)
1934 +
1935 + priv->state = CAN_STATE_STOPPED;
1936 +
1937 +- init_timer(&priv->restart_timer);
1938 ++ INIT_DELAYED_WORK(&priv->restart_work, can_restart_work);
1939 +
1940 + return dev;
1941 + }
1942 +@@ -748,8 +757,6 @@ int open_candev(struct net_device *dev)
1943 + if (!netif_carrier_ok(dev))
1944 + netif_carrier_on(dev);
1945 +
1946 +- setup_timer(&priv->restart_timer, can_restart, (unsigned long)dev);
1947 +-
1948 + return 0;
1949 + }
1950 + EXPORT_SYMBOL_GPL(open_candev);
1951 +@@ -764,7 +771,7 @@ void close_candev(struct net_device *dev)
1952 + {
1953 + struct can_priv *priv = netdev_priv(dev);
1954 +
1955 +- del_timer_sync(&priv->restart_timer);
1956 ++ cancel_delayed_work_sync(&priv->restart_work);
1957 + can_flush_echo_skb(dev);
1958 + }
1959 + EXPORT_SYMBOL_GPL(close_candev);
1960 +diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
1961 +index 9c0d87503977..9b5195435c87 100644
1962 +--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
1963 ++++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
1964 +@@ -983,9 +983,10 @@ void fm10k_write_reta(struct fm10k_intfc *interface, const u32 *indir)
1965 + /* generate a new table if we weren't given one */
1966 + for (j = 0; j < 4; j++) {
1967 + if (indir)
1968 +- n = indir[i + j];
1969 ++ n = indir[4 * i + j];
1970 + else
1971 +- n = ethtool_rxfh_indir_default(i + j, rss_i);
1972 ++ n = ethtool_rxfh_indir_default(4 * i + j,
1973 ++ rss_i);
1974 +
1975 + table[j] = n;
1976 + }
1977 +diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
1978 +index 422b41d61c9a..d5cb570d67b7 100644
1979 +--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
1980 ++++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
1981 +@@ -297,13 +297,15 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
1982 + void *buffer, u16 buf_len)
1983 + {
1984 + struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc;
1985 +- u16 len = le16_to_cpu(aq_desc->datalen);
1986 ++ u16 len;
1987 + u8 *buf = (u8 *)buffer;
1988 + u16 i = 0;
1989 +
1990 + if ((!(mask & hw->debug_mask)) || (desc == NULL))
1991 + return;
1992 +
1993 ++ len = le16_to_cpu(aq_desc->datalen);
1994 ++
1995 + i40e_debug(hw, mask,
1996 + "AQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n",
1997 + le16_to_cpu(aq_desc->opcode),
1998 +diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
1999 +index 813cdd2621a1..d3f8b9f7756b 100644
2000 +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
2001 ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
2002 +@@ -1524,7 +1524,7 @@ static void ath10k_htt_rx_h_filter(struct ath10k *ar,
2003 + static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
2004 + {
2005 + struct ath10k *ar = htt->ar;
2006 +- static struct ieee80211_rx_status rx_status;
2007 ++ struct ieee80211_rx_status *rx_status = &htt->rx_status;
2008 + struct sk_buff_head amsdu;
2009 + int ret;
2010 +
2011 +@@ -1548,11 +1548,11 @@ static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
2012 + return ret;
2013 + }
2014 +
2015 +- ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff);
2016 ++ ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
2017 + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
2018 +- ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status);
2019 +- ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status);
2020 +- ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status);
2021 ++ ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
2022 ++ ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
2023 ++ ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
2024 +
2025 + return 0;
2026 + }
2027 +diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
2028 +index dec1a317a070..e2083f4d2d48 100644
2029 +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
2030 ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
2031 +@@ -4176,7 +4176,7 @@ static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah,
2032 + if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah))
2033 + ar9003_hw_internal_regulator_apply(ah);
2034 + ar9003_hw_apply_tuning_caps(ah);
2035 +- ar9003_hw_apply_minccapwr_thresh(ah, chan);
2036 ++ ar9003_hw_apply_minccapwr_thresh(ah, is2ghz);
2037 + ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz);
2038 + ar9003_hw_thermometer_apply(ah);
2039 + ar9003_hw_thermo_cal_apply(ah);
2040 +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
2041 +index c7550dab6a23..570c80a5419d 100644
2042 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
2043 ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
2044 +@@ -722,8 +722,10 @@ int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev,
2045 + return -ENOMEM;
2046 + err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr,
2047 + glom_skb);
2048 +- if (err)
2049 ++ if (err) {
2050 ++ brcmu_pkt_buf_free_skb(glom_skb);
2051 + goto done;
2052 ++ }
2053 +
2054 + skb_queue_walk(pktq, skb) {
2055 + memcpy(skb->data, glom_skb->data, skb->len);
2056 +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c
2057 +index 796f5f9d5d5a..b7df576bb84d 100644
2058 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c
2059 ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c
2060 +@@ -1079,8 +1079,10 @@ bool dma_rxfill(struct dma_pub *pub)
2061 +
2062 + pa = dma_map_single(di->dmadev, p->data, di->rxbufsize,
2063 + DMA_FROM_DEVICE);
2064 +- if (dma_mapping_error(di->dmadev, pa))
2065 ++ if (dma_mapping_error(di->dmadev, pa)) {
2066 ++ brcmu_pkt_buf_free_skb(p);
2067 + return false;
2068 ++ }
2069 +
2070 + /* save the free packet pointer */
2071 + di->rxp[rxout] = p;
2072 +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/stf.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/stf.c
2073 +index dd9162722495..0ab865de1491 100644
2074 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/stf.c
2075 ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/stf.c
2076 +@@ -87,7 +87,7 @@ void
2077 + brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel,
2078 + u16 chanspec)
2079 + {
2080 +- struct tx_power power;
2081 ++ struct tx_power power = { };
2082 + u8 siso_mcs_id, cdd_mcs_id, stbc_mcs_id;
2083 +
2084 + /* Clear previous settings */
2085 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
2086 +index e1b6b2c665eb..46b52bf705fb 100644
2087 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
2088 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
2089 +@@ -288,7 +288,8 @@ static void iwl_mvm_dump_fifos(struct iwl_mvm *mvm,
2090 + fifo_hdr->fifo_num = cpu_to_le32(i);
2091 +
2092 + /* Mark the number of TXF we're pulling now */
2093 +- iwl_trans_write_prph(mvm->trans, TXF_CPU2_NUM, i);
2094 ++ iwl_trans_write_prph(mvm->trans, TXF_CPU2_NUM, i +
2095 ++ ARRAY_SIZE(mvm->shared_mem_cfg.txfifo_size));
2096 +
2097 + fifo_hdr->available_bytes =
2098 + cpu_to_le32(iwl_trans_read_prph(mvm->trans,
2099 +@@ -959,5 +960,6 @@ int iwl_mvm_start_fw_dbg_conf(struct iwl_mvm *mvm, u8 conf_id)
2100 + }
2101 +
2102 + mvm->fw_dbg_conf = conf_id;
2103 +- return ret;
2104 ++
2105 ++ return 0;
2106 + }
2107 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
2108 +index 7057f35cb2e7..fb71cf6910df 100644
2109 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
2110 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
2111 +@@ -139,17 +139,21 @@ void iwl_free_fw_paging(struct iwl_mvm *mvm)
2112 + return;
2113 +
2114 + for (i = 0; i < NUM_OF_FW_PAGING_BLOCKS; i++) {
2115 +- if (!mvm->fw_paging_db[i].fw_paging_block) {
2116 ++ struct iwl_fw_paging *paging = &mvm->fw_paging_db[i];
2117 ++
2118 ++ if (!paging->fw_paging_block) {
2119 + IWL_DEBUG_FW(mvm,
2120 + "Paging: block %d already freed, continue to next page\n",
2121 + i);
2122 +
2123 + continue;
2124 + }
2125 ++ dma_unmap_page(mvm->trans->dev, paging->fw_paging_phys,
2126 ++ paging->fw_paging_size, DMA_BIDIRECTIONAL);
2127 +
2128 +- __free_pages(mvm->fw_paging_db[i].fw_paging_block,
2129 +- get_order(mvm->fw_paging_db[i].fw_paging_size));
2130 +- mvm->fw_paging_db[i].fw_paging_block = NULL;
2131 ++ __free_pages(paging->fw_paging_block,
2132 ++ get_order(paging->fw_paging_size));
2133 ++ paging->fw_paging_block = NULL;
2134 + }
2135 + kfree(mvm->trans->paging_download_buf);
2136 + mvm->trans->paging_download_buf = NULL;
2137 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
2138 +index 25a98401a64f..0551a4bb163c 100644
2139 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
2140 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
2141 +@@ -667,8 +667,7 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
2142 + .mcc = cpu_to_le16(alpha2[0] << 8 | alpha2[1]),
2143 + .source_id = (u8)src_id,
2144 + };
2145 +- struct iwl_mcc_update_resp *mcc_resp, *resp_cp = NULL;
2146 +- struct iwl_mcc_update_resp_v1 *mcc_resp_v1 = NULL;
2147 ++ struct iwl_mcc_update_resp *resp_cp;
2148 + struct iwl_rx_packet *pkt;
2149 + struct iwl_host_cmd cmd = {
2150 + .id = MCC_UPDATE_CMD,
2151 +@@ -701,34 +700,36 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
2152 +
2153 + /* Extract MCC response */
2154 + if (resp_v2) {
2155 +- mcc_resp = (void *)pkt->data;
2156 ++ struct iwl_mcc_update_resp *mcc_resp = (void *)pkt->data;
2157 ++
2158 + n_channels = __le32_to_cpu(mcc_resp->n_channels);
2159 ++ resp_len = sizeof(struct iwl_mcc_update_resp) +
2160 ++ n_channels * sizeof(__le32);
2161 ++ resp_cp = kmemdup(mcc_resp, resp_len, GFP_KERNEL);
2162 + } else {
2163 +- mcc_resp_v1 = (void *)pkt->data;
2164 ++ struct iwl_mcc_update_resp_v1 *mcc_resp_v1 = (void *)pkt->data;
2165 ++
2166 + n_channels = __le32_to_cpu(mcc_resp_v1->n_channels);
2167 ++ resp_len = sizeof(struct iwl_mcc_update_resp) +
2168 ++ n_channels * sizeof(__le32);
2169 ++ resp_cp = kzalloc(resp_len, GFP_KERNEL);
2170 ++
2171 ++ if (resp_cp) {
2172 ++ resp_cp->status = mcc_resp_v1->status;
2173 ++ resp_cp->mcc = mcc_resp_v1->mcc;
2174 ++ resp_cp->cap = mcc_resp_v1->cap;
2175 ++ resp_cp->source_id = mcc_resp_v1->source_id;
2176 ++ resp_cp->n_channels = mcc_resp_v1->n_channels;
2177 ++ memcpy(resp_cp->channels, mcc_resp_v1->channels,
2178 ++ n_channels * sizeof(__le32));
2179 ++ }
2180 + }
2181 +
2182 +- resp_len = sizeof(struct iwl_mcc_update_resp) + n_channels *
2183 +- sizeof(__le32);
2184 +-
2185 +- resp_cp = kzalloc(resp_len, GFP_KERNEL);
2186 + if (!resp_cp) {
2187 + ret = -ENOMEM;
2188 + goto exit;
2189 + }
2190 +
2191 +- if (resp_v2) {
2192 +- memcpy(resp_cp, mcc_resp, resp_len);
2193 +- } else {
2194 +- resp_cp->status = mcc_resp_v1->status;
2195 +- resp_cp->mcc = mcc_resp_v1->mcc;
2196 +- resp_cp->cap = mcc_resp_v1->cap;
2197 +- resp_cp->source_id = mcc_resp_v1->source_id;
2198 +- resp_cp->n_channels = mcc_resp_v1->n_channels;
2199 +- memcpy(resp_cp->channels, mcc_resp_v1->channels,
2200 +- n_channels * sizeof(__le32));
2201 +- }
2202 +-
2203 + status = le32_to_cpu(resp_cp->status);
2204 +
2205 + mcc = le16_to_cpu(resp_cp->mcc);
2206 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sf.c b/drivers/net/wireless/intel/iwlwifi/mvm/sf.c
2207 +index 443a42855c9e..101fb04a8573 100644
2208 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/sf.c
2209 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/sf.c
2210 +@@ -215,7 +215,7 @@ static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id,
2211 + enum iwl_sf_state new_state)
2212 + {
2213 + struct iwl_sf_cfg_cmd sf_cmd = {
2214 +- .state = cpu_to_le32(SF_FULL_ON),
2215 ++ .state = cpu_to_le32(new_state),
2216 + };
2217 + struct ieee80211_sta *sta;
2218 + int ret = 0;
2219 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
2220 +index b23ab4a4504f..1822ad374be3 100644
2221 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
2222 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
2223 +@@ -1374,11 +1374,12 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
2224 + */
2225 + WARN_ON(rcu_access_pointer(mvm->baid_map[baid]));
2226 + rcu_assign_pointer(mvm->baid_map[baid], baid_data);
2227 +- } else if (mvm->rx_ba_sessions > 0) {
2228 ++ } else {
2229 + u8 baid = mvm_sta->tid_to_baid[tid];
2230 +
2231 +- /* check that restart flow didn't zero the counter */
2232 +- mvm->rx_ba_sessions--;
2233 ++ if (mvm->rx_ba_sessions > 0)
2234 ++ /* check that restart flow didn't zero the counter */
2235 ++ mvm->rx_ba_sessions--;
2236 + if (!iwl_mvm_has_new_rx_api(mvm))
2237 + return 0;
2238 +
2239 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
2240 +index b92b75fea92f..6b8d9a5ab855 100644
2241 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
2242 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
2243 +@@ -138,28 +138,19 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
2244 +
2245 + protocol = ipv6h->nexthdr;
2246 + while (protocol != NEXTHDR_NONE && ipv6_ext_hdr(protocol)) {
2247 ++ struct ipv6_opt_hdr *hp;
2248 ++
2249 + /* only supported extension headers */
2250 + if (protocol != NEXTHDR_ROUTING &&
2251 + protocol != NEXTHDR_HOP &&
2252 +- protocol != NEXTHDR_DEST &&
2253 +- protocol != NEXTHDR_FRAGMENT) {
2254 ++ protocol != NEXTHDR_DEST) {
2255 + skb_checksum_help(skb);
2256 + return;
2257 + }
2258 +
2259 +- if (protocol == NEXTHDR_FRAGMENT) {
2260 +- struct frag_hdr *hp =
2261 +- OPT_HDR(struct frag_hdr, skb, off);
2262 +-
2263 +- protocol = hp->nexthdr;
2264 +- off += sizeof(struct frag_hdr);
2265 +- } else {
2266 +- struct ipv6_opt_hdr *hp =
2267 +- OPT_HDR(struct ipv6_opt_hdr, skb, off);
2268 +-
2269 +- protocol = hp->nexthdr;
2270 +- off += ipv6_optlen(hp);
2271 +- }
2272 ++ hp = OPT_HDR(struct ipv6_opt_hdr, skb, off);
2273 ++ protocol = hp->nexthdr;
2274 ++ off += ipv6_optlen(hp);
2275 + }
2276 + /* if we get here - protocol now should be TCP/UDP */
2277 + #endif
2278 +@@ -1312,7 +1303,15 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
2279 + bool send_eosp_ndp = false;
2280 +
2281 + spin_lock_bh(&mvmsta->lock);
2282 +- txq_agg = (mvmsta->tid_data[tid].state == IWL_AGG_ON);
2283 ++ if (iwl_mvm_is_dqa_supported(mvm)) {
2284 ++ enum iwl_mvm_agg_state state;
2285 ++
2286 ++ state = mvmsta->tid_data[tid].state;
2287 ++ txq_agg = (state == IWL_AGG_ON ||
2288 ++ state == IWL_EMPTYING_HW_QUEUE_DELBA);
2289 ++ } else {
2290 ++ txq_agg = txq_id >= mvm->first_agg_queue;
2291 ++ }
2292 +
2293 + if (!is_ndp) {
2294 + tid_data->next_reclaimed = next_reclaimed;
2295 +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
2296 +index d6beac9af029..dec63a0aef6b 100644
2297 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
2298 ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
2299 +@@ -1595,9 +1595,9 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
2300 +
2301 + /* start the TFD with the scratchbuf */
2302 + scratch_size = min_t(int, copy_size, IWL_HCMD_SCRATCHBUF_SIZE);
2303 +- memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size);
2304 ++ memcpy(&txq->scratchbufs[idx], &out_cmd->hdr, scratch_size);
2305 + iwl_pcie_txq_build_tfd(trans, txq,
2306 +- iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr),
2307 ++ iwl_pcie_get_scratchbuf_dma(txq, idx),
2308 + scratch_size, true);
2309 +
2310 + /* map first command fragment, if any remains */
2311 +diff --git a/drivers/net/wireless/marvell/mwifiex/uap_txrx.c b/drivers/net/wireless/marvell/mwifiex/uap_txrx.c
2312 +index 666e91af59d7..bf5660eb27d3 100644
2313 +--- a/drivers/net/wireless/marvell/mwifiex/uap_txrx.c
2314 ++++ b/drivers/net/wireless/marvell/mwifiex/uap_txrx.c
2315 +@@ -272,7 +272,7 @@ int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv,
2316 + int mwifiex_uap_recv_packet(struct mwifiex_private *priv,
2317 + struct sk_buff *skb)
2318 + {
2319 +- struct mwifiex_adapter *adapter = adapter;
2320 ++ struct mwifiex_adapter *adapter = priv->adapter;
2321 + struct mwifiex_sta_node *src_node;
2322 + struct ethhdr *p_ethhdr;
2323 + struct sk_buff *skb_uap;
2324 +diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c
2325 +index e44a7a2f4061..16427420b1a2 100644
2326 +--- a/drivers/nfc/fdp/fdp.c
2327 ++++ b/drivers/nfc/fdp/fdp.c
2328 +@@ -353,7 +353,7 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev)
2329 + {
2330 + struct fdp_nci_info *info = nci_get_drvdata(ndev);
2331 + struct device *dev = &info->phy->i2c_dev->dev;
2332 +- u8 conn_id;
2333 ++ int conn_id;
2334 + int r = 0;
2335 +
2336 + if (info->otp_version >= info->otp_patch_version)
2337 +@@ -424,7 +424,7 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev)
2338 + {
2339 + struct fdp_nci_info *info = nci_get_drvdata(ndev);
2340 + struct device *dev = &info->phy->i2c_dev->dev;
2341 +- u8 conn_id;
2342 ++ int conn_id;
2343 + int r = 0;
2344 +
2345 + if (info->ram_version >= info->ram_patch_version)
2346 +diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
2347 +index 489ea1098c96..69b5e811ea2b 100644
2348 +--- a/drivers/pcmcia/ds.c
2349 ++++ b/drivers/pcmcia/ds.c
2350 +@@ -977,7 +977,7 @@ static int pcmcia_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
2351 +
2352 + /************************ runtime PM support ***************************/
2353 +
2354 +-static int pcmcia_dev_suspend(struct device *dev, pm_message_t state);
2355 ++static int pcmcia_dev_suspend(struct device *dev);
2356 + static int pcmcia_dev_resume(struct device *dev);
2357 +
2358 + static int runtime_suspend(struct device *dev)
2359 +@@ -985,7 +985,7 @@ static int runtime_suspend(struct device *dev)
2360 + int rc;
2361 +
2362 + device_lock(dev);
2363 +- rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND);
2364 ++ rc = pcmcia_dev_suspend(dev);
2365 + device_unlock(dev);
2366 + return rc;
2367 + }
2368 +@@ -1135,7 +1135,7 @@ ATTRIBUTE_GROUPS(pcmcia_dev);
2369 +
2370 + /* PM support, also needed for reset */
2371 +
2372 +-static int pcmcia_dev_suspend(struct device *dev, pm_message_t state)
2373 ++static int pcmcia_dev_suspend(struct device *dev)
2374 + {
2375 + struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
2376 + struct pcmcia_driver *p_drv = NULL;
2377 +@@ -1410,6 +1410,9 @@ static struct class_interface pcmcia_bus_interface __refdata = {
2378 + .remove_dev = &pcmcia_bus_remove_socket,
2379 + };
2380 +
2381 ++static const struct dev_pm_ops pcmcia_bus_pm_ops = {
2382 ++ SET_SYSTEM_SLEEP_PM_OPS(pcmcia_dev_suspend, pcmcia_dev_resume)
2383 ++};
2384 +
2385 + struct bus_type pcmcia_bus_type = {
2386 + .name = "pcmcia",
2387 +@@ -1418,8 +1421,7 @@ struct bus_type pcmcia_bus_type = {
2388 + .dev_groups = pcmcia_dev_groups,
2389 + .probe = pcmcia_device_probe,
2390 + .remove = pcmcia_device_remove,
2391 +- .suspend = pcmcia_dev_suspend,
2392 +- .resume = pcmcia_dev_resume,
2393 ++ .pm = &pcmcia_bus_pm_ops,
2394 + };
2395 +
2396 +
2397 +diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
2398 +index 140436a046c0..5824045fab46 100644
2399 +--- a/drivers/perf/arm_pmu.c
2400 ++++ b/drivers/perf/arm_pmu.c
2401 +@@ -921,6 +921,7 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu)
2402 + if (i > 0 && spi != using_spi) {
2403 + pr_err("PPI/SPI IRQ type mismatch for %s!\n",
2404 + dn->name);
2405 ++ of_node_put(dn);
2406 + kfree(irqs);
2407 + return -EINVAL;
2408 + }
2409 +diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
2410 +index 967400971d45..5d08de0b13f5 100644
2411 +--- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
2412 ++++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
2413 +@@ -73,6 +73,12 @@ static void uniphier_pctl_pin_dbg_show(struct pinctrl_dev *pctldev,
2414 + case UNIPHIER_PIN_PULL_DOWN:
2415 + pull_dir = "DOWN";
2416 + break;
2417 ++ case UNIPHIER_PIN_PULL_UP_FIXED:
2418 ++ pull_dir = "UP(FIXED)";
2419 ++ break;
2420 ++ case UNIPHIER_PIN_PULL_DOWN_FIXED:
2421 ++ pull_dir = "DOWN(FIXED)";
2422 ++ break;
2423 + case UNIPHIER_PIN_PULL_NONE:
2424 + pull_dir = "NONE";
2425 + break;
2426 +diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
2427 +index fafa3488e960..36e0c930ab49 100644
2428 +--- a/drivers/regulator/pwm-regulator.c
2429 ++++ b/drivers/regulator/pwm-regulator.c
2430 +@@ -132,6 +132,7 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev,
2431 + unsigned int duty_pulse;
2432 + u64 req_period;
2433 + u32 rem;
2434 ++ int old_uV = pwm_regulator_get_voltage(rdev);
2435 + int ret;
2436 +
2437 + pwm_get_args(drvdata->pwm, &pargs);
2438 +@@ -166,8 +167,12 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev,
2439 + }
2440 + drvdata->volt_uV = min_uV;
2441 +
2442 +- /* Delay required by PWM regulator to settle to the new voltage */
2443 +- usleep_range(ramp_delay, ramp_delay + 1000);
2444 ++ if ((ramp_delay == 0) || !pwm_regulator_is_enabled(rdev))
2445 ++ return 0;
2446 ++
2447 ++ /* Ramp delay is in uV/uS. Adjust to uS and delay */
2448 ++ ramp_delay = DIV_ROUND_UP(abs(min_uV - old_uV), ramp_delay);
2449 ++ usleep_range(ramp_delay, ramp_delay + DIV_ROUND_UP(ramp_delay, 10));
2450 +
2451 + return 0;
2452 + }
2453 +diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c
2454 +index 6c7fe4778793..891ae44a49c2 100644
2455 +--- a/drivers/regulator/qcom_smd-regulator.c
2456 ++++ b/drivers/regulator/qcom_smd-regulator.c
2457 +@@ -178,20 +178,21 @@ static const struct regulator_desc pma8084_hfsmps = {
2458 + static const struct regulator_desc pma8084_ftsmps = {
2459 + .linear_ranges = (struct regulator_linear_range[]) {
2460 + REGULATOR_LINEAR_RANGE(350000, 0, 184, 5000),
2461 +- REGULATOR_LINEAR_RANGE(700000, 185, 339, 10000),
2462 ++ REGULATOR_LINEAR_RANGE(1280000, 185, 261, 10000),
2463 + },
2464 + .n_linear_ranges = 2,
2465 +- .n_voltages = 340,
2466 ++ .n_voltages = 262,
2467 + .ops = &rpm_smps_ldo_ops,
2468 + };
2469 +
2470 + static const struct regulator_desc pma8084_pldo = {
2471 + .linear_ranges = (struct regulator_linear_range[]) {
2472 +- REGULATOR_LINEAR_RANGE(750000, 0, 30, 25000),
2473 +- REGULATOR_LINEAR_RANGE(1500000, 31, 99, 50000),
2474 ++ REGULATOR_LINEAR_RANGE( 750000, 0, 63, 12500),
2475 ++ REGULATOR_LINEAR_RANGE(1550000, 64, 126, 25000),
2476 ++ REGULATOR_LINEAR_RANGE(3100000, 127, 163, 50000),
2477 + },
2478 +- .n_linear_ranges = 2,
2479 +- .n_voltages = 100,
2480 ++ .n_linear_ranges = 3,
2481 ++ .n_voltages = 164,
2482 + .ops = &rpm_smps_ldo_ops,
2483 + };
2484 +
2485 +@@ -221,29 +222,30 @@ static const struct regulator_desc pm8x41_hfsmps = {
2486 + static const struct regulator_desc pm8841_ftsmps = {
2487 + .linear_ranges = (struct regulator_linear_range[]) {
2488 + REGULATOR_LINEAR_RANGE(350000, 0, 184, 5000),
2489 +- REGULATOR_LINEAR_RANGE(700000, 185, 339, 10000),
2490 ++ REGULATOR_LINEAR_RANGE(1280000, 185, 261, 10000),
2491 + },
2492 + .n_linear_ranges = 2,
2493 +- .n_voltages = 340,
2494 ++ .n_voltages = 262,
2495 + .ops = &rpm_smps_ldo_ops,
2496 + };
2497 +
2498 + static const struct regulator_desc pm8941_boost = {
2499 + .linear_ranges = (struct regulator_linear_range[]) {
2500 +- REGULATOR_LINEAR_RANGE(4000000, 0, 15, 100000),
2501 ++ REGULATOR_LINEAR_RANGE(4000000, 0, 30, 50000),
2502 + },
2503 + .n_linear_ranges = 1,
2504 +- .n_voltages = 16,
2505 ++ .n_voltages = 31,
2506 + .ops = &rpm_smps_ldo_ops,
2507 + };
2508 +
2509 + static const struct regulator_desc pm8941_pldo = {
2510 + .linear_ranges = (struct regulator_linear_range[]) {
2511 +- REGULATOR_LINEAR_RANGE( 750000, 0, 30, 25000),
2512 +- REGULATOR_LINEAR_RANGE(1500000, 31, 99, 50000),
2513 ++ REGULATOR_LINEAR_RANGE( 750000, 0, 63, 12500),
2514 ++ REGULATOR_LINEAR_RANGE(1550000, 64, 126, 25000),
2515 ++ REGULATOR_LINEAR_RANGE(3100000, 127, 163, 50000),
2516 + },
2517 +- .n_linear_ranges = 2,
2518 +- .n_voltages = 100,
2519 ++ .n_linear_ranges = 3,
2520 ++ .n_voltages = 164,
2521 + .ops = &rpm_smps_ldo_ops,
2522 + };
2523 +
2524 +diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
2525 +index 84cce21e98cd..16c5f84e06a7 100644
2526 +--- a/drivers/regulator/qcom_spmi-regulator.c
2527 ++++ b/drivers/regulator/qcom_spmi-regulator.c
2528 +@@ -1085,6 +1085,8 @@ static struct regulator_ops spmi_vs_ops = {
2529 + .set_pull_down = spmi_regulator_common_set_pull_down,
2530 + .set_soft_start = spmi_regulator_common_set_soft_start,
2531 + .set_over_current_protection = spmi_regulator_vs_ocp,
2532 ++ .set_mode = spmi_regulator_common_set_mode,
2533 ++ .get_mode = spmi_regulator_common_get_mode,
2534 + };
2535 +
2536 + static struct regulator_ops spmi_boost_ops = {
2537 +@@ -1496,6 +1498,7 @@ static const struct spmi_regulator_data pm8941_regulators[] = {
2538 + { "s1", 0x1400, "vdd_s1", },
2539 + { "s2", 0x1700, "vdd_s2", },
2540 + { "s3", 0x1a00, "vdd_s3", },
2541 ++ { "s4", 0xa000, },
2542 + { "l1", 0x4000, "vdd_l1_l3", },
2543 + { "l2", 0x4100, "vdd_l2_lvs_1_2_3", },
2544 + { "l3", 0x4200, "vdd_l1_l3", },
2545 +@@ -1523,8 +1526,8 @@ static const struct spmi_regulator_data pm8941_regulators[] = {
2546 + { "lvs1", 0x8000, "vdd_l2_lvs_1_2_3", },
2547 + { "lvs2", 0x8100, "vdd_l2_lvs_1_2_3", },
2548 + { "lvs3", 0x8200, "vdd_l2_lvs_1_2_3", },
2549 +- { "mvs1", 0x8300, "vin_5vs", },
2550 +- { "mvs2", 0x8400, "vin_5vs", },
2551 ++ { "5vs1", 0x8300, "vin_5vs", "ocp-5vs1", },
2552 ++ { "5vs2", 0x8400, "vin_5vs", "ocp-5vs2", },
2553 + { }
2554 + };
2555 +
2556 +diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c
2557 +index 67669a9e73c1..f3a33312a9a6 100644
2558 +--- a/drivers/scsi/fnic/fnic_fcs.c
2559 ++++ b/drivers/scsi/fnic/fnic_fcs.c
2560 +@@ -954,8 +954,8 @@ int fnic_alloc_rq_frame(struct vnic_rq *rq)
2561 + skb_put(skb, len);
2562 + pa = pci_map_single(fnic->pdev, skb->data, len, PCI_DMA_FROMDEVICE);
2563 +
2564 +- r = pci_dma_mapping_error(fnic->pdev, pa);
2565 +- if (r) {
2566 ++ if (pci_dma_mapping_error(fnic->pdev, pa)) {
2567 ++ r = -ENOMEM;
2568 + printk(KERN_ERR "PCI mapping failed with error %d\n", r);
2569 + goto free_skb;
2570 + }
2571 +@@ -1093,8 +1093,8 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp)
2572 +
2573 + pa = pci_map_single(fnic->pdev, eth_hdr, tot_len, PCI_DMA_TODEVICE);
2574 +
2575 +- ret = pci_dma_mapping_error(fnic->pdev, pa);
2576 +- if (ret) {
2577 ++ if (pci_dma_mapping_error(fnic->pdev, pa)) {
2578 ++ ret = -ENOMEM;
2579 + printk(KERN_ERR "DMA map failed with error %d\n", ret);
2580 + goto free_skb_on_err;
2581 + }
2582 +diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
2583 +index 4c0f3a774799..8a2368b32dec 100644
2584 +--- a/drivers/scsi/qla2xxx/qla_fw.h
2585 ++++ b/drivers/scsi/qla2xxx/qla_fw.h
2586 +@@ -1288,7 +1288,7 @@ struct vp_rpt_id_entry_24xx {
2587 +
2588 + uint8_t vp_idx_map[16];
2589 +
2590 +- uint8_t reserved_4[28];
2591 ++ uint8_t reserved_4[24];
2592 + uint16_t bbcr;
2593 + uint8_t reserved_5[6];
2594 + };
2595 +diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
2596 +index 53ef1cb6418e..1d82053a6a0c 100644
2597 +--- a/drivers/scsi/ses.c
2598 ++++ b/drivers/scsi/ses.c
2599 +@@ -587,7 +587,7 @@ static void ses_match_to_enclosure(struct enclosure_device *edev,
2600 +
2601 + ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0);
2602 +
2603 +- if (is_sas_attached(sdev))
2604 ++ if (scsi_is_sas_rphy(&sdev->sdev_gendev))
2605 + efd.addr = sas_get_address(sdev);
2606 +
2607 + if (efd.addr) {
2608 +diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
2609 +index a7934ab00b96..d22de4c8c399 100644
2610 +--- a/drivers/spi/spi-sh-msiof.c
2611 ++++ b/drivers/spi/spi-sh-msiof.c
2612 +@@ -263,6 +263,9 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p,
2613 +
2614 + for (k = 0; k < ARRAY_SIZE(sh_msiof_spi_div_table); k++) {
2615 + brps = DIV_ROUND_UP(div, sh_msiof_spi_div_table[k].div);
2616 ++ /* SCR_BRDV_DIV_1 is valid only if BRPS is x 1/1 or x 1/2 */
2617 ++ if (sh_msiof_spi_div_table[k].div == 1 && brps > 2)
2618 ++ continue;
2619 + if (brps <= 32) /* max of brdv is 32 */
2620 + break;
2621 + }
2622 +diff --git a/drivers/staging/comedi/drivers/adv_pci1760.c b/drivers/staging/comedi/drivers/adv_pci1760.c
2623 +index d7dd1e55e347..9f525ff7290c 100644
2624 +--- a/drivers/staging/comedi/drivers/adv_pci1760.c
2625 ++++ b/drivers/staging/comedi/drivers/adv_pci1760.c
2626 +@@ -196,6 +196,7 @@ static int pci1760_pwm_ns_to_div(unsigned int flags, unsigned int ns)
2627 + break;
2628 + case CMDF_ROUND_DOWN:
2629 + divisor = ns / PCI1760_PWM_TIMEBASE;
2630 ++ break;
2631 + default:
2632 + return -EINVAL;
2633 + }
2634 +diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
2635 +index 0c1a77cafe14..4c281df16816 100644
2636 +--- a/drivers/staging/fbtft/fbtft-core.c
2637 ++++ b/drivers/staging/fbtft/fbtft-core.c
2638 +@@ -391,11 +391,11 @@ static void fbtft_update_display(struct fbtft_par *par, unsigned start_line,
2639 +
2640 + if (unlikely(timeit)) {
2641 + ts_end = ktime_get();
2642 +- if (ktime_to_ns(par->update_time))
2643 ++ if (!ktime_to_ns(par->update_time))
2644 + par->update_time = ts_start;
2645 +
2646 +- par->update_time = ts_start;
2647 + fps = ktime_us_delta(ts_start, par->update_time);
2648 ++ par->update_time = ts_start;
2649 + fps = fps ? 1000000 / fps : 0;
2650 +
2651 + throughput = ktime_us_delta(ts_end, ts_start);
2652 +diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
2653 +index 917a55c4480d..ffe9f8875311 100644
2654 +--- a/drivers/usb/class/usbtmc.c
2655 ++++ b/drivers/usb/class/usbtmc.c
2656 +@@ -141,6 +141,7 @@ static void usbtmc_delete(struct kref *kref)
2657 + struct usbtmc_device_data *data = to_usbtmc_data(kref);
2658 +
2659 + usb_put_dev(data->usb_dev);
2660 ++ kfree(data);
2661 + }
2662 +
2663 + static int usbtmc_open(struct inode *inode, struct file *filp)
2664 +@@ -1379,7 +1380,7 @@ static int usbtmc_probe(struct usb_interface *intf,
2665 +
2666 + dev_dbg(&intf->dev, "%s called\n", __func__);
2667 +
2668 +- data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
2669 ++ data = kmalloc(sizeof(*data), GFP_KERNEL);
2670 + if (!data)
2671 + return -ENOMEM;
2672 +
2673 +diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c
2674 +index cf8819a5c5b2..8bb011ea78f7 100644
2675 +--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
2676 ++++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
2677 +@@ -1878,11 +1878,8 @@ static int qe_get_frame(struct usb_gadget *gadget)
2678 +
2679 + tmp = in_be16(&udc->usb_param->frame_n);
2680 + if (tmp & 0x8000)
2681 +- tmp = tmp & 0x07ff;
2682 +- else
2683 +- tmp = -EINVAL;
2684 +-
2685 +- return (int)tmp;
2686 ++ return tmp & 0x07ff;
2687 ++ return -EINVAL;
2688 + }
2689 +
2690 + static int fsl_qe_start(struct usb_gadget *gadget,
2691 +diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
2692 +index 7771be3ac178..4dd531ac5a7f 100644
2693 +--- a/drivers/usb/misc/legousbtower.c
2694 ++++ b/drivers/usb/misc/legousbtower.c
2695 +@@ -898,24 +898,6 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device
2696 + dev->interrupt_in_interval = interrupt_in_interval ? interrupt_in_interval : dev->interrupt_in_endpoint->bInterval;
2697 + dev->interrupt_out_interval = interrupt_out_interval ? interrupt_out_interval : dev->interrupt_out_endpoint->bInterval;
2698 +
2699 +- /* we can register the device now, as it is ready */
2700 +- usb_set_intfdata (interface, dev);
2701 +-
2702 +- retval = usb_register_dev (interface, &tower_class);
2703 +-
2704 +- if (retval) {
2705 +- /* something prevented us from registering this driver */
2706 +- dev_err(idev, "Not able to get a minor for this device.\n");
2707 +- usb_set_intfdata (interface, NULL);
2708 +- goto error;
2709 +- }
2710 +- dev->minor = interface->minor;
2711 +-
2712 +- /* let the user know what node this device is now attached to */
2713 +- dev_info(&interface->dev, "LEGO USB Tower #%d now attached to major "
2714 +- "%d minor %d\n", (dev->minor - LEGO_USB_TOWER_MINOR_BASE),
2715 +- USB_MAJOR, dev->minor);
2716 +-
2717 + /* get the firmware version and log it */
2718 + result = usb_control_msg (udev,
2719 + usb_rcvctrlpipe(udev, 0),
2720 +@@ -936,6 +918,23 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device
2721 + get_version_reply.minor,
2722 + le16_to_cpu(get_version_reply.build_no));
2723 +
2724 ++ /* we can register the device now, as it is ready */
2725 ++ usb_set_intfdata (interface, dev);
2726 ++
2727 ++ retval = usb_register_dev (interface, &tower_class);
2728 ++
2729 ++ if (retval) {
2730 ++ /* something prevented us from registering this driver */
2731 ++ dev_err(idev, "Not able to get a minor for this device.\n");
2732 ++ usb_set_intfdata (interface, NULL);
2733 ++ goto error;
2734 ++ }
2735 ++ dev->minor = interface->minor;
2736 ++
2737 ++ /* let the user know what node this device is now attached to */
2738 ++ dev_info(&interface->dev, "LEGO USB Tower #%d now attached to major "
2739 ++ "%d minor %d\n", (dev->minor - LEGO_USB_TOWER_MINOR_BASE),
2740 ++ USB_MAJOR, dev->minor);
2741 +
2742 + exit:
2743 + return retval;
2744 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
2745 +index 96a70789b4c2..7e91ee27ac3a 100644
2746 +--- a/drivers/usb/serial/cp210x.c
2747 ++++ b/drivers/usb/serial/cp210x.c
2748 +@@ -118,6 +118,7 @@ static const struct usb_device_id id_table[] = {
2749 + { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */
2750 + { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
2751 + { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
2752 ++ { USB_DEVICE(0x10C4, 0x8470) }, /* Juniper Networks BX Series System Console */
2753 + { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
2754 + { USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */
2755 + { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */
2756 +diff --git a/drivers/usb/usbip/vudc_rx.c b/drivers/usb/usbip/vudc_rx.c
2757 +index 344bd9473475..e429b59f6f8a 100644
2758 +--- a/drivers/usb/usbip/vudc_rx.c
2759 ++++ b/drivers/usb/usbip/vudc_rx.c
2760 +@@ -142,7 +142,7 @@ static int v_recv_cmd_submit(struct vudc *udc,
2761 + urb_p->urb->status = -EINPROGRESS;
2762 +
2763 + /* FIXME: more pipe setup to please usbip_common */
2764 +- urb_p->urb->pipe &= ~(11 << 30);
2765 ++ urb_p->urb->pipe &= ~(3 << 30);
2766 + switch (urb_p->ep->type) {
2767 + case USB_ENDPOINT_XFER_BULK:
2768 + urb_p->urb->pipe |= (PIPE_BULK << 30);
2769 +diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
2770 +index 3595cffa24ea..cff8a65d7ef0 100644
2771 +--- a/drivers/watchdog/watchdog_dev.c
2772 ++++ b/drivers/watchdog/watchdog_dev.c
2773 +@@ -258,10 +258,12 @@ static int watchdog_stop(struct watchdog_device *wdd)
2774 + return -EBUSY;
2775 + }
2776 +
2777 +- if (wdd->ops->stop)
2778 ++ if (wdd->ops->stop) {
2779 ++ clear_bit(WDOG_HW_RUNNING, &wdd->status);
2780 + err = wdd->ops->stop(wdd);
2781 +- else
2782 ++ } else {
2783 + set_bit(WDOG_HW_RUNNING, &wdd->status);
2784 ++ }
2785 +
2786 + if (err == 0) {
2787 + clear_bit(WDOG_ACTIVE, &wdd->status);
2788 +diff --git a/fs/aio.c b/fs/aio.c
2789 +index fb8e45b88cd4..4fe81d1c60f9 100644
2790 +--- a/fs/aio.c
2791 ++++ b/fs/aio.c
2792 +@@ -239,7 +239,12 @@ static struct dentry *aio_mount(struct file_system_type *fs_type,
2793 + static const struct dentry_operations ops = {
2794 + .d_dname = simple_dname,
2795 + };
2796 +- return mount_pseudo(fs_type, "aio:", NULL, &ops, AIO_RING_MAGIC);
2797 ++ struct dentry *root = mount_pseudo(fs_type, "aio:", NULL, &ops,
2798 ++ AIO_RING_MAGIC);
2799 ++
2800 ++ if (!IS_ERR(root))
2801 ++ root->d_sb->s_iflags |= SB_I_NOEXEC;
2802 ++ return root;
2803 + }
2804 +
2805 + /* aio_setup
2806 +diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
2807 +index 6e0fedf6713b..cf22f1e38fa3 100644
2808 +--- a/fs/ceph/dir.c
2809 ++++ b/fs/ceph/dir.c
2810 +@@ -597,7 +597,7 @@ static bool need_reset_readdir(struct ceph_file_info *fi, loff_t new_pos)
2811 + if (is_hash_order(new_pos)) {
2812 + /* no need to reset last_name for a forward seek when
2813 + * dentries are sotred in hash order */
2814 +- } else if (fi->frag |= fpos_frag(new_pos)) {
2815 ++ } else if (fi->frag != fpos_frag(new_pos)) {
2816 + return true;
2817 + }
2818 + rinfo = fi->last_readdir ? &fi->last_readdir->r_reply_info : NULL;
2819 +diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
2820 +index d81f96aacd51..656f68f7fe53 100644
2821 +--- a/fs/nfs/callback_xdr.c
2822 ++++ b/fs/nfs/callback_xdr.c
2823 +@@ -925,7 +925,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
2824 + if (hdr_arg.minorversion == 0) {
2825 + cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident);
2826 + if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp))
2827 +- return rpc_drop_reply;
2828 ++ goto out_invalidcred;
2829 + }
2830 +
2831 + cps.minorversion = hdr_arg.minorversion;
2832 +@@ -953,6 +953,10 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
2833 + nfs_put_client(cps.clp);
2834 + dprintk("%s: done, status = %u\n", __func__, ntohl(status));
2835 + return rpc_success;
2836 ++
2837 ++out_invalidcred:
2838 ++ pr_warn_ratelimited("NFS: NFSv4 callback contains invalid cred\n");
2839 ++ return rpc_autherr_badcred;
2840 + }
2841 +
2842 + /*
2843 +diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
2844 +index aa59757389dc..b4c1407e8fe4 100644
2845 +--- a/fs/nfs/filelayout/filelayout.c
2846 ++++ b/fs/nfs/filelayout/filelayout.c
2847 +@@ -375,8 +375,7 @@ static int filelayout_commit_done_cb(struct rpc_task *task,
2848 + return -EAGAIN;
2849 + }
2850 +
2851 +- if (data->verf.committed == NFS_UNSTABLE)
2852 +- pnfs_set_layoutcommit(data->inode, data->lseg, data->lwb);
2853 ++ pnfs_set_layoutcommit(data->inode, data->lseg, data->lwb);
2854 +
2855 + return 0;
2856 + }
2857 +diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
2858 +index 6da14aedde2b..1c15966c9f52 100644
2859 +--- a/fs/nfs/flexfilelayout/flexfilelayout.c
2860 ++++ b/fs/nfs/flexfilelayout/flexfilelayout.c
2861 +@@ -37,6 +37,7 @@ ff_layout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
2862 + if (ffl) {
2863 + INIT_LIST_HEAD(&ffl->error_list);
2864 + INIT_LIST_HEAD(&ffl->mirrors);
2865 ++ ffl->last_report_time = ktime_get();
2866 + return &ffl->generic_hdr;
2867 + } else
2868 + return NULL;
2869 +@@ -640,19 +641,18 @@ nfs4_ff_layoutstat_start_io(struct nfs4_ff_layout_mirror *mirror,
2870 + {
2871 + static const ktime_t notime = {0};
2872 + s64 report_interval = FF_LAYOUTSTATS_REPORT_INTERVAL;
2873 ++ struct nfs4_flexfile_layout *ffl = FF_LAYOUT_FROM_HDR(mirror->layout);
2874 +
2875 + nfs4_ff_start_busy_timer(&layoutstat->busy_timer, now);
2876 + if (ktime_equal(mirror->start_time, notime))
2877 + mirror->start_time = now;
2878 +- if (ktime_equal(mirror->last_report_time, notime))
2879 +- mirror->last_report_time = now;
2880 + if (mirror->report_interval != 0)
2881 + report_interval = (s64)mirror->report_interval * 1000LL;
2882 + else if (layoutstats_timer != 0)
2883 + report_interval = (s64)layoutstats_timer * 1000LL;
2884 +- if (ktime_to_ms(ktime_sub(now, mirror->last_report_time)) >=
2885 ++ if (ktime_to_ms(ktime_sub(now, ffl->last_report_time)) >=
2886 + report_interval) {
2887 +- mirror->last_report_time = now;
2888 ++ ffl->last_report_time = now;
2889 + return true;
2890 + }
2891 +
2892 +@@ -1529,8 +1529,7 @@ static int ff_layout_commit_done_cb(struct rpc_task *task,
2893 + return -EAGAIN;
2894 + }
2895 +
2896 +- if (data->verf.committed == NFS_UNSTABLE
2897 +- && ff_layout_need_layoutcommit(data->lseg))
2898 ++ if (ff_layout_need_layoutcommit(data->lseg))
2899 + pnfs_set_layoutcommit(data->inode, data->lseg, data->lwb);
2900 +
2901 + return 0;
2902 +diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h
2903 +index 1bcdb15d0c41..3ee0c9fcea76 100644
2904 +--- a/fs/nfs/flexfilelayout/flexfilelayout.h
2905 ++++ b/fs/nfs/flexfilelayout/flexfilelayout.h
2906 +@@ -84,7 +84,6 @@ struct nfs4_ff_layout_mirror {
2907 + struct nfs4_ff_layoutstat read_stat;
2908 + struct nfs4_ff_layoutstat write_stat;
2909 + ktime_t start_time;
2910 +- ktime_t last_report_time;
2911 + u32 report_interval;
2912 + };
2913 +
2914 +@@ -101,6 +100,7 @@ struct nfs4_flexfile_layout {
2915 + struct pnfs_ds_commit_info commit_info;
2916 + struct list_head mirrors;
2917 + struct list_head error_list; /* nfs4_ff_layout_ds_err */
2918 ++ ktime_t last_report_time; /* Layoutstat report times */
2919 + };
2920 +
2921 + static inline struct nfs4_flexfile_layout *
2922 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
2923 +index e2320c643107..00fd0c716988 100644
2924 +--- a/fs/nfs/nfs4proc.c
2925 ++++ b/fs/nfs/nfs4proc.c
2926 +@@ -4393,7 +4393,8 @@ static void nfs4_proc_read_setup(struct nfs_pgio_header *hdr,
2927 + struct rpc_message *msg)
2928 + {
2929 + hdr->timestamp = jiffies;
2930 +- hdr->pgio_done_cb = nfs4_read_done_cb;
2931 ++ if (!hdr->pgio_done_cb)
2932 ++ hdr->pgio_done_cb = nfs4_read_done_cb;
2933 + msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ];
2934 + nfs4_init_sequence(&hdr->args.seq_args, &hdr->res.seq_res, 0);
2935 + }
2936 +diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
2937 +index 45d6110744cb..ec9ddef5ae75 100644
2938 +--- a/fs/pstore/inode.c
2939 ++++ b/fs/pstore/inode.c
2940 +@@ -178,7 +178,6 @@ static loff_t pstore_file_llseek(struct file *file, loff_t off, int whence)
2941 + }
2942 +
2943 + static const struct file_operations pstore_file_operations = {
2944 +- .owner = THIS_MODULE,
2945 + .open = pstore_file_open,
2946 + .read = pstore_file_read,
2947 + .llseek = pstore_file_llseek,
2948 +diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
2949 +index 5261751f6bd4..5f5270941ba0 100644
2950 +--- a/include/linux/can/dev.h
2951 ++++ b/include/linux/can/dev.h
2952 +@@ -32,6 +32,7 @@ enum can_mode {
2953 + * CAN common private data
2954 + */
2955 + struct can_priv {
2956 ++ struct net_device *dev;
2957 + struct can_device_stats can_stats;
2958 +
2959 + struct can_bittiming bittiming, data_bittiming;
2960 +@@ -47,7 +48,7 @@ struct can_priv {
2961 + u32 ctrlmode_static; /* static enabled options for driver/hardware */
2962 +
2963 + int restart_ms;
2964 +- struct timer_list restart_timer;
2965 ++ struct delayed_work restart_work;
2966 +
2967 + int (*do_set_bittiming)(struct net_device *dev);
2968 + int (*do_set_data_bittiming)(struct net_device *dev);
2969 +diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
2970 +index 9bb77d3ed6e0..c2256d746543 100644
2971 +--- a/include/linux/nvmem-consumer.h
2972 ++++ b/include/linux/nvmem-consumer.h
2973 +@@ -74,7 +74,7 @@ static inline void nvmem_cell_put(struct nvmem_cell *cell)
2974 + {
2975 + }
2976 +
2977 +-static inline char *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
2978 ++static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
2979 + {
2980 + return ERR_PTR(-ENOSYS);
2981 + }
2982 +diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
2983 +index d1faa019c02a..b71b2581811c 100644
2984 +--- a/include/linux/slub_def.h
2985 ++++ b/include/linux/slub_def.h
2986 +@@ -114,15 +114,17 @@ static inline void sysfs_slab_remove(struct kmem_cache *s)
2987 + void object_err(struct kmem_cache *s, struct page *page,
2988 + u8 *object, char *reason);
2989 +
2990 ++void *fixup_red_left(struct kmem_cache *s, void *p);
2991 ++
2992 + static inline void *nearest_obj(struct kmem_cache *cache, struct page *page,
2993 + void *x) {
2994 + void *object = x - (x - page_address(page)) % cache->size;
2995 + void *last_object = page_address(page) +
2996 + (page->objects - 1) * cache->size;
2997 +- if (unlikely(object > last_object))
2998 +- return last_object;
2999 +- else
3000 +- return object;
3001 ++ void *result = (unlikely(object > last_object)) ? last_object : object;
3002 ++
3003 ++ result = fixup_red_left(cache, result);
3004 ++ return result;
3005 + }
3006 +
3007 + #endif /* _LINUX_SLUB_DEF_H */
3008 +diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
3009 +index fa7bc29925c9..ef17db6caaed 100644
3010 +--- a/include/linux/sysctl.h
3011 ++++ b/include/linux/sysctl.h
3012 +@@ -41,6 +41,8 @@ extern int proc_dostring(struct ctl_table *, int,
3013 + void __user *, size_t *, loff_t *);
3014 + extern int proc_dointvec(struct ctl_table *, int,
3015 + void __user *, size_t *, loff_t *);
3016 ++extern int proc_douintvec(struct ctl_table *, int,
3017 ++ void __user *, size_t *, loff_t *);
3018 + extern int proc_dointvec_minmax(struct ctl_table *, int,
3019 + void __user *, size_t *, loff_t *);
3020 + extern int proc_dointvec_jiffies(struct ctl_table *, int,
3021 +diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
3022 +index 13c0b2ba1b6c..31ae074dad9d 100644
3023 +--- a/include/scsi/scsi_transport_sas.h
3024 ++++ b/include/scsi/scsi_transport_sas.h
3025 +@@ -15,8 +15,14 @@ static inline int is_sas_attached(struct scsi_device *sdev)
3026 + {
3027 + return 0;
3028 + }
3029 ++
3030 ++static inline int scsi_is_sas_rphy(const struct device *sdev)
3031 ++{
3032 ++ return 0;
3033 ++}
3034 + #else
3035 + extern int is_sas_attached(struct scsi_device *sdev);
3036 ++extern int scsi_is_sas_rphy(const struct device *);
3037 + #endif
3038 +
3039 + static inline int sas_protocol_ata(enum sas_protocol proto)
3040 +@@ -202,7 +208,6 @@ extern int sas_rphy_add(struct sas_rphy *);
3041 + extern void sas_rphy_remove(struct sas_rphy *);
3042 + extern void sas_rphy_delete(struct sas_rphy *);
3043 + extern void sas_rphy_unlink(struct sas_rphy *);
3044 +-extern int scsi_is_sas_rphy(const struct device *);
3045 +
3046 + struct sas_port *sas_port_alloc(struct device *, int);
3047 + struct sas_port *sas_port_alloc_num(struct device *);
3048 +diff --git a/kernel/cgroup.c b/kernel/cgroup.c
3049 +index 129a7ca5f159..b1e0cbb8cf97 100644
3050 +--- a/kernel/cgroup.c
3051 ++++ b/kernel/cgroup.c
3052 +@@ -3452,9 +3452,28 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of,
3053 + * Except for the root, subtree_control must be zero for a cgroup
3054 + * with tasks so that child cgroups don't compete against tasks.
3055 + */
3056 +- if (enable && cgroup_parent(cgrp) && !list_empty(&cgrp->cset_links)) {
3057 +- ret = -EBUSY;
3058 +- goto out_unlock;
3059 ++ if (enable && cgroup_parent(cgrp)) {
3060 ++ struct cgrp_cset_link *link;
3061 ++
3062 ++ /*
3063 ++ * Because namespaces pin csets too, @cgrp->cset_links
3064 ++ * might not be empty even when @cgrp is empty. Walk and
3065 ++ * verify each cset.
3066 ++ */
3067 ++ spin_lock_irq(&css_set_lock);
3068 ++
3069 ++ ret = 0;
3070 ++ list_for_each_entry(link, &cgrp->cset_links, cset_link) {
3071 ++ if (css_set_populated(link->cset)) {
3072 ++ ret = -EBUSY;
3073 ++ break;
3074 ++ }
3075 ++ }
3076 ++
3077 ++ spin_unlock_irq(&css_set_lock);
3078 ++
3079 ++ if (ret)
3080 ++ goto out_unlock;
3081 + }
3082 +
3083 + /* save and update control masks and prepare csses */
3084 +@@ -3905,7 +3924,9 @@ void cgroup_file_notify(struct cgroup_file *cfile)
3085 + * cgroup_task_count - count the number of tasks in a cgroup.
3086 + * @cgrp: the cgroup in question
3087 + *
3088 +- * Return the number of tasks in the cgroup.
3089 ++ * Return the number of tasks in the cgroup. The returned number can be
3090 ++ * higher than the actual number of tasks due to css_set references from
3091 ++ * namespace roots and temporary usages.
3092 + */
3093 + static int cgroup_task_count(const struct cgroup *cgrp)
3094 + {
3095 +diff --git a/kernel/cpuset.c b/kernel/cpuset.c
3096 +index 40b6ed559448..8cee9627ac4b 100644
3097 +--- a/kernel/cpuset.c
3098 ++++ b/kernel/cpuset.c
3099 +@@ -325,8 +325,7 @@ static struct file_system_type cpuset_fs_type = {
3100 + /*
3101 + * Return in pmask the portion of a cpusets's cpus_allowed that
3102 + * are online. If none are online, walk up the cpuset hierarchy
3103 +- * until we find one that does have some online cpus. The top
3104 +- * cpuset always has some cpus online.
3105 ++ * until we find one that does have some online cpus.
3106 + *
3107 + * One way or another, we guarantee to return some non-empty subset
3108 + * of cpu_online_mask.
3109 +@@ -335,8 +334,20 @@ static struct file_system_type cpuset_fs_type = {
3110 + */
3111 + static void guarantee_online_cpus(struct cpuset *cs, struct cpumask *pmask)
3112 + {
3113 +- while (!cpumask_intersects(cs->effective_cpus, cpu_online_mask))
3114 ++ while (!cpumask_intersects(cs->effective_cpus, cpu_online_mask)) {
3115 + cs = parent_cs(cs);
3116 ++ if (unlikely(!cs)) {
3117 ++ /*
3118 ++ * The top cpuset doesn't have any online cpu as a
3119 ++ * consequence of a race between cpuset_hotplug_work
3120 ++ * and cpu hotplug notifier. But we know the top
3121 ++ * cpuset's effective_cpus is on its way to to be
3122 ++ * identical to cpu_online_mask.
3123 ++ */
3124 ++ cpumask_copy(pmask, cpu_online_mask);
3125 ++ return;
3126 ++ }
3127 ++ }
3128 + cpumask_and(pmask, cs->effective_cpus, cpu_online_mask);
3129 + }
3130 +
3131 +diff --git a/kernel/events/core.c b/kernel/events/core.c
3132 +index e68c0a735c8f..31c1520b744d 100644
3133 +--- a/kernel/events/core.c
3134 ++++ b/kernel/events/core.c
3135 +@@ -6064,7 +6064,7 @@ static int __perf_pmu_output_stop(void *info)
3136 + {
3137 + struct perf_event *event = info;
3138 + struct pmu *pmu = event->pmu;
3139 +- struct perf_cpu_context *cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
3140 ++ struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
3141 + struct remote_output ro = {
3142 + .rb = event->rb,
3143 + };
3144 +diff --git a/kernel/fork.c b/kernel/fork.c
3145 +index 74fd39079031..d6404ede47eb 100644
3146 +--- a/kernel/fork.c
3147 ++++ b/kernel/fork.c
3148 +@@ -938,14 +938,12 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
3149 + deactivate_mm(tsk, mm);
3150 +
3151 + /*
3152 +- * If we're exiting normally, clear a user-space tid field if
3153 +- * requested. We leave this alone when dying by signal, to leave
3154 +- * the value intact in a core dump, and to save the unnecessary
3155 +- * trouble, say, a killed vfork parent shouldn't touch this mm.
3156 +- * Userland only wants this done for a sys_exit.
3157 ++ * Signal userspace if we're not exiting with a core dump
3158 ++ * because we want to leave the value intact for debugging
3159 ++ * purposes.
3160 + */
3161 + if (tsk->clear_child_tid) {
3162 +- if (!(tsk->flags & PF_SIGNALED) &&
3163 ++ if (!(tsk->signal->flags & SIGNAL_GROUP_COREDUMP) &&
3164 + atomic_read(&mm->mm_users) > 1) {
3165 + /*
3166 + * We don't check the error code - if userspace has
3167 +diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c
3168 +index 276762f3a460..d5760c42f042 100644
3169 +--- a/kernel/printk/braille.c
3170 ++++ b/kernel/printk/braille.c
3171 +@@ -9,10 +9,10 @@
3172 +
3173 + char *_braille_console_setup(char **str, char **brl_options)
3174 + {
3175 +- if (!memcmp(*str, "brl,", 4)) {
3176 ++ if (!strncmp(*str, "brl,", 4)) {
3177 + *brl_options = "";
3178 + *str += 4;
3179 +- } else if (!memcmp(str, "brl=", 4)) {
3180 ++ } else if (!strncmp(*str, "brl=", 4)) {
3181 + *brl_options = *str + 4;
3182 + *str = strchr(*brl_options, ',');
3183 + if (!*str)
3184 +diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
3185 +index 3cee0d8393ed..8ce4eecff319 100644
3186 +--- a/kernel/rcu/rcuperf.c
3187 ++++ b/kernel/rcu/rcuperf.c
3188 +@@ -58,7 +58,7 @@ MODULE_AUTHOR("Paul E. McKenney <paulmck@××××××××××××××.com>");
3189 + #define VERBOSE_PERFOUT_ERRSTRING(s) \
3190 + do { if (verbose) pr_alert("%s" PERF_FLAG "!!! %s\n", perf_type, s); } while (0)
3191 +
3192 +-torture_param(bool, gp_exp, true, "Use expedited GP wait primitives");
3193 ++torture_param(bool, gp_exp, false, "Use expedited GP wait primitives");
3194 + torture_param(int, holdoff, 10, "Holdoff time before test start (s)");
3195 + torture_param(int, nreaders, -1, "Number of RCU reader threads");
3196 + torture_param(int, nwriters, -1, "Number of RCU updater threads");
3197 +@@ -363,8 +363,6 @@ rcu_perf_writer(void *arg)
3198 + u64 *wdpp = writer_durations[me];
3199 +
3200 + VERBOSE_PERFOUT_STRING("rcu_perf_writer task started");
3201 +- WARN_ON(rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp);
3202 +- WARN_ON(rcu_gp_is_normal() && gp_exp);
3203 + WARN_ON(!wdpp);
3204 + set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids));
3205 + sp.sched_priority = 1;
3206 +@@ -631,6 +629,16 @@ rcu_perf_init(void)
3207 + firsterr = -ENOMEM;
3208 + goto unwind;
3209 + }
3210 ++ if (rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp) {
3211 ++ VERBOSE_PERFOUT_ERRSTRING("All grace periods expedited, no normal ones to measure!");
3212 ++ firsterr = -EINVAL;
3213 ++ goto unwind;
3214 ++ }
3215 ++ if (rcu_gp_is_normal() && gp_exp) {
3216 ++ VERBOSE_PERFOUT_ERRSTRING("All grace periods normal, no expedited ones to measure!");
3217 ++ firsterr = -EINVAL;
3218 ++ goto unwind;
3219 ++ }
3220 + for (i = 0; i < nrealwriters; i++) {
3221 + writer_durations[i] =
3222 + kcalloc(MAX_MEAS, sizeof(*writer_durations[i]),
3223 +diff --git a/kernel/sched/core.c b/kernel/sched/core.c
3224 +index 38eacc323fdd..e1422c1f5a29 100644
3225 +--- a/kernel/sched/core.c
3226 ++++ b/kernel/sched/core.c
3227 +@@ -7255,7 +7255,6 @@ static void sched_rq_cpu_starting(unsigned int cpu)
3228 + struct rq *rq = cpu_rq(cpu);
3229 +
3230 + rq->calc_load_update = calc_load_update;
3231 +- account_reset_rq(rq);
3232 + update_max_interval();
3233 + }
3234 +
3235 +diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
3236 +index 898c0d2f18fe..b4f3edf9a219 100644
3237 +--- a/kernel/sched/sched.h
3238 ++++ b/kernel/sched/sched.h
3239 +@@ -1809,16 +1809,3 @@ static inline void cpufreq_trigger_update(u64 time) {}
3240 + #else /* arch_scale_freq_capacity */
3241 + #define arch_scale_freq_invariant() (false)
3242 + #endif
3243 +-
3244 +-static inline void account_reset_rq(struct rq *rq)
3245 +-{
3246 +-#ifdef CONFIG_IRQ_TIME_ACCOUNTING
3247 +- rq->prev_irq_time = 0;
3248 +-#endif
3249 +-#ifdef CONFIG_PARAVIRT
3250 +- rq->prev_steal_time = 0;
3251 +-#endif
3252 +-#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
3253 +- rq->prev_steal_time_rq = 0;
3254 +-#endif
3255 +-}
3256 +diff --git a/kernel/sysctl.c b/kernel/sysctl.c
3257 +index 87b2fc38398b..b58e447233bf 100644
3258 +--- a/kernel/sysctl.c
3259 ++++ b/kernel/sysctl.c
3260 +@@ -2122,6 +2122,21 @@ static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
3261 + return 0;
3262 + }
3263 +
3264 ++static int do_proc_douintvec_conv(bool *negp, unsigned long *lvalp,
3265 ++ int *valp,
3266 ++ int write, void *data)
3267 ++{
3268 ++ if (write) {
3269 ++ if (*negp)
3270 ++ return -EINVAL;
3271 ++ *valp = *lvalp;
3272 ++ } else {
3273 ++ unsigned int val = *valp;
3274 ++ *lvalp = (unsigned long)val;
3275 ++ }
3276 ++ return 0;
3277 ++}
3278 ++
3279 + static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
3280 +
3281 + static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
3282 +@@ -2241,8 +2256,27 @@ static int do_proc_dointvec(struct ctl_table *table, int write,
3283 + int proc_dointvec(struct ctl_table *table, int write,
3284 + void __user *buffer, size_t *lenp, loff_t *ppos)
3285 + {
3286 +- return do_proc_dointvec(table,write,buffer,lenp,ppos,
3287 +- NULL,NULL);
3288 ++ return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
3289 ++}
3290 ++
3291 ++/**
3292 ++ * proc_douintvec - read a vector of unsigned integers
3293 ++ * @table: the sysctl table
3294 ++ * @write: %TRUE if this is a write to the sysctl file
3295 ++ * @buffer: the user buffer
3296 ++ * @lenp: the size of the user buffer
3297 ++ * @ppos: file position
3298 ++ *
3299 ++ * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
3300 ++ * values from/to the user buffer, treated as an ASCII string.
3301 ++ *
3302 ++ * Returns 0 on success.
3303 ++ */
3304 ++int proc_douintvec(struct ctl_table *table, int write,
3305 ++ void __user *buffer, size_t *lenp, loff_t *ppos)
3306 ++{
3307 ++ return do_proc_dointvec(table, write, buffer, lenp, ppos,
3308 ++ do_proc_douintvec_conv, NULL);
3309 + }
3310 +
3311 + /*
3312 +@@ -2840,6 +2874,12 @@ int proc_dointvec(struct ctl_table *table, int write,
3313 + return -ENOSYS;
3314 + }
3315 +
3316 ++int proc_douintvec(struct ctl_table *table, int write,
3317 ++ void __user *buffer, size_t *lenp, loff_t *ppos)
3318 ++{
3319 ++ return -ENOSYS;
3320 ++}
3321 ++
3322 + int proc_dointvec_minmax(struct ctl_table *table, int write,
3323 + void __user *buffer, size_t *lenp, loff_t *ppos)
3324 + {
3325 +@@ -2885,6 +2925,7 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
3326 + * exception granted :-)
3327 + */
3328 + EXPORT_SYMBOL(proc_dointvec);
3329 ++EXPORT_SYMBOL(proc_douintvec);
3330 + EXPORT_SYMBOL(proc_dointvec_jiffies);
3331 + EXPORT_SYMBOL(proc_dointvec_minmax);
3332 + EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
3333 +diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
3334 +index fafeaf803bd0..f4b86e8ca1e7 100644
3335 +--- a/kernel/trace/Kconfig
3336 ++++ b/kernel/trace/Kconfig
3337 +@@ -542,6 +542,7 @@ config HIST_TRIGGERS
3338 + bool "Histogram triggers"
3339 + depends on ARCH_HAVE_NMI_SAFE_CMPXCHG
3340 + select TRACING_MAP
3341 ++ select TRACING
3342 + default n
3343 + help
3344 + Hist triggers allow one or more arbitrary trace event fields
3345 +diff --git a/lib/test_hash.c b/lib/test_hash.c
3346 +index c9549c8b4909..a06ac379ad42 100644
3347 +--- a/lib/test_hash.c
3348 ++++ b/lib/test_hash.c
3349 +@@ -143,7 +143,7 @@ static int __init
3350 + test_hash_init(void)
3351 + {
3352 + char buf[SIZE+1];
3353 +- u32 string_or = 0, hash_or[2][33] = { 0 };
3354 ++ u32 string_or = 0, hash_or[2][33] = { { 0, } };
3355 + unsigned tests = 0;
3356 + unsigned long long h64 = 0;
3357 + int i, j;
3358 +@@ -219,21 +219,27 @@ test_hash_init(void)
3359 + }
3360 +
3361 + /* Issue notices about skipped tests. */
3362 +-#ifndef HAVE_ARCH__HASH_32
3363 +- pr_info("__hash_32() has no arch implementation to test.");
3364 +-#elif HAVE_ARCH__HASH_32 != 1
3365 ++#ifdef HAVE_ARCH__HASH_32
3366 ++#if HAVE_ARCH__HASH_32 != 1
3367 + pr_info("__hash_32() is arch-specific; not compared to generic.");
3368 + #endif
3369 +-#ifndef HAVE_ARCH_HASH_32
3370 +- pr_info("hash_32() has no arch implementation to test.");
3371 +-#elif HAVE_ARCH_HASH_32 != 1
3372 ++#else
3373 ++ pr_info("__hash_32() has no arch implementation to test.");
3374 ++#endif
3375 ++#ifdef HAVE_ARCH_HASH_32
3376 ++#if HAVE_ARCH_HASH_32 != 1
3377 + pr_info("hash_32() is arch-specific; not compared to generic.");
3378 + #endif
3379 +-#ifndef HAVE_ARCH_HASH_64
3380 +- pr_info("hash_64() has no arch implementation to test.");
3381 +-#elif HAVE_ARCH_HASH_64 != 1
3382 ++#else
3383 ++ pr_info("hash_32() has no arch implementation to test.");
3384 ++#endif
3385 ++#ifdef HAVE_ARCH_HASH_64
3386 ++#if HAVE_ARCH_HASH_64 != 1
3387 + pr_info("hash_64() is arch-specific; not compared to generic.");
3388 + #endif
3389 ++#else
3390 ++ pr_info("hash_64() has no arch implementation to test.");
3391 ++#endif
3392 +
3393 + pr_notice("%u tests passed.", tests);
3394 +
3395 +diff --git a/mm/ksm.c b/mm/ksm.c
3396 +index 4786b4150f62..443bac35cd87 100644
3397 +--- a/mm/ksm.c
3398 ++++ b/mm/ksm.c
3399 +@@ -283,7 +283,8 @@ static inline struct rmap_item *alloc_rmap_item(void)
3400 + {
3401 + struct rmap_item *rmap_item;
3402 +
3403 +- rmap_item = kmem_cache_zalloc(rmap_item_cache, GFP_KERNEL);
3404 ++ rmap_item = kmem_cache_zalloc(rmap_item_cache, GFP_KERNEL |
3405 ++ __GFP_NORETRY | __GFP_NOWARN);
3406 + if (rmap_item)
3407 + ksm_rmap_items++;
3408 + return rmap_item;
3409 +diff --git a/mm/slub.c b/mm/slub.c
3410 +index 7a6d268840c0..b94fb362a018 100644
3411 +--- a/mm/slub.c
3412 ++++ b/mm/slub.c
3413 +@@ -124,7 +124,7 @@ static inline int kmem_cache_debug(struct kmem_cache *s)
3414 + #endif
3415 + }
3416 +
3417 +-static inline void *fixup_red_left(struct kmem_cache *s, void *p)
3418 ++inline void *fixup_red_left(struct kmem_cache *s, void *p)
3419 + {
3420 + if (kmem_cache_debug(s) && s->flags & SLAB_RED_ZONE)
3421 + p += s->red_left_pad;
3422 +diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
3423 +index df42eb1365a0..63762b3df7c7 100644
3424 +--- a/net/batman-adv/bat_v_elp.c
3425 ++++ b/net/batman-adv/bat_v_elp.c
3426 +@@ -334,7 +334,7 @@ int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface)
3427 + goto out;
3428 +
3429 + skb_reserve(hard_iface->bat_v.elp_skb, ETH_HLEN + NET_IP_ALIGN);
3430 +- elp_buff = skb_push(hard_iface->bat_v.elp_skb, BATADV_ELP_HLEN);
3431 ++ elp_buff = skb_put(hard_iface->bat_v.elp_skb, BATADV_ELP_HLEN);
3432 + elp_packet = (struct batadv_elp_packet *)elp_buff;
3433 + memset(elp_packet, 0, BATADV_ELP_HLEN);
3434 +
3435 +diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
3436 +index ab8c4f9738fe..1da7bfc61ac6 100644
3437 +--- a/net/batman-adv/originator.c
3438 ++++ b/net/batman-adv/originator.c
3439 +@@ -251,10 +251,8 @@ static void batadv_neigh_node_release(struct kref *ref)
3440 + struct hlist_node *node_tmp;
3441 + struct batadv_neigh_node *neigh_node;
3442 + struct batadv_neigh_ifinfo *neigh_ifinfo;
3443 +- struct batadv_algo_ops *bao;
3444 +
3445 + neigh_node = container_of(ref, struct batadv_neigh_node, refcount);
3446 +- bao = neigh_node->orig_node->bat_priv->bat_algo_ops;
3447 +
3448 + hlist_for_each_entry_safe(neigh_ifinfo, node_tmp,
3449 + &neigh_node->ifinfo_list, list) {
3450 +@@ -263,9 +261,6 @@ static void batadv_neigh_node_release(struct kref *ref)
3451 +
3452 + batadv_hardif_neigh_put(neigh_node->hardif_neigh);
3453 +
3454 +- if (bao->bat_neigh_free)
3455 +- bao->bat_neigh_free(neigh_node);
3456 +-
3457 + batadv_hardif_put(neigh_node->if_incoming);
3458 +
3459 + kfree_rcu(neigh_node, rcu);
3460 +diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
3461 +index bfac086b4d01..69d425d5729e 100644
3462 +--- a/net/batman-adv/routing.c
3463 ++++ b/net/batman-adv/routing.c
3464 +@@ -456,6 +456,29 @@ static int batadv_check_unicast_packet(struct batadv_priv *bat_priv,
3465 + }
3466 +
3467 + /**
3468 ++ * batadv_last_bonding_get - Get last_bonding_candidate of orig_node
3469 ++ * @orig_node: originator node whose last bonding candidate should be retrieved
3470 ++ *
3471 ++ * Return: last bonding candidate of router or NULL if not found
3472 ++ *
3473 ++ * The object is returned with refcounter increased by 1.
3474 ++ */
3475 ++static struct batadv_orig_ifinfo *
3476 ++batadv_last_bonding_get(struct batadv_orig_node *orig_node)
3477 ++{
3478 ++ struct batadv_orig_ifinfo *last_bonding_candidate;
3479 ++
3480 ++ spin_lock_bh(&orig_node->neigh_list_lock);
3481 ++ last_bonding_candidate = orig_node->last_bonding_candidate;
3482 ++
3483 ++ if (last_bonding_candidate)
3484 ++ kref_get(&last_bonding_candidate->refcount);
3485 ++ spin_unlock_bh(&orig_node->neigh_list_lock);
3486 ++
3487 ++ return last_bonding_candidate;
3488 ++}
3489 ++
3490 ++/**
3491 + * batadv_last_bonding_replace - Replace last_bonding_candidate of orig_node
3492 + * @orig_node: originator node whose bonding candidates should be replaced
3493 + * @new_candidate: new bonding candidate or NULL
3494 +@@ -525,7 +548,7 @@ batadv_find_router(struct batadv_priv *bat_priv,
3495 + * router - obviously there are no other candidates.
3496 + */
3497 + rcu_read_lock();
3498 +- last_candidate = orig_node->last_bonding_candidate;
3499 ++ last_candidate = batadv_last_bonding_get(orig_node);
3500 + if (last_candidate)
3501 + last_cand_router = rcu_dereference(last_candidate->router);
3502 +
3503 +@@ -617,6 +640,9 @@ next:
3504 + batadv_orig_ifinfo_put(next_candidate);
3505 + }
3506 +
3507 ++ if (last_candidate)
3508 ++ batadv_orig_ifinfo_put(last_candidate);
3509 ++
3510 + return router;
3511 + }
3512 +
3513 +diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
3514 +index 74d865a4df46..40aed16fbc28 100644
3515 +--- a/net/batman-adv/types.h
3516 ++++ b/net/batman-adv/types.h
3517 +@@ -1284,8 +1284,6 @@ struct batadv_forw_packet {
3518 + * better than neigh2 for their respective outgoing interface from the metric
3519 + * prospective
3520 + * @bat_neigh_print: print the single hop neighbor list (optional)
3521 +- * @bat_neigh_free: free the resources allocated by the routing algorithm for a
3522 +- * neigh_node object
3523 + * @bat_orig_print: print the originator table (optional)
3524 + * @bat_orig_free: free the resources allocated by the routing algorithm for an
3525 + * orig_node object
3526 +@@ -1316,7 +1314,6 @@ struct batadv_algo_ops {
3527 + struct batadv_neigh_node *neigh2,
3528 + struct batadv_hard_iface *if_outgoing2);
3529 + void (*bat_neigh_print)(struct batadv_priv *priv, struct seq_file *seq);
3530 +- void (*bat_neigh_free)(struct batadv_neigh_node *neigh);
3531 + /* orig_node handling API */
3532 + void (*bat_orig_print)(struct batadv_priv *priv, struct seq_file *seq,
3533 + struct batadv_hard_iface *hard_iface);
3534 +diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
3535 +index eb4f5f24cbe3..106643e268ba 100644
3536 +--- a/net/bluetooth/l2cap_core.c
3537 ++++ b/net/bluetooth/l2cap_core.c
3538 +@@ -32,6 +32,7 @@
3539 +
3540 + #include <linux/debugfs.h>
3541 + #include <linux/crc16.h>
3542 ++#include <linux/filter.h>
3543 +
3544 + #include <net/bluetooth/bluetooth.h>
3545 + #include <net/bluetooth/hci_core.h>
3546 +@@ -5835,6 +5836,9 @@ static int l2cap_reassemble_sdu(struct l2cap_chan *chan, struct sk_buff *skb,
3547 + if (chan->sdu)
3548 + break;
3549 +
3550 ++ if (!pskb_may_pull(skb, L2CAP_SDULEN_SIZE))
3551 ++ break;
3552 ++
3553 + chan->sdu_len = get_unaligned_le16(skb->data);
3554 + skb_pull(skb, L2CAP_SDULEN_SIZE);
3555 +
3556 +@@ -6610,6 +6614,10 @@ static int l2cap_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb)
3557 + goto drop;
3558 + }
3559 +
3560 ++ if ((chan->mode == L2CAP_MODE_ERTM ||
3561 ++ chan->mode == L2CAP_MODE_STREAMING) && sk_filter(chan->data, skb))
3562 ++ goto drop;
3563 ++
3564 + if (!control->sframe) {
3565 + int err;
3566 +
3567 +diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
3568 +index 1842141baedb..a8ba752732c9 100644
3569 +--- a/net/bluetooth/l2cap_sock.c
3570 ++++ b/net/bluetooth/l2cap_sock.c
3571 +@@ -1019,7 +1019,7 @@ static int l2cap_sock_recvmsg(struct socket *sock, struct msghdr *msg,
3572 + goto done;
3573 +
3574 + if (pi->rx_busy_skb) {
3575 +- if (!sock_queue_rcv_skb(sk, pi->rx_busy_skb))
3576 ++ if (!__sock_queue_rcv_skb(sk, pi->rx_busy_skb))
3577 + pi->rx_busy_skb = NULL;
3578 + else
3579 + goto done;
3580 +@@ -1270,7 +1270,17 @@ static int l2cap_sock_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
3581 + goto done;
3582 + }
3583 +
3584 +- err = sock_queue_rcv_skb(sk, skb);
3585 ++ if (chan->mode != L2CAP_MODE_ERTM &&
3586 ++ chan->mode != L2CAP_MODE_STREAMING) {
3587 ++ /* Even if no filter is attached, we could potentially
3588 ++ * get errors from security modules, etc.
3589 ++ */
3590 ++ err = sk_filter(sk, skb);
3591 ++ if (err)
3592 ++ goto done;
3593 ++ }
3594 ++
3595 ++ err = __sock_queue_rcv_skb(sk, skb);
3596 +
3597 + /* For ERTM, handle one skb that doesn't fit into the recv
3598 + * buffer. This is important to do because the data frames
3599 +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
3600 +index 8bad2ad81399..5f0ed8c6584d 100644
3601 +--- a/net/mac80211/tx.c
3602 ++++ b/net/mac80211/tx.c
3603 +@@ -1330,8 +1330,12 @@ out:
3604 + spin_unlock_bh(&txqi->queue.lock);
3605 +
3606 + if (skb && skb_has_frag_list(skb) &&
3607 +- !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
3608 +- skb_linearize(skb);
3609 ++ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST)) {
3610 ++ if (skb_linearize(skb)) {
3611 ++ ieee80211_free_txskb(&local->hw, skb);
3612 ++ return NULL;
3613 ++ }
3614 ++ }
3615 +
3616 + return skb;
3617 + }
3618 +diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
3619 +index 2808d550d273..0294ada6bc40 100644
3620 +--- a/net/sunrpc/clnt.c
3621 ++++ b/net/sunrpc/clnt.c
3622 +@@ -453,7 +453,7 @@ static struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
3623 + struct rpc_xprt_switch *xps;
3624 +
3625 + if (args->bc_xprt && args->bc_xprt->xpt_bc_xps) {
3626 +- WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP);
3627 ++ WARN_ON_ONCE(!(args->protocol & XPRT_TRANSPORT_BC));
3628 + xps = args->bc_xprt->xpt_bc_xps;
3629 + xprt_switch_get(xps);
3630 + } else {
3631 +@@ -520,7 +520,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
3632 + char servername[48];
3633 +
3634 + if (args->bc_xprt) {
3635 +- WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP);
3636 ++ WARN_ON_ONCE(!(args->protocol & XPRT_TRANSPORT_BC));
3637 + xprt = args->bc_xprt->xpt_bc_xprt;
3638 + if (xprt) {
3639 + xprt_get(xprt);
3640 +diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
3641 +index cc9852897395..c5b0cb4f4056 100644
3642 +--- a/net/sunrpc/svc.c
3643 ++++ b/net/sunrpc/svc.c
3644 +@@ -1188,11 +1188,17 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
3645 + *statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
3646 +
3647 + /* Encode reply */
3648 +- if (test_bit(RQ_DROPME, &rqstp->rq_flags)) {
3649 ++ if (*statp == rpc_drop_reply ||
3650 ++ test_bit(RQ_DROPME, &rqstp->rq_flags)) {
3651 + if (procp->pc_release)
3652 + procp->pc_release(rqstp, NULL, rqstp->rq_resp);
3653 + goto dropit;
3654 + }
3655 ++ if (*statp == rpc_autherr_badcred) {
3656 ++ if (procp->pc_release)
3657 ++ procp->pc_release(rqstp, NULL, rqstp->rq_resp);
3658 ++ goto err_bad_auth;
3659 ++ }
3660 + if (*statp == rpc_success &&
3661 + (xdr = procp->pc_encode) &&
3662 + !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {
3663 +diff --git a/net/sunrpc/xprtrdma/fmr_ops.c b/net/sunrpc/xprtrdma/fmr_ops.c
3664 +index 6326ebe8b595..c748ff6f6877 100644
3665 +--- a/net/sunrpc/xprtrdma/fmr_ops.c
3666 ++++ b/net/sunrpc/xprtrdma/fmr_ops.c
3667 +@@ -63,9 +63,12 @@ static int
3668 + __fmr_unmap(struct rpcrdma_mw *mw)
3669 + {
3670 + LIST_HEAD(l);
3671 ++ int rc;
3672 +
3673 + list_add(&mw->fmr.fmr->list, &l);
3674 +- return ib_unmap_fmr(&l);
3675 ++ rc = ib_unmap_fmr(&l);
3676 ++ list_del_init(&mw->fmr.fmr->list);
3677 ++ return rc;
3678 + }
3679 +
3680 + /* Deferred reset of a single FMR. Generate a fresh rkey by
3681 +@@ -267,7 +270,7 @@ fmr_op_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
3682 + seg = &req->rl_segments[i];
3683 + mw = seg->rl_mw;
3684 +
3685 +- list_add(&mw->fmr.fmr->list, &unmap_list);
3686 ++ list_add_tail(&mw->fmr.fmr->list, &unmap_list);
3687 +
3688 + i += seg->mr_nsegs;
3689 + }
3690 +@@ -280,7 +283,9 @@ fmr_op_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
3691 + */
3692 + for (i = 0, nchunks = req->rl_nchunks; nchunks; nchunks--) {
3693 + seg = &req->rl_segments[i];
3694 ++ mw = seg->rl_mw;
3695 +
3696 ++ list_del_init(&mw->fmr.fmr->list);
3697 + __fmr_dma_unmap(r_xprt, seg);
3698 + rpcrdma_put_mw(r_xprt, seg->rl_mw);
3699 +
3700 +diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
3701 +index 42396a74405d..a68f03133df9 100644
3702 +--- a/scripts/recordmcount.c
3703 ++++ b/scripts/recordmcount.c
3704 +@@ -363,6 +363,7 @@ is_mcounted_section_name(char const *const txtname)
3705 + strcmp(".sched.text", txtname) == 0 ||
3706 + strcmp(".spinlock.text", txtname) == 0 ||
3707 + strcmp(".irqentry.text", txtname) == 0 ||
3708 ++ strcmp(".softirqentry.text", txtname) == 0 ||
3709 + strcmp(".kprobes.text", txtname) == 0 ||
3710 + strcmp(".text.unlikely", txtname) == 0;
3711 + }
3712 +diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
3713 +index 96e2486a6fc4..2d48011bc362 100755
3714 +--- a/scripts/recordmcount.pl
3715 ++++ b/scripts/recordmcount.pl
3716 +@@ -134,6 +134,7 @@ my %text_sections = (
3717 + ".sched.text" => 1,
3718 + ".spinlock.text" => 1,
3719 + ".irqentry.text" => 1,
3720 ++ ".softirqentry.text" => 1,
3721 + ".kprobes.text" => 1,
3722 + ".text.unlikely" => 1,
3723 + );
3724 +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
3725 +index 56fefbd85782..ed62748a6d55 100644
3726 +--- a/sound/pci/hda/patch_conexant.c
3727 ++++ b/sound/pci/hda/patch_conexant.c
3728 +@@ -261,6 +261,7 @@ enum {
3729 + CXT_FIXUP_HP_530,
3730 + CXT_FIXUP_CAP_MIX_AMP_5047,
3731 + CXT_FIXUP_MUTE_LED_EAPD,
3732 ++ CXT_FIXUP_HP_SPECTRE,
3733 + };
3734 +
3735 + /* for hda_fixup_thinkpad_acpi() */
3736 +@@ -765,6 +766,14 @@ static const struct hda_fixup cxt_fixups[] = {
3737 + .type = HDA_FIXUP_FUNC,
3738 + .v.func = cxt_fixup_mute_led_eapd,
3739 + },
3740 ++ [CXT_FIXUP_HP_SPECTRE] = {
3741 ++ .type = HDA_FIXUP_PINS,
3742 ++ .v.pins = (const struct hda_pintbl[]) {
3743 ++ /* enable NID 0x1d for the speaker on top */
3744 ++ { 0x1d, 0x91170111 },
3745 ++ { }
3746 ++ }
3747 ++ },
3748 + };
3749 +
3750 + static const struct snd_pci_quirk cxt5045_fixups[] = {
3751 +@@ -814,6 +823,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
3752 + SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC),
3753 + SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC),
3754 + SND_PCI_QUIRK(0x1025, 0x054f, "Acer Aspire 4830T", CXT_FIXUP_ASPIRE_DMIC),
3755 ++ SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
3756 + SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
3757 + SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
3758 + SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
3759 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3760 +index eaee626ab185..b1fa50aed888 100644
3761 +--- a/sound/pci/hda/patch_realtek.c
3762 ++++ b/sound/pci/hda/patch_realtek.c
3763 +@@ -5790,6 +5790,13 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
3764 + {0x14, 0x90170110}, \
3765 + {0x15, 0x0221401f}
3766 +
3767 ++#define ALC295_STANDARD_PINS \
3768 ++ {0x12, 0xb7a60130}, \
3769 ++ {0x14, 0x90170110}, \
3770 ++ {0x17, 0x21014020}, \
3771 ++ {0x18, 0x21a19030}, \
3772 ++ {0x21, 0x04211020}
3773 ++
3774 + #define ALC298_STANDARD_PINS \
3775 + {0x12, 0x90a60130}, \
3776 + {0x21, 0x03211020}
3777 +@@ -5830,6 +5837,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
3778 + {0x14, 0x90170120},
3779 + {0x21, 0x02211030}),
3780 + SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
3781 ++ {0x14, 0x90170110},
3782 ++ {0x1b, 0x02011020},
3783 ++ {0x21, 0x0221101f}),
3784 ++ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
3785 + {0x14, 0x90170130},
3786 + {0x1b, 0x01014020},
3787 + {0x21, 0x0221103f}),
3788 +@@ -5895,6 +5906,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
3789 + {0x14, 0x90170120},
3790 + {0x21, 0x02211030}),
3791 + SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
3792 ++ {0x12, 0xb7a60130},
3793 ++ {0x14, 0x90170110},
3794 ++ {0x21, 0x02211020}),
3795 ++ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
3796 + ALC256_STANDARD_PINS),
3797 + SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
3798 + {0x12, 0x90a60130},
3799 +@@ -6005,6 +6020,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
3800 + SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
3801 + ALC292_STANDARD_PINS,
3802 + {0x13, 0x90a60140}),
3803 ++ SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
3804 ++ ALC295_STANDARD_PINS),
3805 + SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
3806 + ALC298_STANDARD_PINS,
3807 + {0x17, 0x90170110}),
3808 +diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
3809 +index 06d8c263c68f..d5a0327e8ff1 100644
3810 +--- a/sound/soc/intel/skylake/skl.c
3811 ++++ b/sound/soc/intel/skylake/skl.c
3812 +@@ -659,8 +659,10 @@ static int skl_probe(struct pci_dev *pci,
3813 +
3814 + skl->nhlt = skl_nhlt_init(bus->dev);
3815 +
3816 +- if (skl->nhlt == NULL)
3817 ++ if (skl->nhlt == NULL) {
3818 ++ err = -ENODEV;
3819 + goto out_free;
3820 ++ }
3821 +
3822 + skl_nhlt_update_topology_bin(skl);
3823 +
3824 +diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
3825 +index b837265ac3e9..8d0d45d330e7 100644
3826 +--- a/sound/soc/omap/omap-mcpdm.c
3827 ++++ b/sound/soc/omap/omap-mcpdm.c
3828 +@@ -390,8 +390,8 @@ static int omap_mcpdm_probe(struct snd_soc_dai *dai)
3829 + pm_runtime_get_sync(mcpdm->dev);
3830 + omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, 0x00);
3831 +
3832 +- ret = devm_request_irq(mcpdm->dev, mcpdm->irq, omap_mcpdm_irq_handler,
3833 +- 0, "McPDM", (void *)mcpdm);
3834 ++ ret = request_irq(mcpdm->irq, omap_mcpdm_irq_handler, 0, "McPDM",
3835 ++ (void *)mcpdm);
3836 +
3837 + pm_runtime_put_sync(mcpdm->dev);
3838 +
3839 +@@ -416,6 +416,7 @@ static int omap_mcpdm_remove(struct snd_soc_dai *dai)
3840 + {
3841 + struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
3842 +
3843 ++ free_irq(mcpdm->irq, (void *)mcpdm);
3844 + pm_runtime_disable(mcpdm->dev);
3845 +
3846 + return 0;