Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Wed, 29 Jan 2020 12:36:56
Message-Id: 1580301397.7c83e945cedc09683bec4d4a595dc663c2183219.mpagano@gentoo
1 commit: 7c83e945cedc09683bec4d4a595dc663c2183219
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 29 12:36:37 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 29 12:36:37 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=7c83e945
7
8 Linuxpatch 4.9.212
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1211_linux-4.9.212.patch | 7141 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 7145 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index abe93da..2fd527f 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -887,6 +887,10 @@ Patch: 1210_linux-4.9.211.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.9.211
23
24 +Patch: 1211_linux-4.9.212.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.9.212
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1211_linux-4.9.212.patch b/1211_linux-4.9.212.patch
33 new file mode 100644
34 index 0000000..9d82eaa
35 --- /dev/null
36 +++ b/1211_linux-4.9.212.patch
37 @@ -0,0 +1,7141 @@
38 +diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
39 +index 1bc12619bedd..b2d2f4539a3f 100644
40 +--- a/Documentation/kernel-parameters.txt
41 ++++ b/Documentation/kernel-parameters.txt
42 +@@ -1965,6 +1965,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
43 + kmemcheck=2 (one-shot mode)
44 + Default: 2 (one-shot mode)
45 +
46 ++ kpti= [ARM64] Control page table isolation of user
47 ++ and kernel address spaces.
48 ++ Default: enabled on cores which need mitigation.
49 ++ 0: force disabled
50 ++ 1: force enabled
51 ++
52 + kstack=N [X86] Print N words from the kernel stack
53 + in oops dumps.
54 +
55 +diff --git a/Makefile b/Makefile
56 +index 7fd68e080fe4..b6c05e99814e 100644
57 +--- a/Makefile
58 ++++ b/Makefile
59 +@@ -1,6 +1,6 @@
60 + VERSION = 4
61 + PATCHLEVEL = 9
62 +-SUBLEVEL = 211
63 ++SUBLEVEL = 212
64 + EXTRAVERSION =
65 + NAME = Roaring Lionus
66 +
67 +diff --git a/arch/arm/boot/dts/lpc3250-phy3250.dts b/arch/arm/boot/dts/lpc3250-phy3250.dts
68 +index b7bd3a110a8d..dd0bdf765599 100644
69 +--- a/arch/arm/boot/dts/lpc3250-phy3250.dts
70 ++++ b/arch/arm/boot/dts/lpc3250-phy3250.dts
71 +@@ -49,8 +49,8 @@
72 + sd_reg: regulator@2 {
73 + compatible = "regulator-fixed";
74 + regulator-name = "sd_reg";
75 +- regulator-min-microvolt = <1800000>;
76 +- regulator-max-microvolt = <1800000>;
77 ++ regulator-min-microvolt = <3300000>;
78 ++ regulator-max-microvolt = <3300000>;
79 + gpio = <&gpio 5 5 0>;
80 + enable-active-high;
81 + };
82 +diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi
83 +index 5fa3111731cb..2802c9565b6c 100644
84 +--- a/arch/arm/boot/dts/lpc32xx.dtsi
85 ++++ b/arch/arm/boot/dts/lpc32xx.dtsi
86 +@@ -139,11 +139,11 @@
87 + };
88 +
89 + clcd: clcd@31040000 {
90 +- compatible = "arm,pl110", "arm,primecell";
91 ++ compatible = "arm,pl111", "arm,primecell";
92 + reg = <0x31040000 0x1000>;
93 + interrupts = <14 IRQ_TYPE_LEVEL_HIGH>;
94 +- clocks = <&clk LPC32XX_CLK_LCD>;
95 +- clock-names = "apb_pclk";
96 ++ clocks = <&clk LPC32XX_CLK_LCD>, <&clk LPC32XX_CLK_LCD>;
97 ++ clock-names = "clcdclk", "apb_pclk";
98 + status = "disabled";
99 + };
100 +
101 +@@ -462,7 +462,9 @@
102 + key: key@40050000 {
103 + compatible = "nxp,lpc3220-key";
104 + reg = <0x40050000 0x1000>;
105 +- interrupts = <54 IRQ_TYPE_LEVEL_HIGH>;
106 ++ clocks = <&clk LPC32XX_CLK_KEY>;
107 ++ interrupt-parent = <&sic1>;
108 ++ interrupts = <22 IRQ_TYPE_LEVEL_HIGH>;
109 + status = "disabled";
110 + };
111 +
112 +diff --git a/arch/arm/boot/dts/ls1021a-twr.dts b/arch/arm/boot/dts/ls1021a-twr.dts
113 +index 44715c8ef756..72a3fc63d0ec 100644
114 +--- a/arch/arm/boot/dts/ls1021a-twr.dts
115 ++++ b/arch/arm/boot/dts/ls1021a-twr.dts
116 +@@ -143,7 +143,7 @@
117 + };
118 +
119 + &enet0 {
120 +- tbi-handle = <&tbi1>;
121 ++ tbi-handle = <&tbi0>;
122 + phy-handle = <&sgmii_phy2>;
123 + phy-connection-type = "sgmii";
124 + status = "okay";
125 +@@ -222,6 +222,13 @@
126 + sgmii_phy2: ethernet-phy@2 {
127 + reg = <0x2>;
128 + };
129 ++ tbi0: tbi-phy@1f {
130 ++ reg = <0x1f>;
131 ++ device_type = "tbi-phy";
132 ++ };
133 ++};
134 ++
135 ++&mdio1 {
136 + tbi1: tbi-phy@1f {
137 + reg = <0x1f>;
138 + device_type = "tbi-phy";
139 +diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi
140 +index 825f6eae3d1c..27133c3a4b12 100644
141 +--- a/arch/arm/boot/dts/ls1021a.dtsi
142 ++++ b/arch/arm/boot/dts/ls1021a.dtsi
143 +@@ -505,13 +505,22 @@
144 + };
145 +
146 + mdio0: mdio@2d24000 {
147 +- compatible = "gianfar";
148 ++ compatible = "fsl,etsec2-mdio";
149 + device_type = "mdio";
150 + #address-cells = <1>;
151 + #size-cells = <0>;
152 + reg = <0x0 0x2d24000 0x0 0x4000>;
153 + };
154 +
155 ++ mdio1: mdio@2d64000 {
156 ++ compatible = "fsl,etsec2-mdio";
157 ++ device_type = "mdio";
158 ++ #address-cells = <1>;
159 ++ #size-cells = <0>;
160 ++ reg = <0x0 0x2d64000 0x0 0x4000>,
161 ++ <0x0 0x2d50030 0x0 0x4>;
162 ++ };
163 ++
164 + ptp_clock@2d10e00 {
165 + compatible = "fsl,etsec-ptp";
166 + reg = <0x0 0x2d10e00 0x0 0xb0>;
167 +diff --git a/arch/arm/common/mcpm_entry.c b/arch/arm/common/mcpm_entry.c
168 +index a923524d1040..8617323eb273 100644
169 +--- a/arch/arm/common/mcpm_entry.c
170 ++++ b/arch/arm/common/mcpm_entry.c
171 +@@ -379,7 +379,7 @@ static int __init nocache_trampoline(unsigned long _arg)
172 + unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
173 + phys_reset_t phys_reset;
174 +
175 +- mcpm_set_entry_vector(cpu, cluster, cpu_resume);
176 ++ mcpm_set_entry_vector(cpu, cluster, cpu_resume_no_hyp);
177 + setup_mm_for_reboot();
178 +
179 + __mcpm_cpu_going_down(cpu, cluster);
180 +diff --git a/arch/arm/include/asm/suspend.h b/arch/arm/include/asm/suspend.h
181 +index 6c7182f32cef..e6c2f426f8c8 100644
182 +--- a/arch/arm/include/asm/suspend.h
183 ++++ b/arch/arm/include/asm/suspend.h
184 +@@ -7,6 +7,7 @@ struct sleep_save_sp {
185 + };
186 +
187 + extern void cpu_resume(void);
188 ++extern void cpu_resume_no_hyp(void);
189 + extern void cpu_resume_arm(void);
190 + extern int cpu_suspend(unsigned long, int (*)(unsigned long));
191 +
192 +diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S
193 +index 15d073ae5da2..f5e5e3e19659 100644
194 +--- a/arch/arm/kernel/hyp-stub.S
195 ++++ b/arch/arm/kernel/hyp-stub.S
196 +@@ -179,8 +179,8 @@ ARM_BE8(orr r7, r7, #(1 << 25)) @ HSCTLR.EE
197 + @ Check whether GICv3 system registers are available
198 + mrc p15, 0, r7, c0, c1, 1 @ ID_PFR1
199 + ubfx r7, r7, #28, #4
200 +- cmp r7, #1
201 +- bne 2f
202 ++ teq r7, #0
203 ++ beq 2f
204 +
205 + @ Enable system register accesses
206 + mrc p15, 4, r7, c12, c9, 5 @ ICC_HSRE
207 +diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S
208 +index 0f6c1000582c..c8569390e7e7 100644
209 +--- a/arch/arm/kernel/sleep.S
210 ++++ b/arch/arm/kernel/sleep.S
211 +@@ -119,6 +119,14 @@ ENDPROC(cpu_resume_after_mmu)
212 + .text
213 + .align
214 +
215 ++#ifdef CONFIG_MCPM
216 ++ .arm
217 ++THUMB( .thumb )
218 ++ENTRY(cpu_resume_no_hyp)
219 ++ARM_BE8(setend be) @ ensure we are in BE mode
220 ++ b no_hyp
221 ++#endif
222 ++
223 + #ifdef CONFIG_MMU
224 + .arm
225 + ENTRY(cpu_resume_arm)
226 +@@ -134,6 +142,7 @@ ARM_BE8(setend be) @ ensure we are in BE mode
227 + bl __hyp_stub_install_secondary
228 + #endif
229 + safe_svcmode_maskall r1
230 ++no_hyp:
231 + mov r1, #0
232 + ALT_SMP(mrc p15, 0, r0, c0, c0, 5)
233 + ALT_UP_B(1f)
234 +@@ -162,6 +171,9 @@ ENDPROC(cpu_resume)
235 +
236 + #ifdef CONFIG_MMU
237 + ENDPROC(cpu_resume_arm)
238 ++#endif
239 ++#ifdef CONFIG_MCPM
240 ++ENDPROC(cpu_resume_no_hyp)
241 + #endif
242 +
243 + .align 2
244 +diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
245 +index bfc74954540c..9421b78f869d 100644
246 +--- a/arch/arm/mach-omap2/omap_hwmod.c
247 ++++ b/arch/arm/mach-omap2/omap_hwmod.c
248 +@@ -2588,7 +2588,7 @@ static void _setup_iclk_autoidle(struct omap_hwmod *oh)
249 + */
250 + static int _setup_reset(struct omap_hwmod *oh)
251 + {
252 +- int r;
253 ++ int r = 0;
254 +
255 + if (oh->_state != _HWMOD_STATE_INITIALIZED)
256 + return -EINVAL;
257 +diff --git a/arch/arm/mach-rpc/irq.c b/arch/arm/mach-rpc/irq.c
258 +index 66502e6207fe..fce7fecbd8fa 100644
259 +--- a/arch/arm/mach-rpc/irq.c
260 ++++ b/arch/arm/mach-rpc/irq.c
261 +@@ -117,7 +117,7 @@ extern unsigned char rpc_default_fiq_start, rpc_default_fiq_end;
262 +
263 + void __init rpc_init_irq(void)
264 + {
265 +- unsigned int irq, clr, set = 0;
266 ++ unsigned int irq, clr, set;
267 +
268 + iomd_writeb(0, IOMD_IRQMASKA);
269 + iomd_writeb(0, IOMD_IRQMASKB);
270 +@@ -129,6 +129,7 @@ void __init rpc_init_irq(void)
271 +
272 + for (irq = 0; irq < NR_IRQS; irq++) {
273 + clr = IRQ_NOREQUEST;
274 ++ set = 0;
275 +
276 + if (irq <= 6 || (irq >= 9 && irq <= 15))
277 + clr |= IRQ_NOPROBE;
278 +diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c
279 +index b92673efffff..97bd43c16cd8 100644
280 +--- a/arch/arm/plat-pxa/ssp.c
281 ++++ b/arch/arm/plat-pxa/ssp.c
282 +@@ -230,18 +230,12 @@ static int pxa_ssp_probe(struct platform_device *pdev)
283 +
284 + static int pxa_ssp_remove(struct platform_device *pdev)
285 + {
286 +- struct resource *res;
287 + struct ssp_device *ssp;
288 +
289 + ssp = platform_get_drvdata(pdev);
290 + if (ssp == NULL)
291 + return -ENODEV;
292 +
293 +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
294 +- release_mem_region(res->start, resource_size(res));
295 +-
296 +- clk_put(ssp->clk);
297 +-
298 + mutex_lock(&ssp_lock);
299 + list_del(&ssp->node);
300 + mutex_unlock(&ssp_lock);
301 +diff --git a/arch/arm64/boot/dts/arm/juno-clocks.dtsi b/arch/arm64/boot/dts/arm/juno-clocks.dtsi
302 +index 25352ed943e6..00bcbf7688c7 100644
303 +--- a/arch/arm64/boot/dts/arm/juno-clocks.dtsi
304 ++++ b/arch/arm64/boot/dts/arm/juno-clocks.dtsi
305 +@@ -8,10 +8,10 @@
306 + */
307 +
308 + /* SoC fixed clocks */
309 +- soc_uartclk: refclk7273800hz {
310 ++ soc_uartclk: refclk7372800hz {
311 + compatible = "fixed-clock";
312 + #clock-cells = <0>;
313 +- clock-frequency = <7273800>;
314 ++ clock-frequency = <7372800>;
315 + clock-output-names = "juno:uartclk";
316 + };
317 +
318 +diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
319 +index 601be6127628..948efff7d830 100644
320 +--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
321 ++++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
322 +@@ -355,6 +355,8 @@
323 + l11 {
324 + regulator-min-microvolt = <1750000>;
325 + regulator-max-microvolt = <3337000>;
326 ++ regulator-allow-set-load;
327 ++ regulator-system-load = <200000>;
328 + };
329 +
330 + l12 {
331 +diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
332 +index 9a8e45dc36bd..8cf001baee21 100644
333 +--- a/arch/arm64/kernel/cpufeature.c
334 ++++ b/arch/arm64/kernel/cpufeature.c
335 +@@ -789,6 +789,11 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
336 + switch (read_cpuid_id() & MIDR_CPU_MODEL_MASK) {
337 + case MIDR_CAVIUM_THUNDERX2:
338 + case MIDR_BRCM_VULCAN:
339 ++ case MIDR_CORTEX_A53:
340 ++ case MIDR_CORTEX_A55:
341 ++ case MIDR_CORTEX_A57:
342 ++ case MIDR_CORTEX_A72:
343 ++ case MIDR_CORTEX_A73:
344 + return false;
345 + }
346 +
347 +diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c
348 +index 2081b8cd5591..b9aee983e6f4 100644
349 +--- a/arch/m68k/amiga/cia.c
350 ++++ b/arch/m68k/amiga/cia.c
351 +@@ -88,10 +88,19 @@ static irqreturn_t cia_handler(int irq, void *dev_id)
352 + struct ciabase *base = dev_id;
353 + int mach_irq;
354 + unsigned char ints;
355 ++ unsigned long flags;
356 +
357 ++ /* Interrupts get disabled while the timer irq flag is cleared and
358 ++ * the timer interrupt serviced.
359 ++ */
360 + mach_irq = base->cia_irq;
361 ++ local_irq_save(flags);
362 + ints = cia_set_irq(base, CIA_ICR_ALL);
363 + amiga_custom.intreq = base->int_mask;
364 ++ if (ints & 1)
365 ++ generic_handle_irq(mach_irq);
366 ++ local_irq_restore(flags);
367 ++ mach_irq++, ints >>= 1;
368 + for (; ints; mach_irq++, ints >>= 1) {
369 + if (ints & 1)
370 + generic_handle_irq(mach_irq);
371 +diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
372 +index 3d2b63bedf05..56f02ea2c248 100644
373 +--- a/arch/m68k/atari/ataints.c
374 ++++ b/arch/m68k/atari/ataints.c
375 +@@ -142,7 +142,7 @@ struct mfptimerbase {
376 + .name = "MFP Timer D"
377 + };
378 +
379 +-static irqreturn_t mfptimer_handler(int irq, void *dev_id)
380 ++static irqreturn_t mfp_timer_d_handler(int irq, void *dev_id)
381 + {
382 + struct mfptimerbase *base = dev_id;
383 + int mach_irq;
384 +@@ -344,7 +344,7 @@ void __init atari_init_IRQ(void)
385 + st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 0xf0) | 0x6;
386 +
387 + /* request timer D dispatch handler */
388 +- if (request_irq(IRQ_MFP_TIMD, mfptimer_handler, IRQF_SHARED,
389 ++ if (request_irq(IRQ_MFP_TIMD, mfp_timer_d_handler, IRQF_SHARED,
390 + stmfp_base.name, &stmfp_base))
391 + pr_err("Couldn't register %s interrupt\n", stmfp_base.name);
392 +
393 +diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c
394 +index c549b48174ec..972181c1fe4b 100644
395 +--- a/arch/m68k/atari/time.c
396 ++++ b/arch/m68k/atari/time.c
397 +@@ -24,6 +24,18 @@
398 + DEFINE_SPINLOCK(rtc_lock);
399 + EXPORT_SYMBOL_GPL(rtc_lock);
400 +
401 ++static irqreturn_t mfp_timer_c_handler(int irq, void *dev_id)
402 ++{
403 ++ irq_handler_t timer_routine = dev_id;
404 ++ unsigned long flags;
405 ++
406 ++ local_irq_save(flags);
407 ++ timer_routine(0, NULL);
408 ++ local_irq_restore(flags);
409 ++
410 ++ return IRQ_HANDLED;
411 ++}
412 ++
413 + void __init
414 + atari_sched_init(irq_handler_t timer_routine)
415 + {
416 +@@ -32,7 +44,8 @@ atari_sched_init(irq_handler_t timer_routine)
417 + /* start timer C, div = 1:100 */
418 + st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 15) | 0x60;
419 + /* install interrupt service routine for MFP Timer C */
420 +- if (request_irq(IRQ_MFP_TIMC, timer_routine, 0, "timer", timer_routine))
421 ++ if (request_irq(IRQ_MFP_TIMC, mfp_timer_c_handler, 0, "timer",
422 ++ timer_routine))
423 + pr_err("Couldn't register timer interrupt\n");
424 + }
425 +
426 +diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
427 +index 611d4d9ea2bd..3978d71d250b 100644
428 +--- a/arch/m68k/bvme6000/config.c
429 ++++ b/arch/m68k/bvme6000/config.c
430 +@@ -45,11 +45,6 @@ extern int bvme6000_set_clock_mmss (unsigned long);
431 + extern void bvme6000_reset (void);
432 + void bvme6000_set_vectors (void);
433 +
434 +-/* Save tick handler routine pointer, will point to xtime_update() in
435 +- * kernel/timer/timekeeping.c, called via bvme6000_process_int() */
436 +-
437 +-static irq_handler_t tick_handler;
438 +-
439 +
440 + int __init bvme6000_parse_bootinfo(const struct bi_record *bi)
441 + {
442 +@@ -159,12 +154,18 @@ irqreturn_t bvme6000_abort_int (int irq, void *dev_id)
443 +
444 + static irqreturn_t bvme6000_timer_int (int irq, void *dev_id)
445 + {
446 ++ irq_handler_t timer_routine = dev_id;
447 ++ unsigned long flags;
448 + volatile RtcPtr_t rtc = (RtcPtr_t)BVME_RTC_BASE;
449 +- unsigned char msr = rtc->msr & 0xc0;
450 ++ unsigned char msr;
451 +
452 ++ local_irq_save(flags);
453 ++ msr = rtc->msr & 0xc0;
454 + rtc->msr = msr | 0x20; /* Ack the interrupt */
455 ++ timer_routine(0, NULL);
456 ++ local_irq_restore(flags);
457 +
458 +- return tick_handler(irq, dev_id);
459 ++ return IRQ_HANDLED;
460 + }
461 +
462 + /*
463 +@@ -183,9 +184,8 @@ void bvme6000_sched_init (irq_handler_t timer_routine)
464 +
465 + rtc->msr = 0; /* Ensure timer registers accessible */
466 +
467 +- tick_handler = timer_routine;
468 +- if (request_irq(BVME_IRQ_RTC, bvme6000_timer_int, 0,
469 +- "timer", bvme6000_timer_int))
470 ++ if (request_irq(BVME_IRQ_RTC, bvme6000_timer_int, 0, "timer",
471 ++ timer_routine))
472 + panic ("Couldn't register timer int");
473 +
474 + rtc->t1cr_omr = 0x04; /* Mode 2, ext clk */
475 +diff --git a/arch/m68k/hp300/time.c b/arch/m68k/hp300/time.c
476 +index 749543b425a4..03c83b8f9032 100644
477 +--- a/arch/m68k/hp300/time.c
478 ++++ b/arch/m68k/hp300/time.c
479 +@@ -37,13 +37,19 @@
480 +
481 + static irqreturn_t hp300_tick(int irq, void *dev_id)
482 + {
483 ++ irq_handler_t timer_routine = dev_id;
484 ++ unsigned long flags;
485 + unsigned long tmp;
486 +- irq_handler_t vector = dev_id;
487 ++
488 ++ local_irq_save(flags);
489 + in_8(CLOCKBASE + CLKSR);
490 + asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
491 ++ timer_routine(0, NULL);
492 ++ local_irq_restore(flags);
493 ++
494 + /* Turn off the network and SCSI leds */
495 + blinken_leds(0, 0xe0);
496 +- return vector(irq, NULL);
497 ++ return IRQ_HANDLED;
498 + }
499 +
500 + u32 hp300_gettimeoffset(void)
501 +diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
502 +index 920ff63d4a81..a435aced6e43 100644
503 +--- a/arch/m68k/mac/via.c
504 ++++ b/arch/m68k/mac/via.c
505 +@@ -53,16 +53,6 @@ static __u8 rbv_clear;
506 +
507 + static int gIER,gIFR,gBufA,gBufB;
508 +
509 +-/*
510 +- * Timer defs.
511 +- */
512 +-
513 +-#define TICK_SIZE 10000
514 +-#define MAC_CLOCK_TICK (783300/HZ) /* ticks per HZ */
515 +-#define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF)
516 +-#define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8)
517 +-
518 +-
519 + /*
520 + * On Macs with a genuine VIA chip there is no way to mask an individual slot
521 + * interrupt. This limitation also seems to apply to VIA clone logic cores in
522 +@@ -277,22 +267,6 @@ void __init via_init(void)
523 + }
524 + }
525 +
526 +-/*
527 +- * Start the 100 Hz clock
528 +- */
529 +-
530 +-void __init via_init_clock(irq_handler_t func)
531 +-{
532 +- via1[vACR] |= 0x40;
533 +- via1[vT1LL] = MAC_CLOCK_LOW;
534 +- via1[vT1LH] = MAC_CLOCK_HIGH;
535 +- via1[vT1CL] = MAC_CLOCK_LOW;
536 +- via1[vT1CH] = MAC_CLOCK_HIGH;
537 +-
538 +- if (request_irq(IRQ_MAC_TIMER_1, func, 0, "timer", func))
539 +- pr_err("Couldn't register %s interrupt\n", "timer");
540 +-}
541 +-
542 + /*
543 + * Debugging dump, used in various places to see what's going on.
544 + */
545 +@@ -320,29 +294,6 @@ void via_debug_dump(void)
546 + }
547 + }
548 +
549 +-/*
550 +- * This is always executed with interrupts disabled.
551 +- *
552 +- * TBI: get time offset between scheduling timer ticks
553 +- */
554 +-
555 +-u32 mac_gettimeoffset(void)
556 +-{
557 +- unsigned long ticks, offset = 0;
558 +-
559 +- /* read VIA1 timer 2 current value */
560 +- ticks = via1[vT1CL] | (via1[vT1CH] << 8);
561 +- /* The probability of underflow is less than 2% */
562 +- if (ticks > MAC_CLOCK_TICK - MAC_CLOCK_TICK / 50)
563 +- /* Check for pending timer interrupt in VIA1 IFR */
564 +- if (via1[vIFR] & 0x40) offset = TICK_SIZE;
565 +-
566 +- ticks = MAC_CLOCK_TICK - ticks;
567 +- ticks = ticks * 10000L / MAC_CLOCK_TICK;
568 +-
569 +- return (ticks + offset) * 1000;
570 +-}
571 +-
572 + /*
573 + * Flush the L2 cache on Macs that have it by flipping
574 + * the system into 24-bit mode for an instant.
575 +@@ -446,6 +397,8 @@ void via_nubus_irq_shutdown(int irq)
576 + * via6522.c :-), disable/pending masks added.
577 + */
578 +
579 ++#define VIA_TIMER_1_INT BIT(6)
580 ++
581 + void via1_irq(struct irq_desc *desc)
582 + {
583 + int irq_num;
584 +@@ -455,6 +408,21 @@ void via1_irq(struct irq_desc *desc)
585 + if (!events)
586 + return;
587 +
588 ++ irq_num = IRQ_MAC_TIMER_1;
589 ++ irq_bit = VIA_TIMER_1_INT;
590 ++ if (events & irq_bit) {
591 ++ unsigned long flags;
592 ++
593 ++ local_irq_save(flags);
594 ++ via1[vIFR] = irq_bit;
595 ++ generic_handle_irq(irq_num);
596 ++ local_irq_restore(flags);
597 ++
598 ++ events &= ~irq_bit;
599 ++ if (!events)
600 ++ return;
601 ++ }
602 ++
603 + irq_num = VIA1_SOURCE_BASE;
604 + irq_bit = 1;
605 + do {
606 +@@ -619,3 +587,56 @@ int via2_scsi_drq_pending(void)
607 + return via2[gIFR] & (1 << IRQ_IDX(IRQ_MAC_SCSIDRQ));
608 + }
609 + EXPORT_SYMBOL(via2_scsi_drq_pending);
610 ++
611 ++/* timer and clock source */
612 ++
613 ++#define VIA_CLOCK_FREQ 783360 /* VIA "phase 2" clock in Hz */
614 ++#define VIA_TIMER_INTERVAL (1000000 / HZ) /* microseconds per jiffy */
615 ++#define VIA_TIMER_CYCLES (VIA_CLOCK_FREQ / HZ) /* clock cycles per jiffy */
616 ++
617 ++#define VIA_TC (VIA_TIMER_CYCLES - 2) /* including 0 and -1 */
618 ++#define VIA_TC_LOW (VIA_TC & 0xFF)
619 ++#define VIA_TC_HIGH (VIA_TC >> 8)
620 ++
621 ++void __init via_init_clock(irq_handler_t timer_routine)
622 ++{
623 ++ if (request_irq(IRQ_MAC_TIMER_1, timer_routine, 0, "timer", NULL)) {
624 ++ pr_err("Couldn't register %s interrupt\n", "timer");
625 ++ return;
626 ++ }
627 ++
628 ++ via1[vT1LL] = VIA_TC_LOW;
629 ++ via1[vT1LH] = VIA_TC_HIGH;
630 ++ via1[vT1CL] = VIA_TC_LOW;
631 ++ via1[vT1CH] = VIA_TC_HIGH;
632 ++ via1[vACR] |= 0x40;
633 ++}
634 ++
635 ++u32 mac_gettimeoffset(void)
636 ++{
637 ++ unsigned long flags;
638 ++ u8 count_high;
639 ++ u16 count, offset = 0;
640 ++
641 ++ /*
642 ++ * Timer counter wrap-around is detected with the timer interrupt flag
643 ++ * but reading the counter low byte (vT1CL) would reset the flag.
644 ++ * Also, accessing both counter registers is essentially a data race.
645 ++ * These problems are avoided by ignoring the low byte. Clock accuracy
646 ++ * is 256 times worse (error can reach 0.327 ms) but CPU overhead is
647 ++ * reduced by avoiding slow VIA register accesses.
648 ++ */
649 ++
650 ++ local_irq_save(flags);
651 ++ count_high = via1[vT1CH];
652 ++ if (count_high == 0xFF)
653 ++ count_high = 0;
654 ++ if (count_high > 0 && (via1[vIFR] & VIA_TIMER_1_INT))
655 ++ offset = VIA_TIMER_CYCLES;
656 ++ local_irq_restore(flags);
657 ++
658 ++ count = count_high << 8;
659 ++ count = VIA_TIMER_CYCLES - count + offset;
660 ++
661 ++ return ((count * VIA_TIMER_INTERVAL) / VIA_TIMER_CYCLES) * 1000;
662 ++}
663 +diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
664 +index c11d38dfad08..1a095443790b 100644
665 +--- a/arch/m68k/mvme147/config.c
666 ++++ b/arch/m68k/mvme147/config.c
667 +@@ -46,11 +46,6 @@ extern void mvme147_reset (void);
668 +
669 + static int bcd2int (unsigned char b);
670 +
671 +-/* Save tick handler routine pointer, will point to xtime_update() in
672 +- * kernel/time/timekeeping.c, called via mvme147_process_int() */
673 +-
674 +-irq_handler_t tick_handler;
675 +-
676 +
677 + int __init mvme147_parse_bootinfo(const struct bi_record *bi)
678 + {
679 +@@ -106,16 +101,23 @@ void __init config_mvme147(void)
680 +
681 + static irqreturn_t mvme147_timer_int (int irq, void *dev_id)
682 + {
683 ++ irq_handler_t timer_routine = dev_id;
684 ++ unsigned long flags;
685 ++
686 ++ local_irq_save(flags);
687 + m147_pcc->t1_int_cntrl = PCC_TIMER_INT_CLR;
688 + m147_pcc->t1_int_cntrl = PCC_INT_ENAB|PCC_LEVEL_TIMER1;
689 +- return tick_handler(irq, dev_id);
690 ++ timer_routine(0, NULL);
691 ++ local_irq_restore(flags);
692 ++
693 ++ return IRQ_HANDLED;
694 + }
695 +
696 +
697 + void mvme147_sched_init (irq_handler_t timer_routine)
698 + {
699 +- tick_handler = timer_routine;
700 +- if (request_irq(PCC_IRQ_TIMER1, mvme147_timer_int, 0, "timer 1", NULL))
701 ++ if (request_irq(PCC_IRQ_TIMER1, mvme147_timer_int, 0, "timer 1",
702 ++ timer_routine))
703 + pr_err("Couldn't register timer interrupt\n");
704 +
705 + /* Init the clock with a value */
706 +diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
707 +index 58e240939d26..ac49fa7ec46b 100644
708 +--- a/arch/m68k/mvme16x/config.c
709 ++++ b/arch/m68k/mvme16x/config.c
710 +@@ -51,11 +51,6 @@ extern void mvme16x_reset (void);
711 +
712 + int bcd2int (unsigned char b);
713 +
714 +-/* Save tick handler routine pointer, will point to xtime_update() in
715 +- * kernel/time/timekeeping.c, called via mvme16x_process_int() */
716 +-
717 +-static irq_handler_t tick_handler;
718 +-
719 +
720 + unsigned short mvme16x_config;
721 + EXPORT_SYMBOL(mvme16x_config);
722 +@@ -354,8 +349,15 @@ static irqreturn_t mvme16x_abort_int (int irq, void *dev_id)
723 +
724 + static irqreturn_t mvme16x_timer_int (int irq, void *dev_id)
725 + {
726 +- *(volatile unsigned char *)0xfff4201b |= 8;
727 +- return tick_handler(irq, dev_id);
728 ++ irq_handler_t timer_routine = dev_id;
729 ++ unsigned long flags;
730 ++
731 ++ local_irq_save(flags);
732 ++ *(volatile unsigned char *)0xfff4201b |= 8;
733 ++ timer_routine(0, NULL);
734 ++ local_irq_restore(flags);
735 ++
736 ++ return IRQ_HANDLED;
737 + }
738 +
739 + void mvme16x_sched_init (irq_handler_t timer_routine)
740 +@@ -363,14 +365,13 @@ void mvme16x_sched_init (irq_handler_t timer_routine)
741 + uint16_t brdno = be16_to_cpu(mvme_bdid.brdno);
742 + int irq;
743 +
744 +- tick_handler = timer_routine;
745 + /* Using PCCchip2 or MC2 chip tick timer 1 */
746 + *(volatile unsigned long *)0xfff42008 = 0;
747 + *(volatile unsigned long *)0xfff42004 = 10000; /* 10ms */
748 + *(volatile unsigned char *)0xfff42017 |= 3;
749 + *(volatile unsigned char *)0xfff4201b = 0x16;
750 +- if (request_irq(MVME16x_IRQ_TIMER, mvme16x_timer_int, 0,
751 +- "timer", mvme16x_timer_int))
752 ++ if (request_irq(MVME16x_IRQ_TIMER, mvme16x_timer_int, 0, "timer",
753 ++ timer_routine))
754 + panic ("Couldn't register timer int");
755 +
756 + if (brdno == 0x0162 || brdno == 0x172)
757 +diff --git a/arch/m68k/q40/q40ints.c b/arch/m68k/q40/q40ints.c
758 +index 513f9bb17b9c..60b51f5b9cfc 100644
759 +--- a/arch/m68k/q40/q40ints.c
760 ++++ b/arch/m68k/q40/q40ints.c
761 +@@ -126,10 +126,10 @@ void q40_mksound(unsigned int hz, unsigned int ticks)
762 + sound_ticks = ticks << 1;
763 + }
764 +
765 +-static irq_handler_t q40_timer_routine;
766 +-
767 +-static irqreturn_t q40_timer_int (int irq, void * dev)
768 ++static irqreturn_t q40_timer_int(int irq, void *dev_id)
769 + {
770 ++ irq_handler_t timer_routine = dev_id;
771 ++
772 + ql_ticks = ql_ticks ? 0 : 1;
773 + if (sound_ticks) {
774 + unsigned char sval=(sound_ticks & 1) ? 128-SVOL : 128+SVOL;
775 +@@ -138,8 +138,13 @@ static irqreturn_t q40_timer_int (int irq, void * dev)
776 + *DAC_RIGHT=sval;
777 + }
778 +
779 +- if (!ql_ticks)
780 +- q40_timer_routine(irq, dev);
781 ++ if (!ql_ticks) {
782 ++ unsigned long flags;
783 ++
784 ++ local_irq_save(flags);
785 ++ timer_routine(0, NULL);
786 ++ local_irq_restore(flags);
787 ++ }
788 + return IRQ_HANDLED;
789 + }
790 +
791 +@@ -147,11 +152,9 @@ void q40_sched_init (irq_handler_t timer_routine)
792 + {
793 + int timer_irq;
794 +
795 +- q40_timer_routine = timer_routine;
796 + timer_irq = Q40_IRQ_FRAME;
797 +
798 +- if (request_irq(timer_irq, q40_timer_int, 0,
799 +- "timer", q40_timer_int))
800 ++ if (request_irq(timer_irq, q40_timer_int, 0, "timer", timer_routine))
801 + panic("Couldn't register timer int");
802 +
803 + master_outb(-1, FRAME_CLEAR_REG);
804 +diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
805 +index 6bbca30c9188..a5824abb4a39 100644
806 +--- a/arch/m68k/sun3/sun3ints.c
807 ++++ b/arch/m68k/sun3/sun3ints.c
808 +@@ -61,8 +61,10 @@ static irqreturn_t sun3_int7(int irq, void *dev_id)
809 +
810 + static irqreturn_t sun3_int5(int irq, void *dev_id)
811 + {
812 ++ unsigned long flags;
813 + unsigned int cnt;
814 +
815 ++ local_irq_save(flags);
816 + #ifdef CONFIG_SUN3
817 + intersil_clear();
818 + #endif
819 +@@ -76,6 +78,7 @@ static irqreturn_t sun3_int5(int irq, void *dev_id)
820 + cnt = kstat_irqs_cpu(irq, 0);
821 + if (!(cnt % 20))
822 + sun3_leds(led_pattern[cnt % 160 / 20]);
823 ++ local_irq_restore(flags);
824 + return IRQ_HANDLED;
825 + }
826 +
827 +diff --git a/arch/m68k/sun3x/time.c b/arch/m68k/sun3x/time.c
828 +index 431d3c4306dd..a4f6a44d3418 100644
829 +--- a/arch/m68k/sun3x/time.c
830 ++++ b/arch/m68k/sun3x/time.c
831 +@@ -77,15 +77,19 @@ u32 sun3x_gettimeoffset(void)
832 + }
833 +
834 + #if 0
835 +-static void sun3x_timer_tick(int irq, void *dev_id, struct pt_regs *regs)
836 ++static irqreturn_t sun3x_timer_tick(int irq, void *dev_id)
837 + {
838 +- void (*vector)(int, void *, struct pt_regs *) = dev_id;
839 ++ irq_handler_t timer_routine = dev_id;
840 ++ unsigned long flags;
841 +
842 +- /* Clear the pending interrupt - pulse the enable line low */
843 +- disable_irq(5);
844 +- enable_irq(5);
845 ++ local_irq_save(flags);
846 ++ /* Clear the pending interrupt - pulse the enable line low */
847 ++ disable_irq(5);
848 ++ enable_irq(5);
849 ++ timer_routine(0, NULL);
850 ++ local_irq_restore(flags);
851 +
852 +- vector(irq, NULL, regs);
853 ++ return IRQ_HANDLED;
854 + }
855 + #endif
856 +
857 +diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
858 +index 06049b6b3ddd..5dfae80264b9 100644
859 +--- a/arch/mips/include/asm/io.h
860 ++++ b/arch/mips/include/asm/io.h
861 +@@ -60,21 +60,11 @@
862 + * instruction, so the lower 16 bits must be zero. Should be true on
863 + * on any sane architecture; generic code does not use this assumption.
864 + */
865 +-extern const unsigned long mips_io_port_base;
866 ++extern unsigned long mips_io_port_base;
867 +
868 +-/*
869 +- * Gcc will generate code to load the value of mips_io_port_base after each
870 +- * function call which may be fairly wasteful in some cases. So we don't
871 +- * play quite by the book. We tell gcc mips_io_port_base is a long variable
872 +- * which solves the code generation issue. Now we need to violate the
873 +- * aliasing rules a little to make initialization possible and finally we
874 +- * will need the barrier() to fight side effects of the aliasing chat.
875 +- * This trickery will eventually collapse under gcc's optimizer. Oh well.
876 +- */
877 + static inline void set_io_port_base(unsigned long base)
878 + {
879 +- * (unsigned long *) &mips_io_port_base = base;
880 +- barrier();
881 ++ mips_io_port_base = base;
882 + }
883 +
884 + /*
885 +diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
886 +index 695950361d2a..7cc1d29334ee 100644
887 +--- a/arch/mips/kernel/setup.c
888 ++++ b/arch/mips/kernel/setup.c
889 +@@ -74,7 +74,7 @@ static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
890 + * mips_io_port_base is the begin of the address space to which x86 style
891 + * I/O ports are mapped.
892 + */
893 +-const unsigned long mips_io_port_base = -1;
894 ++unsigned long mips_io_port_base = -1;
895 + EXPORT_SYMBOL(mips_io_port_base);
896 +
897 + static struct resource code_resource = { .name = "Kernel code", };
898 +diff --git a/arch/nios2/kernel/nios2_ksyms.c b/arch/nios2/kernel/nios2_ksyms.c
899 +index bf2f55d10a4d..4e704046a150 100644
900 +--- a/arch/nios2/kernel/nios2_ksyms.c
901 ++++ b/arch/nios2/kernel/nios2_ksyms.c
902 +@@ -9,12 +9,20 @@
903 + #include <linux/export.h>
904 + #include <linux/string.h>
905 +
906 ++#include <asm/cacheflush.h>
907 ++#include <asm/pgtable.h>
908 ++
909 + /* string functions */
910 +
911 + EXPORT_SYMBOL(memcpy);
912 + EXPORT_SYMBOL(memset);
913 + EXPORT_SYMBOL(memmove);
914 +
915 ++/* memory management */
916 ++
917 ++EXPORT_SYMBOL(empty_zero_page);
918 ++EXPORT_SYMBOL(flush_icache_range);
919 ++
920 + /*
921 + * libgcc functions - functions that are used internally by the
922 + * compiler... (prototypes are not correct though, but that
923 +@@ -31,3 +39,7 @@ DECLARE_EXPORT(__udivsi3);
924 + DECLARE_EXPORT(__umoddi3);
925 + DECLARE_EXPORT(__umodsi3);
926 + DECLARE_EXPORT(__muldi3);
927 ++DECLARE_EXPORT(__ucmpdi2);
928 ++DECLARE_EXPORT(__lshrdi3);
929 ++DECLARE_EXPORT(__ashldi3);
930 ++DECLARE_EXPORT(__ashrdi3);
931 +diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
932 +index a60c9c6e5cc1..de29b88c0e70 100644
933 +--- a/arch/powerpc/Makefile
934 ++++ b/arch/powerpc/Makefile
935 +@@ -373,7 +373,9 @@ vdso_install:
936 + ifeq ($(CONFIG_PPC64),y)
937 + $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
938 + endif
939 ++ifdef CONFIG_VDSO32
940 + $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@
941 ++endif
942 +
943 + archclean:
944 + $(Q)$(MAKE) $(clean)=$(boot)
945 +diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h
946 +index 85e88f7a59c0..9ff848e3c4a6 100644
947 +--- a/arch/powerpc/include/asm/archrandom.h
948 ++++ b/arch/powerpc/include/asm/archrandom.h
949 +@@ -27,7 +27,7 @@ static inline int arch_get_random_seed_int(unsigned int *v)
950 + unsigned long val;
951 + int rc;
952 +
953 +- rc = arch_get_random_long(&val);
954 ++ rc = arch_get_random_seed_long(&val);
955 + if (rc)
956 + *v = val;
957 +
958 +diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
959 +index c641983bbdd6..3394a72b19f2 100644
960 +--- a/arch/powerpc/kernel/cacheinfo.c
961 ++++ b/arch/powerpc/kernel/cacheinfo.c
962 +@@ -867,4 +867,21 @@ void cacheinfo_cpu_offline(unsigned int cpu_id)
963 + if (cache)
964 + cache_cpu_clear(cache, cpu_id);
965 + }
966 ++
967 ++void cacheinfo_teardown(void)
968 ++{
969 ++ unsigned int cpu;
970 ++
971 ++ for_each_online_cpu(cpu)
972 ++ cacheinfo_cpu_offline(cpu);
973 ++}
974 ++
975 ++void cacheinfo_rebuild(void)
976 ++{
977 ++ unsigned int cpu;
978 ++
979 ++ for_each_online_cpu(cpu)
980 ++ cacheinfo_cpu_online(cpu);
981 ++}
982 ++
983 + #endif /* (CONFIG_PPC_PSERIES && CONFIG_SUSPEND) || CONFIG_HOTPLUG_CPU */
984 +diff --git a/arch/powerpc/kernel/cacheinfo.h b/arch/powerpc/kernel/cacheinfo.h
985 +index a7b74d36acd7..2cdee87a482c 100644
986 +--- a/arch/powerpc/kernel/cacheinfo.h
987 ++++ b/arch/powerpc/kernel/cacheinfo.h
988 +@@ -5,4 +5,8 @@
989 + extern void cacheinfo_cpu_online(unsigned int cpu_id);
990 + extern void cacheinfo_cpu_offline(unsigned int cpu_id);
991 +
992 ++/* Allow migration/suspend to tear down and rebuild the hierarchy. */
993 ++extern void cacheinfo_teardown(void);
994 ++extern void cacheinfo_rebuild(void);
995 ++
996 + #endif /* _PPC_CACHEINFO_H */
997 +diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
998 +index 4386440fe463..f09a192260f8 100644
999 +--- a/arch/x86/Kconfig.debug
1000 ++++ b/arch/x86/Kconfig.debug
1001 +@@ -192,7 +192,7 @@ config HAVE_MMIOTRACE_SUPPORT
1002 +
1003 + config X86_DECODER_SELFTEST
1004 + bool "x86 instruction decoder selftest"
1005 +- depends on DEBUG_KERNEL && KPROBES
1006 ++ depends on DEBUG_KERNEL && INSTRUCTION_DECODER
1007 + depends on !COMPILE_TEST
1008 + ---help---
1009 + Perform x86 instruction decoder selftests at build time.
1010 +diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
1011 +index 8e36f249646e..904e18bb38c5 100644
1012 +--- a/arch/x86/kernel/kgdb.c
1013 ++++ b/arch/x86/kernel/kgdb.c
1014 +@@ -438,7 +438,7 @@ static void kgdb_disable_hw_debug(struct pt_regs *regs)
1015 + */
1016 + void kgdb_roundup_cpus(unsigned long flags)
1017 + {
1018 +- apic->send_IPI_allbutself(APIC_DM_NMI);
1019 ++ apic->send_IPI_allbutself(NMI_VECTOR);
1020 + }
1021 + #endif
1022 +
1023 +diff --git a/block/blk-merge.c b/block/blk-merge.c
1024 +index 2642e5fc8b69..66795cca662a 100644
1025 +--- a/block/blk-merge.c
1026 ++++ b/block/blk-merge.c
1027 +@@ -305,13 +305,7 @@ void blk_recalc_rq_segments(struct request *rq)
1028 +
1029 + void blk_recount_segments(struct request_queue *q, struct bio *bio)
1030 + {
1031 +- unsigned short seg_cnt;
1032 +-
1033 +- /* estimate segment number by bi_vcnt for non-cloned bio */
1034 +- if (bio_flagged(bio, BIO_CLONED))
1035 +- seg_cnt = bio_segments(bio);
1036 +- else
1037 +- seg_cnt = bio->bi_vcnt;
1038 ++ unsigned short seg_cnt = bio_segments(bio);
1039 +
1040 + if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags) &&
1041 + (seg_cnt < queue_max_segments(q)))
1042 +diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
1043 +index f8ec3d4ba4a8..a5718c0a3dc4 100644
1044 +--- a/crypto/pcrypt.c
1045 ++++ b/crypto/pcrypt.c
1046 +@@ -394,7 +394,7 @@ static int pcrypt_sysfs_add(struct padata_instance *pinst, const char *name)
1047 + int ret;
1048 +
1049 + pinst->kobj.kset = pcrypt_kset;
1050 +- ret = kobject_add(&pinst->kobj, NULL, name);
1051 ++ ret = kobject_add(&pinst->kobj, NULL, "%s", name);
1052 + if (!ret)
1053 + kobject_uevent(&pinst->kobj, KOBJ_ADD);
1054 +
1055 +diff --git a/crypto/tgr192.c b/crypto/tgr192.c
1056 +index 321bc6ff2a9d..904c8444aa0a 100644
1057 +--- a/crypto/tgr192.c
1058 ++++ b/crypto/tgr192.c
1059 +@@ -25,8 +25,9 @@
1060 + #include <linux/init.h>
1061 + #include <linux/module.h>
1062 + #include <linux/mm.h>
1063 +-#include <asm/byteorder.h>
1064 + #include <linux/types.h>
1065 ++#include <asm/byteorder.h>
1066 ++#include <asm/unaligned.h>
1067 +
1068 + #define TGR192_DIGEST_SIZE 24
1069 + #define TGR160_DIGEST_SIZE 20
1070 +@@ -468,10 +469,9 @@ static void tgr192_transform(struct tgr192_ctx *tctx, const u8 * data)
1071 + u64 a, b, c, aa, bb, cc;
1072 + u64 x[8];
1073 + int i;
1074 +- const __le64 *ptr = (const __le64 *)data;
1075 +
1076 + for (i = 0; i < 8; i++)
1077 +- x[i] = le64_to_cpu(ptr[i]);
1078 ++ x[i] = get_unaligned_le64(data + i * sizeof(__le64));
1079 +
1080 + /* save */
1081 + a = aa = tctx->a;
1082 +diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
1083 +index f233ce60a678..1610fff19bb3 100644
1084 +--- a/drivers/ata/libahci.c
1085 ++++ b/drivers/ata/libahci.c
1086 +@@ -190,7 +190,6 @@ struct ata_port_operations ahci_pmp_retry_srst_ops = {
1087 + EXPORT_SYMBOL_GPL(ahci_pmp_retry_srst_ops);
1088 +
1089 + static bool ahci_em_messages __read_mostly = true;
1090 +-EXPORT_SYMBOL_GPL(ahci_em_messages);
1091 + module_param(ahci_em_messages, bool, 0444);
1092 + /* add other LED protocol types when they become supported */
1093 + MODULE_PARM_DESC(ahci_em_messages,
1094 +diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
1095 +index 85aaf2222587..82296fe2ba3b 100644
1096 +--- a/drivers/atm/firestream.c
1097 ++++ b/drivers/atm/firestream.c
1098 +@@ -927,6 +927,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
1099 + }
1100 + if (!to) {
1101 + printk ("No more free channels for FS50..\n");
1102 ++ kfree(vcc);
1103 + return -EBUSY;
1104 + }
1105 + vcc->channo = dev->channo;
1106 +@@ -937,6 +938,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
1107 + if (((DO_DIRECTION(rxtp) && dev->atm_vccs[vcc->channo])) ||
1108 + ( DO_DIRECTION(txtp) && test_bit (vcc->channo, dev->tx_inuse))) {
1109 + printk ("Channel is in use for FS155.\n");
1110 ++ kfree(vcc);
1111 + return -EBUSY;
1112 + }
1113 + }
1114 +@@ -950,6 +952,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
1115 + tc, sizeof (struct fs_transmit_config));
1116 + if (!tc) {
1117 + fs_dprintk (FS_DEBUG_OPEN, "fs: can't alloc transmit_config.\n");
1118 ++ kfree(vcc);
1119 + return -ENOMEM;
1120 + }
1121 +
1122 +diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
1123 +index f499a469e66d..12b2cc9a3fbe 100644
1124 +--- a/drivers/bcma/driver_pci.c
1125 ++++ b/drivers/bcma/driver_pci.c
1126 +@@ -78,7 +78,7 @@ static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u16 device, u8 address)
1127 + v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD);
1128 + }
1129 +
1130 +- v = BCMA_CORE_PCI_MDIODATA_START;
1131 ++ v |= BCMA_CORE_PCI_MDIODATA_START;
1132 + v |= BCMA_CORE_PCI_MDIODATA_READ;
1133 + v |= BCMA_CORE_PCI_MDIODATA_TA;
1134 +
1135 +@@ -121,7 +121,7 @@ static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u16 device,
1136 + v |= (address << BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD);
1137 + }
1138 +
1139 +- v = BCMA_CORE_PCI_MDIODATA_START;
1140 ++ v |= BCMA_CORE_PCI_MDIODATA_START;
1141 + v |= BCMA_CORE_PCI_MDIODATA_WRITE;
1142 + v |= BCMA_CORE_PCI_MDIODATA_TA;
1143 + v |= data;
1144 +diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
1145 +index f5c24459fc5c..daa9cef96ec6 100644
1146 +--- a/drivers/block/drbd/drbd_main.c
1147 ++++ b/drivers/block/drbd/drbd_main.c
1148 +@@ -332,6 +332,8 @@ static int drbd_thread_setup(void *arg)
1149 + thi->name[0],
1150 + resource->name);
1151 +
1152 ++ allow_kernel_signal(DRBD_SIGKILL);
1153 ++ allow_kernel_signal(SIGXCPU);
1154 + restart:
1155 + retval = thi->function(thi);
1156 +
1157 +diff --git a/drivers/clk/clk-highbank.c b/drivers/clk/clk-highbank.c
1158 +index 727ed8e1bb72..8e4581004695 100644
1159 +--- a/drivers/clk/clk-highbank.c
1160 ++++ b/drivers/clk/clk-highbank.c
1161 +@@ -293,6 +293,7 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk
1162 + /* Map system registers */
1163 + srnp = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
1164 + hb_clk->reg = of_iomap(srnp, 0);
1165 ++ of_node_put(srnp);
1166 + BUG_ON(!hb_clk->reg);
1167 + hb_clk->reg += reg;
1168 +
1169 +diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
1170 +index cdce49f6476a..65876ff6df41 100644
1171 +--- a/drivers/clk/clk-qoriq.c
1172 ++++ b/drivers/clk/clk-qoriq.c
1173 +@@ -1245,6 +1245,7 @@ static void __init clockgen_init(struct device_node *np)
1174 + pr_err("%s: Couldn't map %s regs\n", __func__,
1175 + guts->full_name);
1176 + }
1177 ++ of_node_put(guts);
1178 + }
1179 +
1180 + }
1181 +diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c
1182 +index 14682df5d312..d83f6221f1b0 100644
1183 +--- a/drivers/clk/imx/clk-imx6q.c
1184 ++++ b/drivers/clk/imx/clk-imx6q.c
1185 +@@ -174,6 +174,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
1186 + np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop");
1187 + base = of_iomap(np, 0);
1188 + WARN_ON(!base);
1189 ++ of_node_put(np);
1190 +
1191 + /* Audio/video PLL post dividers do not work on i.MX6q revision 1.0 */
1192 + if (clk_on_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_1_0) {
1193 +diff --git a/drivers/clk/imx/clk-imx6sx.c b/drivers/clk/imx/clk-imx6sx.c
1194 +index b5c96de41ccf..8bbc2542f2f7 100644
1195 +--- a/drivers/clk/imx/clk-imx6sx.c
1196 ++++ b/drivers/clk/imx/clk-imx6sx.c
1197 +@@ -164,6 +164,7 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
1198 + np = of_find_compatible_node(NULL, NULL, "fsl,imx6sx-anatop");
1199 + base = of_iomap(np, 0);
1200 + WARN_ON(!base);
1201 ++ of_node_put(np);
1202 +
1203 + clks[IMX6SX_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
1204 + clks[IMX6SX_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
1205 +diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c
1206 +index e7c7353a86fc..8c0c0d015132 100644
1207 +--- a/drivers/clk/imx/clk-imx7d.c
1208 ++++ b/drivers/clk/imx/clk-imx7d.c
1209 +@@ -415,6 +415,7 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node)
1210 + np = of_find_compatible_node(NULL, NULL, "fsl,imx7d-anatop");
1211 + base = of_iomap(np, 0);
1212 + WARN_ON(!base);
1213 ++ of_node_put(np);
1214 +
1215 + clks[IMX7D_PLL_ARM_MAIN_SRC] = imx_clk_mux("pll_arm_main_src", base + 0x60, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel));
1216 + clks[IMX7D_PLL_DRAM_MAIN_SRC] = imx_clk_mux("pll_dram_main_src", base + 0x70, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel));
1217 +diff --git a/drivers/clk/imx/clk-vf610.c b/drivers/clk/imx/clk-vf610.c
1218 +index 0476353ab423..a19ab032d073 100644
1219 +--- a/drivers/clk/imx/clk-vf610.c
1220 ++++ b/drivers/clk/imx/clk-vf610.c
1221 +@@ -203,6 +203,7 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
1222 + np = of_find_compatible_node(NULL, NULL, "fsl,vf610-anatop");
1223 + anatop_base = of_iomap(np, 0);
1224 + BUG_ON(!anatop_base);
1225 ++ of_node_put(np);
1226 +
1227 + np = ccm_node;
1228 + ccm_base = of_iomap(np, 0);
1229 +diff --git a/drivers/clk/mvebu/armada-370.c b/drivers/clk/mvebu/armada-370.c
1230 +index 2c7c1085f883..8fdfa97900cd 100644
1231 +--- a/drivers/clk/mvebu/armada-370.c
1232 ++++ b/drivers/clk/mvebu/armada-370.c
1233 +@@ -177,8 +177,10 @@ static void __init a370_clk_init(struct device_node *np)
1234 +
1235 + mvebu_coreclk_setup(np, &a370_coreclks);
1236 +
1237 +- if (cgnp)
1238 ++ if (cgnp) {
1239 + mvebu_clk_gating_setup(cgnp, a370_gating_desc);
1240 ++ of_node_put(cgnp);
1241 ++ }
1242 + }
1243 + CLK_OF_DECLARE(a370_clk, "marvell,armada-370-core-clock", a370_clk_init);
1244 +
1245 +diff --git a/drivers/clk/mvebu/armada-xp.c b/drivers/clk/mvebu/armada-xp.c
1246 +index b3094315a3c0..2fa15a274719 100644
1247 +--- a/drivers/clk/mvebu/armada-xp.c
1248 ++++ b/drivers/clk/mvebu/armada-xp.c
1249 +@@ -202,7 +202,9 @@ static void __init axp_clk_init(struct device_node *np)
1250 +
1251 + mvebu_coreclk_setup(np, &axp_coreclks);
1252 +
1253 +- if (cgnp)
1254 ++ if (cgnp) {
1255 + mvebu_clk_gating_setup(cgnp, axp_gating_desc);
1256 ++ of_node_put(cgnp);
1257 ++ }
1258 + }
1259 + CLK_OF_DECLARE(axp_clk, "marvell,armada-xp-core-clock", axp_clk_init);
1260 +diff --git a/drivers/clk/mvebu/dove.c b/drivers/clk/mvebu/dove.c
1261 +index 59fad9546c84..5f258c9bb68b 100644
1262 +--- a/drivers/clk/mvebu/dove.c
1263 ++++ b/drivers/clk/mvebu/dove.c
1264 +@@ -190,10 +190,14 @@ static void __init dove_clk_init(struct device_node *np)
1265 +
1266 + mvebu_coreclk_setup(np, &dove_coreclks);
1267 +
1268 +- if (ddnp)
1269 ++ if (ddnp) {
1270 + dove_divider_clk_init(ddnp);
1271 ++ of_node_put(ddnp);
1272 ++ }
1273 +
1274 +- if (cgnp)
1275 ++ if (cgnp) {
1276 + mvebu_clk_gating_setup(cgnp, dove_gating_desc);
1277 ++ of_node_put(cgnp);
1278 ++ }
1279 + }
1280 + CLK_OF_DECLARE(dove_clk, "marvell,dove-core-clock", dove_clk_init);
1281 +diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c
1282 +index a2a8d614039d..890ebf623261 100644
1283 +--- a/drivers/clk/mvebu/kirkwood.c
1284 ++++ b/drivers/clk/mvebu/kirkwood.c
1285 +@@ -333,6 +333,8 @@ static void __init kirkwood_clk_init(struct device_node *np)
1286 + if (cgnp) {
1287 + mvebu_clk_gating_setup(cgnp, kirkwood_gating_desc);
1288 + kirkwood_clk_muxing_setup(cgnp, kirkwood_mux_desc);
1289 ++
1290 ++ of_node_put(cgnp);
1291 + }
1292 + }
1293 + CLK_OF_DECLARE(kirkwood_clk, "marvell,kirkwood-core-clock",
1294 +diff --git a/drivers/clk/qcom/gcc-msm8996.c b/drivers/clk/qcom/gcc-msm8996.c
1295 +index fe03e6fbc7df..ea6c227331fc 100644
1296 +--- a/drivers/clk/qcom/gcc-msm8996.c
1297 ++++ b/drivers/clk/qcom/gcc-msm8996.c
1298 +@@ -140,22 +140,6 @@ static const char * const gcc_xo_gpll0_gpll4_gpll0_early_div[] = {
1299 + "gpll0_early_div"
1300 + };
1301 +
1302 +-static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div_map[] = {
1303 +- { P_XO, 0 },
1304 +- { P_GPLL0, 1 },
1305 +- { P_GPLL2, 2 },
1306 +- { P_GPLL3, 3 },
1307 +- { P_GPLL0_EARLY_DIV, 6 }
1308 +-};
1309 +-
1310 +-static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div[] = {
1311 +- "xo",
1312 +- "gpll0",
1313 +- "gpll2",
1314 +- "gpll3",
1315 +- "gpll0_early_div"
1316 +-};
1317 +-
1318 + static const struct parent_map gcc_xo_gpll0_gpll1_early_div_gpll1_gpll4_gpll0_early_div_map[] = {
1319 + { P_XO, 0 },
1320 + { P_GPLL0, 1 },
1321 +@@ -194,26 +178,6 @@ static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll2_early_gpll0_early
1322 + "gpll0_early_div"
1323 + };
1324 +
1325 +-static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div_map[] = {
1326 +- { P_XO, 0 },
1327 +- { P_GPLL0, 1 },
1328 +- { P_GPLL2, 2 },
1329 +- { P_GPLL3, 3 },
1330 +- { P_GPLL1, 4 },
1331 +- { P_GPLL4, 5 },
1332 +- { P_GPLL0_EARLY_DIV, 6 }
1333 +-};
1334 +-
1335 +-static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div[] = {
1336 +- "xo",
1337 +- "gpll0",
1338 +- "gpll2",
1339 +- "gpll3",
1340 +- "gpll1",
1341 +- "gpll4",
1342 +- "gpll0_early_div"
1343 +-};
1344 +-
1345 + static struct clk_fixed_factor xo = {
1346 + .mult = 1,
1347 + .div = 1,
1348 +diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c
1349 +index faab9b31baf5..91f9b79e3941 100644
1350 +--- a/drivers/clk/samsung/clk-exynos4.c
1351 ++++ b/drivers/clk/samsung/clk-exynos4.c
1352 +@@ -1225,6 +1225,7 @@ static unsigned long __init exynos4_get_xom(void)
1353 + xom = readl(chipid_base + 8);
1354 +
1355 + iounmap(chipid_base);
1356 ++ of_node_put(np);
1357 + }
1358 +
1359 + return xom;
1360 +diff --git a/drivers/clk/socfpga/clk-pll-a10.c b/drivers/clk/socfpga/clk-pll-a10.c
1361 +index 35fabe1a32c3..269467e8e07e 100644
1362 +--- a/drivers/clk/socfpga/clk-pll-a10.c
1363 ++++ b/drivers/clk/socfpga/clk-pll-a10.c
1364 +@@ -95,6 +95,7 @@ static struct clk * __init __socfpga_pll_init(struct device_node *node,
1365 +
1366 + clkmgr_np = of_find_compatible_node(NULL, NULL, "altr,clk-mgr");
1367 + clk_mgr_a10_base_addr = of_iomap(clkmgr_np, 0);
1368 ++ of_node_put(clkmgr_np);
1369 + BUG_ON(!clk_mgr_a10_base_addr);
1370 + pll_clk->hw.reg = clk_mgr_a10_base_addr + reg;
1371 +
1372 +diff --git a/drivers/clk/socfpga/clk-pll.c b/drivers/clk/socfpga/clk-pll.c
1373 +index c7f463172e4b..b4b44e9b5901 100644
1374 +--- a/drivers/clk/socfpga/clk-pll.c
1375 ++++ b/drivers/clk/socfpga/clk-pll.c
1376 +@@ -100,6 +100,7 @@ static __init struct clk *__socfpga_pll_init(struct device_node *node,
1377 +
1378 + clkmgr_np = of_find_compatible_node(NULL, NULL, "altr,clk-mgr");
1379 + clk_mgr_base_addr = of_iomap(clkmgr_np, 0);
1380 ++ of_node_put(clkmgr_np);
1381 + BUG_ON(!clk_mgr_base_addr);
1382 + pll_clk->hw.reg = clk_mgr_base_addr + reg;
1383 +
1384 +diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a23.c b/drivers/clk/sunxi-ng/ccu-sun8i-a23.c
1385 +index 5c6d37bdf247..765c6977484e 100644
1386 +--- a/drivers/clk/sunxi-ng/ccu-sun8i-a23.c
1387 ++++ b/drivers/clk/sunxi-ng/ccu-sun8i-a23.c
1388 +@@ -132,7 +132,7 @@ static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_mipi_clk, "pll-mipi",
1389 + 8, 4, /* N */
1390 + 4, 2, /* K */
1391 + 0, 4, /* M */
1392 +- BIT(31), /* gate */
1393 ++ BIT(31) | BIT(23) | BIT(22), /* gate */
1394 + BIT(28), /* lock */
1395 + CLK_SET_RATE_UNGATE);
1396 +
1397 +diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
1398 +index d32248e2ceab..ae3cbaeffd9c 100644
1399 +--- a/drivers/clocksource/exynos_mct.c
1400 ++++ b/drivers/clocksource/exynos_mct.c
1401 +@@ -563,7 +563,19 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem *
1402 + return 0;
1403 +
1404 + out_irq:
1405 +- free_percpu_irq(mct_irqs[MCT_L0_IRQ], &percpu_mct_tick);
1406 ++ if (mct_int_type == MCT_INT_PPI) {
1407 ++ free_percpu_irq(mct_irqs[MCT_L0_IRQ], &percpu_mct_tick);
1408 ++ } else {
1409 ++ for_each_possible_cpu(cpu) {
1410 ++ struct mct_clock_event_device *pcpu_mevt =
1411 ++ per_cpu_ptr(&percpu_mct_tick, cpu);
1412 ++
1413 ++ if (pcpu_mevt->evt.irq != -1) {
1414 ++ free_irq(pcpu_mevt->evt.irq, pcpu_mevt);
1415 ++ pcpu_mevt->evt.irq = -1;
1416 ++ }
1417 ++ }
1418 ++ }
1419 + return err;
1420 + }
1421 +
1422 +diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c
1423 +index 4f87f3e76d83..c3e96de525a2 100644
1424 +--- a/drivers/clocksource/timer-sun5i.c
1425 ++++ b/drivers/clocksource/timer-sun5i.c
1426 +@@ -201,6 +201,11 @@ static int __init sun5i_setup_clocksource(struct device_node *node,
1427 + }
1428 +
1429 + rate = clk_get_rate(clk);
1430 ++ if (!rate) {
1431 ++ pr_err("Couldn't get parent clock rate\n");
1432 ++ ret = -EINVAL;
1433 ++ goto err_disable_clk;
1434 ++ }
1435 +
1436 + cs->timer.base = base;
1437 + cs->timer.clk = clk;
1438 +@@ -274,6 +279,11 @@ static int __init sun5i_setup_clockevent(struct device_node *node, void __iomem
1439 + }
1440 +
1441 + rate = clk_get_rate(clk);
1442 ++ if (!rate) {
1443 ++ pr_err("Couldn't get parent clock rate\n");
1444 ++ ret = -EINVAL;
1445 ++ goto err_disable_clk;
1446 ++ }
1447 +
1448 + ce->timer.base = base;
1449 + ce->timer.ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
1450 +diff --git a/drivers/crypto/amcc/crypto4xx_trng.h b/drivers/crypto/amcc/crypto4xx_trng.h
1451 +index 931d22531f51..7bbda51b7337 100644
1452 +--- a/drivers/crypto/amcc/crypto4xx_trng.h
1453 ++++ b/drivers/crypto/amcc/crypto4xx_trng.h
1454 +@@ -26,9 +26,9 @@ void ppc4xx_trng_probe(struct crypto4xx_core_device *core_dev);
1455 + void ppc4xx_trng_remove(struct crypto4xx_core_device *core_dev);
1456 + #else
1457 + static inline void ppc4xx_trng_probe(
1458 +- struct crypto4xx_device *dev __maybe_unused) { }
1459 ++ struct crypto4xx_core_device *dev __maybe_unused) { }
1460 + static inline void ppc4xx_trng_remove(
1461 +- struct crypto4xx_device *dev __maybe_unused) { }
1462 ++ struct crypto4xx_core_device *dev __maybe_unused) { }
1463 + #endif
1464 +
1465 + #endif
1466 +diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
1467 +index 9b92af2c7241..a77319bf221d 100644
1468 +--- a/drivers/crypto/caam/caamrng.c
1469 ++++ b/drivers/crypto/caam/caamrng.c
1470 +@@ -361,7 +361,10 @@ static int __init caam_rng_init(void)
1471 + goto free_rng_ctx;
1472 +
1473 + dev_info(dev, "registering rng-caam\n");
1474 +- return hwrng_register(&caam_rng);
1475 ++
1476 ++ err = hwrng_register(&caam_rng);
1477 ++ if (!err)
1478 ++ return err;
1479 +
1480 + free_rng_ctx:
1481 + kfree(rng_ctx);
1482 +diff --git a/drivers/crypto/ccp/ccp-crypto-aes.c b/drivers/crypto/ccp/ccp-crypto-aes.c
1483 +index 89291c15015c..3f768699332b 100644
1484 +--- a/drivers/crypto/ccp/ccp-crypto-aes.c
1485 ++++ b/drivers/crypto/ccp/ccp-crypto-aes.c
1486 +@@ -1,7 +1,8 @@
1487 ++// SPDX-License-Identifier: GPL-2.0
1488 + /*
1489 + * AMD Cryptographic Coprocessor (CCP) AES crypto API support
1490 + *
1491 +- * Copyright (C) 2013,2016 Advanced Micro Devices, Inc.
1492 ++ * Copyright (C) 2013-2019 Advanced Micro Devices, Inc.
1493 + *
1494 + * Author: Tom Lendacky <thomas.lendacky@×××.com>
1495 + *
1496 +@@ -79,8 +80,7 @@ static int ccp_aes_crypt(struct ablkcipher_request *req, bool encrypt)
1497 + return -EINVAL;
1498 +
1499 + if (((ctx->u.aes.mode == CCP_AES_MODE_ECB) ||
1500 +- (ctx->u.aes.mode == CCP_AES_MODE_CBC) ||
1501 +- (ctx->u.aes.mode == CCP_AES_MODE_CFB)) &&
1502 ++ (ctx->u.aes.mode == CCP_AES_MODE_CBC)) &&
1503 + (req->nbytes & (AES_BLOCK_SIZE - 1)))
1504 + return -EINVAL;
1505 +
1506 +@@ -291,7 +291,7 @@ static struct ccp_aes_def aes_algs[] = {
1507 + .version = CCP_VERSION(3, 0),
1508 + .name = "cfb(aes)",
1509 + .driver_name = "cfb-aes-ccp",
1510 +- .blocksize = AES_BLOCK_SIZE,
1511 ++ .blocksize = 1,
1512 + .ivsize = AES_BLOCK_SIZE,
1513 + .alg_defaults = &ccp_aes_defaults,
1514 + },
1515 +diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
1516 +index 7f0b9aa15867..9887f2a14aa9 100644
1517 +--- a/drivers/dma/dma-axi-dmac.c
1518 ++++ b/drivers/dma/dma-axi-dmac.c
1519 +@@ -451,7 +451,7 @@ static struct dma_async_tx_descriptor *axi_dmac_prep_interleaved(
1520 +
1521 + if (chan->hw_2d) {
1522 + if (!axi_dmac_check_len(chan, xt->sgl[0].size) ||
1523 +- !axi_dmac_check_len(chan, xt->numf))
1524 ++ xt->numf == 0)
1525 + return NULL;
1526 + if (xt->sgl[0].size + dst_icg > chan->max_length ||
1527 + xt->sgl[0].size + src_icg > chan->max_length)
1528 +diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
1529 +index 5bda0eb9f393..7536fe80bc33 100644
1530 +--- a/drivers/dma/dw/platform.c
1531 ++++ b/drivers/dma/dw/platform.c
1532 +@@ -87,13 +87,20 @@ static void dw_dma_acpi_controller_register(struct dw_dma *dw)
1533 + dma_cap_set(DMA_SLAVE, info->dma_cap);
1534 + info->filter_fn = dw_dma_acpi_filter;
1535 +
1536 +- ret = devm_acpi_dma_controller_register(dev, acpi_dma_simple_xlate,
1537 +- info);
1538 ++ ret = acpi_dma_controller_register(dev, acpi_dma_simple_xlate, info);
1539 + if (ret)
1540 + dev_err(dev, "could not register acpi_dma_controller\n");
1541 + }
1542 ++
1543 ++static void dw_dma_acpi_controller_free(struct dw_dma *dw)
1544 ++{
1545 ++ struct device *dev = dw->dma.dev;
1546 ++
1547 ++ acpi_dma_controller_free(dev);
1548 ++}
1549 + #else /* !CONFIG_ACPI */
1550 + static inline void dw_dma_acpi_controller_register(struct dw_dma *dw) {}
1551 ++static inline void dw_dma_acpi_controller_free(struct dw_dma *dw) {}
1552 + #endif /* !CONFIG_ACPI */
1553 +
1554 + #ifdef CONFIG_OF
1555 +@@ -226,6 +233,9 @@ static int dw_remove(struct platform_device *pdev)
1556 + {
1557 + struct dw_dma_chip *chip = platform_get_drvdata(pdev);
1558 +
1559 ++ if (ACPI_HANDLE(&pdev->dev))
1560 ++ dw_dma_acpi_controller_free(chip->dw);
1561 ++
1562 + if (pdev->dev.of_node)
1563 + of_dma_controller_free(pdev->dev.of_node);
1564 +
1565 +diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
1566 +index 72f31e837b1d..56ec72468745 100644
1567 +--- a/drivers/dma/edma.c
1568 ++++ b/drivers/dma/edma.c
1569 +@@ -2340,8 +2340,10 @@ static int edma_probe(struct platform_device *pdev)
1570 +
1571 + ecc->tc_list = devm_kcalloc(dev, ecc->num_tc,
1572 + sizeof(*ecc->tc_list), GFP_KERNEL);
1573 +- if (!ecc->tc_list)
1574 +- return -ENOMEM;
1575 ++ if (!ecc->tc_list) {
1576 ++ ret = -ENOMEM;
1577 ++ goto err_reg1;
1578 ++ }
1579 +
1580 + for (i = 0;; i++) {
1581 + ret = of_parse_phandle_with_fixed_args(node, "ti,tptcs",
1582 +diff --git a/drivers/dma/hsu/hsu.c b/drivers/dma/hsu/hsu.c
1583 +index 29d04ca71d52..15525a2b8ebd 100644
1584 +--- a/drivers/dma/hsu/hsu.c
1585 ++++ b/drivers/dma/hsu/hsu.c
1586 +@@ -64,10 +64,10 @@ static void hsu_dma_chan_start(struct hsu_dma_chan *hsuc)
1587 +
1588 + if (hsuc->direction == DMA_MEM_TO_DEV) {
1589 + bsr = config->dst_maxburst;
1590 +- mtsr = config->src_addr_width;
1591 ++ mtsr = config->dst_addr_width;
1592 + } else if (hsuc->direction == DMA_DEV_TO_MEM) {
1593 + bsr = config->src_maxburst;
1594 +- mtsr = config->dst_addr_width;
1595 ++ mtsr = config->src_addr_width;
1596 + }
1597 +
1598 + hsu_chan_disable(hsuc);
1599 +diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
1600 +index 9f240b2d85a5..558d509b7d85 100644
1601 +--- a/drivers/dma/imx-sdma.c
1602 ++++ b/drivers/dma/imx-sdma.c
1603 +@@ -1441,6 +1441,14 @@ static void sdma_add_scripts(struct sdma_engine *sdma,
1604 + if (!sdma->script_number)
1605 + sdma->script_number = SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1;
1606 +
1607 ++ if (sdma->script_number > sizeof(struct sdma_script_start_addrs)
1608 ++ / sizeof(s32)) {
1609 ++ dev_err(sdma->dev,
1610 ++ "SDMA script number %d not match with firmware.\n",
1611 ++ sdma->script_number);
1612 ++ return;
1613 ++ }
1614 ++
1615 + for (i = 0; i < sdma->script_number; i++)
1616 + if (addr_arr[i] > 0)
1617 + saddr_arr[i] = addr_arr[i];
1618 +diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
1619 +index 23f75285a4d9..5d524f29c5f1 100644
1620 +--- a/drivers/dma/mv_xor.c
1621 ++++ b/drivers/dma/mv_xor.c
1622 +@@ -1044,6 +1044,7 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
1623 + mv_chan->op_in_desc = XOR_MODE_IN_DESC;
1624 +
1625 + dma_dev = &mv_chan->dmadev;
1626 ++ dma_dev->dev = &pdev->dev;
1627 + mv_chan->xordev = xordev;
1628 +
1629 + /*
1630 +@@ -1076,7 +1077,6 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
1631 + dma_dev->device_free_chan_resources = mv_xor_free_chan_resources;
1632 + dma_dev->device_tx_status = mv_xor_status;
1633 + dma_dev->device_issue_pending = mv_xor_issue_pending;
1634 +- dma_dev->dev = &pdev->dev;
1635 +
1636 + /* set prep routines based on capability */
1637 + if (dma_has_cap(DMA_INTERRUPT, dma_dev->cap_mask))
1638 +diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
1639 +index e9e46a520745..2d4aeba579f7 100644
1640 +--- a/drivers/dma/tegra210-adma.c
1641 ++++ b/drivers/dma/tegra210-adma.c
1642 +@@ -98,6 +98,7 @@ struct tegra_adma_chan_regs {
1643 + unsigned int src_addr;
1644 + unsigned int trg_addr;
1645 + unsigned int fifo_ctrl;
1646 ++ unsigned int cmd;
1647 + unsigned int tc;
1648 + };
1649 +
1650 +@@ -127,6 +128,7 @@ struct tegra_adma_chan {
1651 + enum dma_transfer_direction sreq_dir;
1652 + unsigned int sreq_index;
1653 + bool sreq_reserved;
1654 ++ struct tegra_adma_chan_regs ch_regs;
1655 +
1656 + /* Transfer count and position info */
1657 + unsigned int tx_buf_count;
1658 +@@ -635,8 +637,30 @@ static struct dma_chan *tegra_dma_of_xlate(struct of_phandle_args *dma_spec,
1659 + static int tegra_adma_runtime_suspend(struct device *dev)
1660 + {
1661 + struct tegra_adma *tdma = dev_get_drvdata(dev);
1662 ++ struct tegra_adma_chan_regs *ch_reg;
1663 ++ struct tegra_adma_chan *tdc;
1664 ++ int i;
1665 +
1666 + tdma->global_cmd = tdma_read(tdma, ADMA_GLOBAL_CMD);
1667 ++ if (!tdma->global_cmd)
1668 ++ goto clk_disable;
1669 ++
1670 ++ for (i = 0; i < tdma->nr_channels; i++) {
1671 ++ tdc = &tdma->channels[i];
1672 ++ ch_reg = &tdc->ch_regs;
1673 ++ ch_reg->cmd = tdma_ch_read(tdc, ADMA_CH_CMD);
1674 ++ /* skip if channel is not active */
1675 ++ if (!ch_reg->cmd)
1676 ++ continue;
1677 ++ ch_reg->tc = tdma_ch_read(tdc, ADMA_CH_TC);
1678 ++ ch_reg->src_addr = tdma_ch_read(tdc, ADMA_CH_LOWER_SRC_ADDR);
1679 ++ ch_reg->trg_addr = tdma_ch_read(tdc, ADMA_CH_LOWER_TRG_ADDR);
1680 ++ ch_reg->ctrl = tdma_ch_read(tdc, ADMA_CH_CTRL);
1681 ++ ch_reg->fifo_ctrl = tdma_ch_read(tdc, ADMA_CH_FIFO_CTRL);
1682 ++ ch_reg->config = tdma_ch_read(tdc, ADMA_CH_CONFIG);
1683 ++ }
1684 ++
1685 ++clk_disable:
1686 + clk_disable_unprepare(tdma->ahub_clk);
1687 +
1688 + return 0;
1689 +@@ -645,7 +669,9 @@ static int tegra_adma_runtime_suspend(struct device *dev)
1690 + static int tegra_adma_runtime_resume(struct device *dev)
1691 + {
1692 + struct tegra_adma *tdma = dev_get_drvdata(dev);
1693 +- int ret;
1694 ++ struct tegra_adma_chan_regs *ch_reg;
1695 ++ struct tegra_adma_chan *tdc;
1696 ++ int ret, i;
1697 +
1698 + ret = clk_prepare_enable(tdma->ahub_clk);
1699 + if (ret) {
1700 +@@ -654,6 +680,24 @@ static int tegra_adma_runtime_resume(struct device *dev)
1701 + }
1702 + tdma_write(tdma, ADMA_GLOBAL_CMD, tdma->global_cmd);
1703 +
1704 ++ if (!tdma->global_cmd)
1705 ++ return 0;
1706 ++
1707 ++ for (i = 0; i < tdma->nr_channels; i++) {
1708 ++ tdc = &tdma->channels[i];
1709 ++ ch_reg = &tdc->ch_regs;
1710 ++ /* skip if channel was not active earlier */
1711 ++ if (!ch_reg->cmd)
1712 ++ continue;
1713 ++ tdma_ch_write(tdc, ADMA_CH_TC, ch_reg->tc);
1714 ++ tdma_ch_write(tdc, ADMA_CH_LOWER_SRC_ADDR, ch_reg->src_addr);
1715 ++ tdma_ch_write(tdc, ADMA_CH_LOWER_TRG_ADDR, ch_reg->trg_addr);
1716 ++ tdma_ch_write(tdc, ADMA_CH_CTRL, ch_reg->ctrl);
1717 ++ tdma_ch_write(tdc, ADMA_CH_FIFO_CTRL, ch_reg->fifo_ctrl);
1718 ++ tdma_ch_write(tdc, ADMA_CH_CONFIG, ch_reg->config);
1719 ++ tdma_ch_write(tdc, ADMA_CH_CMD, ch_reg->cmd);
1720 ++ }
1721 ++
1722 + return 0;
1723 + }
1724 +
1725 +@@ -700,16 +744,6 @@ static int tegra_adma_probe(struct platform_device *pdev)
1726 + return PTR_ERR(tdma->ahub_clk);
1727 + }
1728 +
1729 +- pm_runtime_enable(&pdev->dev);
1730 +-
1731 +- ret = pm_runtime_get_sync(&pdev->dev);
1732 +- if (ret < 0)
1733 +- goto rpm_disable;
1734 +-
1735 +- ret = tegra_adma_init(tdma);
1736 +- if (ret)
1737 +- goto rpm_put;
1738 +-
1739 + INIT_LIST_HEAD(&tdma->dma_dev.channels);
1740 + for (i = 0; i < tdma->nr_channels; i++) {
1741 + struct tegra_adma_chan *tdc = &tdma->channels[i];
1742 +@@ -727,6 +761,16 @@ static int tegra_adma_probe(struct platform_device *pdev)
1743 + tdc->tdma = tdma;
1744 + }
1745 +
1746 ++ pm_runtime_enable(&pdev->dev);
1747 ++
1748 ++ ret = pm_runtime_get_sync(&pdev->dev);
1749 ++ if (ret < 0)
1750 ++ goto rpm_disable;
1751 ++
1752 ++ ret = tegra_adma_init(tdma);
1753 ++ if (ret)
1754 ++ goto rpm_put;
1755 ++
1756 + dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask);
1757 + dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask);
1758 + dma_cap_set(DMA_CYCLIC, tdma->dma_dev.cap_mask);
1759 +@@ -768,13 +812,13 @@ static int tegra_adma_probe(struct platform_device *pdev)
1760 +
1761 + dma_remove:
1762 + dma_async_device_unregister(&tdma->dma_dev);
1763 +-irq_dispose:
1764 +- while (--i >= 0)
1765 +- irq_dispose_mapping(tdma->channels[i].irq);
1766 + rpm_put:
1767 + pm_runtime_put_sync(&pdev->dev);
1768 + rpm_disable:
1769 + pm_runtime_disable(&pdev->dev);
1770 ++irq_dispose:
1771 ++ while (--i >= 0)
1772 ++ irq_dispose_mapping(tdma->channels[i].irq);
1773 +
1774 + return ret;
1775 + }
1776 +diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
1777 +index e05dda92398c..17aedaaf364c 100644
1778 +--- a/drivers/gpu/drm/drm_dp_mst_topology.c
1779 ++++ b/drivers/gpu/drm/drm_dp_mst_topology.c
1780 +@@ -980,9 +980,20 @@ static struct drm_dp_mst_port *drm_dp_mst_get_port_ref_locked(struct drm_dp_mst_
1781 + static struct drm_dp_mst_port *drm_dp_get_validated_port_ref(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port)
1782 + {
1783 + struct drm_dp_mst_port *rport = NULL;
1784 ++
1785 + mutex_lock(&mgr->lock);
1786 +- if (mgr->mst_primary)
1787 +- rport = drm_dp_mst_get_port_ref_locked(mgr->mst_primary, port);
1788 ++ /*
1789 ++ * Port may or may not be 'valid' but we don't care about that when
1790 ++ * destroying the port and we are guaranteed that the port pointer
1791 ++ * will be valid until we've finished
1792 ++ */
1793 ++ if (current_work() == &mgr->destroy_connector_work) {
1794 ++ kref_get(&port->kref);
1795 ++ rport = port;
1796 ++ } else if (mgr->mst_primary) {
1797 ++ rport = drm_dp_mst_get_port_ref_locked(mgr->mst_primary,
1798 ++ port);
1799 ++ }
1800 + mutex_unlock(&mgr->lock);
1801 + return rport;
1802 + }
1803 +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
1804 +index 2bef501d4a17..5af7c2594a79 100644
1805 +--- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c
1806 ++++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
1807 +@@ -206,7 +206,7 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
1808 + mutex_lock(&obj->lock);
1809 + pages = etnaviv_gem_get_pages(obj);
1810 + mutex_unlock(&obj->lock);
1811 +- if (pages) {
1812 ++ if (!IS_ERR(pages)) {
1813 + int j;
1814 +
1815 + iter.hdr->data[0] = bomap - bomap_start;
1816 +diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
1817 +index fd266ed963b6..25a0e7d13340 100644
1818 +--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
1819 ++++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
1820 +@@ -383,19 +383,17 @@ static const unsigned int a3xx_registers[] = {
1821 + 0x2200, 0x2212, 0x2214, 0x2217, 0x221a, 0x221a, 0x2240, 0x227e,
1822 + 0x2280, 0x228b, 0x22c0, 0x22c0, 0x22c4, 0x22ce, 0x22d0, 0x22d8,
1823 + 0x22df, 0x22e6, 0x22e8, 0x22e9, 0x22ec, 0x22ec, 0x22f0, 0x22f7,
1824 +- 0x22ff, 0x22ff, 0x2340, 0x2343, 0x2348, 0x2349, 0x2350, 0x2356,
1825 +- 0x2360, 0x2360, 0x2440, 0x2440, 0x2444, 0x2444, 0x2448, 0x244d,
1826 +- 0x2468, 0x2469, 0x246c, 0x246d, 0x2470, 0x2470, 0x2472, 0x2472,
1827 +- 0x2474, 0x2475, 0x2479, 0x247a, 0x24c0, 0x24d3, 0x24e4, 0x24ef,
1828 +- 0x2500, 0x2509, 0x250c, 0x250c, 0x250e, 0x250e, 0x2510, 0x2511,
1829 +- 0x2514, 0x2515, 0x25e4, 0x25e4, 0x25ea, 0x25ea, 0x25ec, 0x25ed,
1830 +- 0x25f0, 0x25f0, 0x2600, 0x2612, 0x2614, 0x2617, 0x261a, 0x261a,
1831 +- 0x2640, 0x267e, 0x2680, 0x268b, 0x26c0, 0x26c0, 0x26c4, 0x26ce,
1832 +- 0x26d0, 0x26d8, 0x26df, 0x26e6, 0x26e8, 0x26e9, 0x26ec, 0x26ec,
1833 +- 0x26f0, 0x26f7, 0x26ff, 0x26ff, 0x2740, 0x2743, 0x2748, 0x2749,
1834 +- 0x2750, 0x2756, 0x2760, 0x2760, 0x300c, 0x300e, 0x301c, 0x301d,
1835 +- 0x302a, 0x302a, 0x302c, 0x302d, 0x3030, 0x3031, 0x3034, 0x3036,
1836 +- 0x303c, 0x303c, 0x305e, 0x305f,
1837 ++ 0x22ff, 0x22ff, 0x2340, 0x2343, 0x2440, 0x2440, 0x2444, 0x2444,
1838 ++ 0x2448, 0x244d, 0x2468, 0x2469, 0x246c, 0x246d, 0x2470, 0x2470,
1839 ++ 0x2472, 0x2472, 0x2474, 0x2475, 0x2479, 0x247a, 0x24c0, 0x24d3,
1840 ++ 0x24e4, 0x24ef, 0x2500, 0x2509, 0x250c, 0x250c, 0x250e, 0x250e,
1841 ++ 0x2510, 0x2511, 0x2514, 0x2515, 0x25e4, 0x25e4, 0x25ea, 0x25ea,
1842 ++ 0x25ec, 0x25ed, 0x25f0, 0x25f0, 0x2600, 0x2612, 0x2614, 0x2617,
1843 ++ 0x261a, 0x261a, 0x2640, 0x267e, 0x2680, 0x268b, 0x26c0, 0x26c0,
1844 ++ 0x26c4, 0x26ce, 0x26d0, 0x26d8, 0x26df, 0x26e6, 0x26e8, 0x26e9,
1845 ++ 0x26ec, 0x26ec, 0x26f0, 0x26f7, 0x26ff, 0x26ff, 0x2740, 0x2743,
1846 ++ 0x300c, 0x300e, 0x301c, 0x301d, 0x302a, 0x302a, 0x302c, 0x302d,
1847 ++ 0x3030, 0x3031, 0x3034, 0x3036, 0x303c, 0x303c, 0x305e, 0x305f,
1848 + ~0 /* sentinel */
1849 + };
1850 +
1851 +diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
1852 +index 6f240021705b..e49b414c012c 100644
1853 +--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
1854 ++++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
1855 +@@ -33,6 +33,8 @@
1856 + #include "sfpb.xml.h"
1857 + #include "dsi_cfg.h"
1858 +
1859 ++#define DSI_RESET_TOGGLE_DELAY_MS 20
1860 ++
1861 + static int dsi_get_version(const void __iomem *base, u32 *major, u32 *minor)
1862 + {
1863 + u32 ver;
1864 +@@ -909,7 +911,7 @@ static void dsi_sw_reset(struct msm_dsi_host *msm_host)
1865 + wmb(); /* clocks need to be enabled before reset */
1866 +
1867 + dsi_write(msm_host, REG_DSI_RESET, 1);
1868 +- wmb(); /* make sure reset happen */
1869 ++ msleep(DSI_RESET_TOGGLE_DELAY_MS); /* make sure reset happen */
1870 + dsi_write(msm_host, REG_DSI_RESET, 0);
1871 + }
1872 +
1873 +@@ -1288,7 +1290,7 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host)
1874 +
1875 + /* dsi controller can only be reset while clocks are running */
1876 + dsi_write(msm_host, REG_DSI_RESET, 1);
1877 +- wmb(); /* make sure reset happen */
1878 ++ msleep(DSI_RESET_TOGGLE_DELAY_MS); /* make sure reset happen */
1879 + dsi_write(msm_host, REG_DSI_RESET, 0);
1880 + wmb(); /* controller out of reset */
1881 + dsi_write(msm_host, REG_DSI_CTRL, data0);
1882 +diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
1883 +index 8b4e3004f451..86b0448d2ce5 100644
1884 +--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
1885 ++++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
1886 +@@ -542,7 +542,7 @@ fail:
1887 + if (cfg_handler)
1888 + mdp5_cfg_destroy(cfg_handler);
1889 +
1890 +- return NULL;
1891 ++ return ERR_PTR(ret);
1892 + }
1893 +
1894 + static struct mdp5_cfg_platform *mdp5_get_config(struct platform_device *dev)
1895 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr3.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr3.c
1896 +index 60ece0a8a2e1..1d2d6bae73cd 100644
1897 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr3.c
1898 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr3.c
1899 +@@ -87,7 +87,7 @@ nvkm_gddr3_calc(struct nvkm_ram *ram)
1900 + WR = (ram->next->bios.timing[2] & 0x007f0000) >> 16;
1901 + /* XXX: Get these values from the VBIOS instead */
1902 + DLL = !(ram->mr[1] & 0x1);
1903 +- RON = !(ram->mr[1] & 0x300) >> 8;
1904 ++ RON = !((ram->mr[1] & 0x300) >> 8);
1905 + break;
1906 + default:
1907 + return -ENOSYS;
1908 +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
1909 +index e6f74168238c..2ef9e942f43a 100644
1910 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
1911 ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
1912 +@@ -87,10 +87,10 @@ nvkm_memx_fini(struct nvkm_memx **pmemx, bool exec)
1913 + if (exec) {
1914 + nvkm_pmu_send(pmu, reply, PROC_MEMX, MEMX_MSG_EXEC,
1915 + memx->base, finish);
1916 ++ nvkm_debug(subdev, "Exec took %uns, PMU_IN %08x\n",
1917 ++ reply[0], reply[1]);
1918 + }
1919 +
1920 +- nvkm_debug(subdev, "Exec took %uns, PMU_IN %08x\n",
1921 +- reply[0], reply[1]);
1922 + kfree(memx);
1923 + return 0;
1924 + }
1925 +diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
1926 +index b99f3e59011c..5fcb5869a489 100644
1927 +--- a/drivers/gpu/drm/radeon/cik.c
1928 ++++ b/drivers/gpu/drm/radeon/cik.c
1929 +@@ -7026,8 +7026,8 @@ static int cik_irq_init(struct radeon_device *rdev)
1930 + }
1931 +
1932 + /* setup interrupt control */
1933 +- /* XXX this should actually be a bus address, not an MC address. same on older asics */
1934 +- WREG32(INTERRUPT_CNTL2, rdev->ih.gpu_addr >> 8);
1935 ++ /* set dummy read address to dummy page address */
1936 ++ WREG32(INTERRUPT_CNTL2, rdev->dummy_page.addr >> 8);
1937 + interrupt_cntl = RREG32(INTERRUPT_CNTL);
1938 + /* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi
1939 + * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN
1940 +diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
1941 +index f2eac6b6c46a..9569c35f8766 100644
1942 +--- a/drivers/gpu/drm/radeon/r600.c
1943 ++++ b/drivers/gpu/drm/radeon/r600.c
1944 +@@ -3697,8 +3697,8 @@ int r600_irq_init(struct radeon_device *rdev)
1945 + }
1946 +
1947 + /* setup interrupt control */
1948 +- /* set dummy read address to ring address */
1949 +- WREG32(INTERRUPT_CNTL2, rdev->ih.gpu_addr >> 8);
1950 ++ /* set dummy read address to dummy page address */
1951 ++ WREG32(INTERRUPT_CNTL2, rdev->dummy_page.addr >> 8);
1952 + interrupt_cntl = RREG32(INTERRUPT_CNTL);
1953 + /* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi
1954 + * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN
1955 +diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
1956 +index b75d809c292e..919d389869ce 100644
1957 +--- a/drivers/gpu/drm/radeon/si.c
1958 ++++ b/drivers/gpu/drm/radeon/si.c
1959 +@@ -6018,8 +6018,8 @@ static int si_irq_init(struct radeon_device *rdev)
1960 + }
1961 +
1962 + /* setup interrupt control */
1963 +- /* set dummy read address to ring address */
1964 +- WREG32(INTERRUPT_CNTL2, rdev->ih.gpu_addr >> 8);
1965 ++ /* set dummy read address to dummy page address */
1966 ++ WREG32(INTERRUPT_CNTL2, rdev->dummy_page.addr >> 8);
1967 + interrupt_cntl = RREG32(INTERRUPT_CNTL);
1968 + /* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi
1969 + * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN
1970 +diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
1971 +index e7c243f70870..08808e3701de 100644
1972 +--- a/drivers/gpu/drm/sti/sti_hda.c
1973 ++++ b/drivers/gpu/drm/sti/sti_hda.c
1974 +@@ -740,7 +740,6 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data)
1975 + return 0;
1976 +
1977 + err_sysfs:
1978 +- drm_bridge_remove(bridge);
1979 + return -EINVAL;
1980 + }
1981 +
1982 +diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
1983 +index 376b0763c874..a5412a6fbeca 100644
1984 +--- a/drivers/gpu/drm/sti/sti_hdmi.c
1985 ++++ b/drivers/gpu/drm/sti/sti_hdmi.c
1986 +@@ -1352,7 +1352,6 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
1987 + return 0;
1988 +
1989 + err_sysfs:
1990 +- drm_bridge_remove(bridge);
1991 + hdmi->drm_connector = NULL;
1992 + return -EINVAL;
1993 + }
1994 +diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
1995 +index a1b3ea1ccb65..772a5a3b0ce1 100644
1996 +--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
1997 ++++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
1998 +@@ -681,11 +681,11 @@ int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev,
1999 + {
2000 + struct virtio_gpu_get_capset *cmd_p;
2001 + struct virtio_gpu_vbuffer *vbuf;
2002 +- int max_size = vgdev->capsets[idx].max_size;
2003 ++ int max_size;
2004 + struct virtio_gpu_drv_cap_cache *cache_ent;
2005 + void *resp_buf;
2006 +
2007 +- if (idx > vgdev->num_capsets)
2008 ++ if (idx >= vgdev->num_capsets)
2009 + return -EINVAL;
2010 +
2011 + if (version > vgdev->capsets[idx].max_version)
2012 +@@ -695,6 +695,7 @@ int virtio_gpu_cmd_get_capset(struct virtio_gpu_device *vgdev,
2013 + if (!cache_ent)
2014 + return -ENOMEM;
2015 +
2016 ++ max_size = vgdev->capsets[idx].max_size;
2017 + cache_ent->caps_cache = kmalloc(max_size, GFP_KERNEL);
2018 + if (!cache_ent->caps_cache) {
2019 + kfree(cache_ent);
2020 +diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
2021 +index 9c262d955331..d2583caa8087 100644
2022 +--- a/drivers/hwmon/adt7475.c
2023 ++++ b/drivers/hwmon/adt7475.c
2024 +@@ -268,9 +268,10 @@ static inline u16 volt2reg(int channel, long volt, u8 bypass_attn)
2025 + long reg;
2026 +
2027 + if (bypass_attn & (1 << channel))
2028 +- reg = (volt * 1024) / 2250;
2029 ++ reg = DIV_ROUND_CLOSEST(volt * 1024, 2250);
2030 + else
2031 +- reg = (volt * r[1] * 1024) / ((r[0] + r[1]) * 2250);
2032 ++ reg = DIV_ROUND_CLOSEST(volt * r[1] * 1024,
2033 ++ (r[0] + r[1]) * 2250);
2034 + return clamp_val(reg, 0, 1023) & (0xff << 2);
2035 + }
2036 +
2037 +diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
2038 +index a74c075a30ec..e0a1a118514f 100644
2039 +--- a/drivers/hwmon/hwmon.c
2040 ++++ b/drivers/hwmon/hwmon.c
2041 +@@ -38,16 +38,20 @@ struct hwmon_device {
2042 +
2043 + #define to_hwmon_device(d) container_of(d, struct hwmon_device, dev)
2044 +
2045 ++#define MAX_SYSFS_ATTR_NAME_LENGTH 32
2046 ++
2047 + struct hwmon_device_attribute {
2048 + struct device_attribute dev_attr;
2049 + const struct hwmon_ops *ops;
2050 + enum hwmon_sensor_types type;
2051 + u32 attr;
2052 + int index;
2053 ++ char name[MAX_SYSFS_ATTR_NAME_LENGTH];
2054 + };
2055 +
2056 + #define to_hwmon_attr(d) \
2057 + container_of(d, struct hwmon_device_attribute, dev_attr)
2058 ++#define to_dev_attr(a) container_of(a, struct device_attribute, attr)
2059 +
2060 + /*
2061 + * Thermal zone information
2062 +@@ -55,7 +59,7 @@ struct hwmon_device_attribute {
2063 + * also provides the sensor index.
2064 + */
2065 + struct hwmon_thermal_data {
2066 +- struct hwmon_device *hwdev; /* Reference to hwmon device */
2067 ++ struct device *dev; /* Reference to hwmon device */
2068 + int index; /* sensor index */
2069 + };
2070 +
2071 +@@ -92,9 +96,27 @@ static const struct attribute_group *hwmon_dev_attr_groups[] = {
2072 + NULL
2073 + };
2074 +
2075 ++static void hwmon_free_attrs(struct attribute **attrs)
2076 ++{
2077 ++ int i;
2078 ++
2079 ++ for (i = 0; attrs[i]; i++) {
2080 ++ struct device_attribute *dattr = to_dev_attr(attrs[i]);
2081 ++ struct hwmon_device_attribute *hattr = to_hwmon_attr(dattr);
2082 ++
2083 ++ kfree(hattr);
2084 ++ }
2085 ++ kfree(attrs);
2086 ++}
2087 ++
2088 + static void hwmon_dev_release(struct device *dev)
2089 + {
2090 +- kfree(to_hwmon_device(dev));
2091 ++ struct hwmon_device *hwdev = to_hwmon_device(dev);
2092 ++
2093 ++ if (hwdev->group.attrs)
2094 ++ hwmon_free_attrs(hwdev->group.attrs);
2095 ++ kfree(hwdev->groups);
2096 ++ kfree(hwdev);
2097 + }
2098 +
2099 + static struct class hwmon_class = {
2100 +@@ -118,11 +140,11 @@ static DEFINE_IDA(hwmon_ida);
2101 + static int hwmon_thermal_get_temp(void *data, int *temp)
2102 + {
2103 + struct hwmon_thermal_data *tdata = data;
2104 +- struct hwmon_device *hwdev = tdata->hwdev;
2105 ++ struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
2106 + int ret;
2107 + long t;
2108 +
2109 +- ret = hwdev->chip->ops->read(&hwdev->dev, hwmon_temp, hwmon_temp_input,
2110 ++ ret = hwdev->chip->ops->read(tdata->dev, hwmon_temp, hwmon_temp_input,
2111 + tdata->index, &t);
2112 + if (ret < 0)
2113 + return ret;
2114 +@@ -136,26 +158,31 @@ static struct thermal_zone_of_device_ops hwmon_thermal_ops = {
2115 + .get_temp = hwmon_thermal_get_temp,
2116 + };
2117 +
2118 +-static int hwmon_thermal_add_sensor(struct device *dev,
2119 +- struct hwmon_device *hwdev, int index)
2120 ++static int hwmon_thermal_add_sensor(struct device *dev, int index)
2121 + {
2122 + struct hwmon_thermal_data *tdata;
2123 ++ struct thermal_zone_device *tzd;
2124 +
2125 + tdata = devm_kzalloc(dev, sizeof(*tdata), GFP_KERNEL);
2126 + if (!tdata)
2127 + return -ENOMEM;
2128 +
2129 +- tdata->hwdev = hwdev;
2130 ++ tdata->dev = dev;
2131 + tdata->index = index;
2132 +
2133 +- devm_thermal_zone_of_sensor_register(&hwdev->dev, index, tdata,
2134 +- &hwmon_thermal_ops);
2135 ++ tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata,
2136 ++ &hwmon_thermal_ops);
2137 ++ /*
2138 ++ * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV,
2139 ++ * so ignore that error but forward any other error.
2140 ++ */
2141 ++ if (IS_ERR(tzd) && (PTR_ERR(tzd) != -ENODEV))
2142 ++ return PTR_ERR(tzd);
2143 +
2144 + return 0;
2145 + }
2146 + #else
2147 +-static int hwmon_thermal_add_sensor(struct device *dev,
2148 +- struct hwmon_device *hwdev, int index)
2149 ++static int hwmon_thermal_add_sensor(struct device *dev, int index)
2150 + {
2151 + return 0;
2152 + }
2153 +@@ -205,8 +232,7 @@ static int hwmon_attr_base(enum hwmon_sensor_types type)
2154 + return 1;
2155 + }
2156 +
2157 +-static struct attribute *hwmon_genattr(struct device *dev,
2158 +- const void *drvdata,
2159 ++static struct attribute *hwmon_genattr(const void *drvdata,
2160 + enum hwmon_sensor_types type,
2161 + u32 attr,
2162 + int index,
2163 +@@ -232,20 +258,18 @@ static struct attribute *hwmon_genattr(struct device *dev,
2164 + if ((mode & S_IWUGO) && !ops->write)
2165 + return ERR_PTR(-EINVAL);
2166 +
2167 ++ hattr = kzalloc(sizeof(*hattr), GFP_KERNEL);
2168 ++ if (!hattr)
2169 ++ return ERR_PTR(-ENOMEM);
2170 ++
2171 + if (type == hwmon_chip) {
2172 + name = (char *)template;
2173 + } else {
2174 +- name = devm_kzalloc(dev, strlen(template) + 16, GFP_KERNEL);
2175 +- if (!name)
2176 +- return ERR_PTR(-ENOMEM);
2177 +- scnprintf(name, strlen(template) + 16, template,
2178 ++ scnprintf(hattr->name, sizeof(hattr->name), template,
2179 + index + hwmon_attr_base(type));
2180 ++ name = hattr->name;
2181 + }
2182 +
2183 +- hattr = devm_kzalloc(dev, sizeof(*hattr), GFP_KERNEL);
2184 +- if (!hattr)
2185 +- return ERR_PTR(-ENOMEM);
2186 +-
2187 + hattr->type = type;
2188 + hattr->attr = attr;
2189 + hattr->index = index;
2190 +@@ -433,8 +457,7 @@ static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
2191 + return n;
2192 + }
2193 +
2194 +-static int hwmon_genattrs(struct device *dev,
2195 +- const void *drvdata,
2196 ++static int hwmon_genattrs(const void *drvdata,
2197 + struct attribute **attrs,
2198 + const struct hwmon_ops *ops,
2199 + const struct hwmon_channel_info *info)
2200 +@@ -460,7 +483,7 @@ static int hwmon_genattrs(struct device *dev,
2201 + attr_mask &= ~BIT(attr);
2202 + if (attr >= template_size)
2203 + return -EINVAL;
2204 +- a = hwmon_genattr(dev, drvdata, info->type, attr, i,
2205 ++ a = hwmon_genattr(drvdata, info->type, attr, i,
2206 + templates[attr], ops);
2207 + if (IS_ERR(a)) {
2208 + if (PTR_ERR(a) != -ENOENT)
2209 +@@ -474,8 +497,7 @@ static int hwmon_genattrs(struct device *dev,
2210 + }
2211 +
2212 + static struct attribute **
2213 +-__hwmon_create_attrs(struct device *dev, const void *drvdata,
2214 +- const struct hwmon_chip_info *chip)
2215 ++__hwmon_create_attrs(const void *drvdata, const struct hwmon_chip_info *chip)
2216 + {
2217 + int ret, i, aindex = 0, nattrs = 0;
2218 + struct attribute **attrs;
2219 +@@ -486,15 +508,17 @@ __hwmon_create_attrs(struct device *dev, const void *drvdata,
2220 + if (nattrs == 0)
2221 + return ERR_PTR(-EINVAL);
2222 +
2223 +- attrs = devm_kcalloc(dev, nattrs + 1, sizeof(*attrs), GFP_KERNEL);
2224 ++ attrs = kcalloc(nattrs + 1, sizeof(*attrs), GFP_KERNEL);
2225 + if (!attrs)
2226 + return ERR_PTR(-ENOMEM);
2227 +
2228 + for (i = 0; chip->info[i]; i++) {
2229 +- ret = hwmon_genattrs(dev, drvdata, &attrs[aindex], chip->ops,
2230 ++ ret = hwmon_genattrs(drvdata, &attrs[aindex], chip->ops,
2231 + chip->info[i]);
2232 +- if (ret < 0)
2233 ++ if (ret < 0) {
2234 ++ hwmon_free_attrs(attrs);
2235 + return ERR_PTR(ret);
2236 ++ }
2237 + aindex += ret;
2238 + }
2239 +
2240 +@@ -534,14 +558,13 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
2241 + for (i = 0; groups[i]; i++)
2242 + ngroups++;
2243 +
2244 +- hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups),
2245 +- GFP_KERNEL);
2246 ++ hwdev->groups = kcalloc(ngroups, sizeof(*groups), GFP_KERNEL);
2247 + if (!hwdev->groups) {
2248 + err = -ENOMEM;
2249 + goto free_hwmon;
2250 + }
2251 +
2252 +- attrs = __hwmon_create_attrs(dev, drvdata, chip);
2253 ++ attrs = __hwmon_create_attrs(drvdata, chip);
2254 + if (IS_ERR(attrs)) {
2255 + err = PTR_ERR(attrs);
2256 + goto free_hwmon;
2257 +@@ -585,8 +608,13 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
2258 + if (!chip->ops->is_visible(drvdata, hwmon_temp,
2259 + hwmon_temp_input, j))
2260 + continue;
2261 +- if (info[i]->config[j] & HWMON_T_INPUT)
2262 +- hwmon_thermal_add_sensor(dev, hwdev, j);
2263 ++ if (info[i]->config[j] & HWMON_T_INPUT) {
2264 ++ err = hwmon_thermal_add_sensor(hdev, j);
2265 ++ if (err) {
2266 ++ device_unregister(hdev);
2267 ++ goto ida_remove;
2268 ++ }
2269 ++ }
2270 + }
2271 + }
2272 + }
2273 +@@ -594,7 +622,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
2274 + return hdev;
2275 +
2276 + free_hwmon:
2277 +- kfree(hwdev);
2278 ++ hwmon_dev_release(hdev);
2279 + ida_remove:
2280 + ida_simple_remove(&hwmon_ida, id);
2281 + return ERR_PTR(err);
2282 +diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
2283 +index eff3b24d8473..fc31669a86ba 100644
2284 +--- a/drivers/hwmon/lm75.c
2285 ++++ b/drivers/hwmon/lm75.c
2286 +@@ -164,7 +164,7 @@ static int lm75_write(struct device *dev, enum hwmon_sensor_types type,
2287 + temp = DIV_ROUND_CLOSEST(temp << (resolution - 8),
2288 + 1000) << (16 - resolution);
2289 +
2290 +- return regmap_write(data->regmap, reg, temp);
2291 ++ return regmap_write(data->regmap, reg, (u16)temp);
2292 + }
2293 +
2294 + static umode_t lm75_is_visible(const void *data, enum hwmon_sensor_types type,
2295 +diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c
2296 +index 7f8738a83cb9..40addb213bdf 100644
2297 +--- a/drivers/hwmon/nct7802.c
2298 ++++ b/drivers/hwmon/nct7802.c
2299 +@@ -32,8 +32,8 @@
2300 + static const u8 REG_VOLTAGE[5] = { 0x09, 0x0a, 0x0c, 0x0d, 0x0e };
2301 +
2302 + static const u8 REG_VOLTAGE_LIMIT_LSB[2][5] = {
2303 +- { 0x40, 0x00, 0x42, 0x44, 0x46 },
2304 +- { 0x3f, 0x00, 0x41, 0x43, 0x45 },
2305 ++ { 0x46, 0x00, 0x40, 0x42, 0x44 },
2306 ++ { 0x45, 0x00, 0x3f, 0x41, 0x43 },
2307 + };
2308 +
2309 + static const u8 REG_VOLTAGE_LIMIT_MSB[5] = { 0x48, 0x00, 0x47, 0x47, 0x48 };
2310 +diff --git a/drivers/hwmon/shtc1.c b/drivers/hwmon/shtc1.c
2311 +index decd7df995ab..2a18539591ea 100644
2312 +--- a/drivers/hwmon/shtc1.c
2313 ++++ b/drivers/hwmon/shtc1.c
2314 +@@ -38,7 +38,7 @@ static const unsigned char shtc1_cmd_read_id_reg[] = { 0xef, 0xc8 };
2315 +
2316 + /* constants for reading the ID register */
2317 + #define SHTC1_ID 0x07
2318 +-#define SHTC1_ID_REG_MASK 0x1f
2319 ++#define SHTC1_ID_REG_MASK 0x3f
2320 +
2321 + /* delays for non-blocking i2c commands, both in us */
2322 + #define SHTC1_NONBLOCKING_WAIT_TIME_HPM 14400
2323 +diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
2324 +index 721295b9a051..43c0f89cefdf 100644
2325 +--- a/drivers/hwmon/w83627hf.c
2326 ++++ b/drivers/hwmon/w83627hf.c
2327 +@@ -130,17 +130,23 @@ superio_select(struct w83627hf_sio_data *sio, int ld)
2328 + outb(ld, sio->sioaddr + 1);
2329 + }
2330 +
2331 +-static inline void
2332 ++static inline int
2333 + superio_enter(struct w83627hf_sio_data *sio)
2334 + {
2335 ++ if (!request_muxed_region(sio->sioaddr, 2, DRVNAME))
2336 ++ return -EBUSY;
2337 ++
2338 + outb(0x87, sio->sioaddr);
2339 + outb(0x87, sio->sioaddr);
2340 ++
2341 ++ return 0;
2342 + }
2343 +
2344 + static inline void
2345 + superio_exit(struct w83627hf_sio_data *sio)
2346 + {
2347 + outb(0xAA, sio->sioaddr);
2348 ++ release_region(sio->sioaddr, 2);
2349 + }
2350 +
2351 + #define W627_DEVID 0x52
2352 +@@ -1275,7 +1281,7 @@ static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
2353 + static int __init w83627hf_find(int sioaddr, unsigned short *addr,
2354 + struct w83627hf_sio_data *sio_data)
2355 + {
2356 +- int err = -ENODEV;
2357 ++ int err;
2358 + u16 val;
2359 +
2360 + static __initconst char *const names[] = {
2361 +@@ -1287,7 +1293,11 @@ static int __init w83627hf_find(int sioaddr, unsigned short *addr,
2362 + };
2363 +
2364 + sio_data->sioaddr = sioaddr;
2365 +- superio_enter(sio_data);
2366 ++ err = superio_enter(sio_data);
2367 ++ if (err)
2368 ++ return err;
2369 ++
2370 ++ err = -ENODEV;
2371 + val = force_id ? force_id : superio_inb(sio_data, DEVID);
2372 + switch (val) {
2373 + case W627_DEVID:
2374 +@@ -1641,9 +1651,21 @@ static int w83627thf_read_gpio5(struct platform_device *pdev)
2375 + struct w83627hf_sio_data *sio_data = dev_get_platdata(&pdev->dev);
2376 + int res = 0xff, sel;
2377 +
2378 +- superio_enter(sio_data);
2379 ++ if (superio_enter(sio_data)) {
2380 ++ /*
2381 ++ * Some other driver reserved the address space for itself.
2382 ++ * We don't want to fail driver instantiation because of that,
2383 ++ * so display a warning and keep going.
2384 ++ */
2385 ++ dev_warn(&pdev->dev,
2386 ++ "Can not read VID data: Failed to enable SuperIO access\n");
2387 ++ return res;
2388 ++ }
2389 ++
2390 + superio_select(sio_data, W83627HF_LD_GPIO5);
2391 +
2392 ++ res = 0xff;
2393 ++
2394 + /* Make sure these GPIO pins are enabled */
2395 + if (!(superio_inb(sio_data, W83627THF_GPIO5_EN) & (1<<3))) {
2396 + dev_dbg(&pdev->dev, "GPIO5 disabled, no VID function\n");
2397 +@@ -1674,7 +1696,17 @@ static int w83687thf_read_vid(struct platform_device *pdev)
2398 + struct w83627hf_sio_data *sio_data = dev_get_platdata(&pdev->dev);
2399 + int res = 0xff;
2400 +
2401 +- superio_enter(sio_data);
2402 ++ if (superio_enter(sio_data)) {
2403 ++ /*
2404 ++ * Some other driver reserved the address space for itself.
2405 ++ * We don't want to fail driver instantiation because of that,
2406 ++ * so display a warning and keep going.
2407 ++ */
2408 ++ dev_warn(&pdev->dev,
2409 ++ "Can not read VID data: Failed to enable SuperIO access\n");
2410 ++ return res;
2411 ++ }
2412 ++
2413 + superio_select(sio_data, W83627HF_LD_HWM);
2414 +
2415 + /* Make sure these GPIO pins are enabled */
2416 +diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
2417 +index ace55385b26f..ff10deed3fde 100644
2418 +--- a/drivers/hwtracing/coresight/coresight-etb10.c
2419 ++++ b/drivers/hwtracing/coresight/coresight-etb10.c
2420 +@@ -279,9 +279,7 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu,
2421 + int node;
2422 + struct cs_buffers *buf;
2423 +
2424 +- if (cpu == -1)
2425 +- cpu = smp_processor_id();
2426 +- node = cpu_to_node(cpu);
2427 ++ node = (cpu == -1) ? NUMA_NO_NODE : cpu_to_node(cpu);
2428 +
2429 + buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node);
2430 + if (!buf)
2431 +diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
2432 +index 14df4e34c21c..03ce12ad4317 100644
2433 +--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
2434 ++++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
2435 +@@ -292,9 +292,7 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu,
2436 + int node;
2437 + struct cs_buffers *buf;
2438 +
2439 +- if (cpu == -1)
2440 +- cpu = smp_processor_id();
2441 +- node = cpu_to_node(cpu);
2442 ++ node = (cpu == -1) ? NUMA_NO_NODE : cpu_to_node(cpu);
2443 +
2444 + /* Allocate memory structure for interaction with Perf */
2445 + buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node);
2446 +diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c
2447 +index 97d2c5111f43..8bf7fc626a9d 100644
2448 +--- a/drivers/iio/dac/ad5380.c
2449 ++++ b/drivers/iio/dac/ad5380.c
2450 +@@ -221,7 +221,7 @@ static int ad5380_read_raw(struct iio_dev *indio_dev,
2451 + if (ret)
2452 + return ret;
2453 + *val >>= chan->scan_type.shift;
2454 +- val -= (1 << chan->scan_type.realbits) / 2;
2455 ++ *val -= (1 << chan->scan_type.realbits) / 2;
2456 + return IIO_VAL_INT;
2457 + case IIO_CHAN_INFO_SCALE:
2458 + *val = 2 * st->vref;
2459 +diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
2460 +index 605d50ad123c..a04a53acb24f 100644
2461 +--- a/drivers/infiniband/hw/cxgb4/cm.c
2462 ++++ b/drivers/infiniband/hw/cxgb4/cm.c
2463 +@@ -2044,7 +2044,7 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip,
2464 + } else {
2465 + pdev = get_real_dev(n->dev);
2466 + ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t,
2467 +- n, pdev, 0);
2468 ++ n, pdev, rt_tos2priority(tos));
2469 + if (!ep->l2t)
2470 + goto out;
2471 + ep->mtu = dst_mtu(dst);
2472 +@@ -2135,7 +2135,8 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
2473 + laddr6->sin6_addr.s6_addr,
2474 + raddr6->sin6_addr.s6_addr,
2475 + laddr6->sin6_port,
2476 +- raddr6->sin6_port, 0,
2477 ++ raddr6->sin6_port,
2478 ++ ep->com.cm_id->tos,
2479 + raddr6->sin6_scope_id);
2480 + iptype = 6;
2481 + ra = (__u8 *)&raddr6->sin6_addr;
2482 +@@ -3278,7 +3279,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2483 + laddr6->sin6_addr.s6_addr,
2484 + raddr6->sin6_addr.s6_addr,
2485 + laddr6->sin6_port,
2486 +- raddr6->sin6_port, 0,
2487 ++ raddr6->sin6_port, cm_id->tos,
2488 + raddr6->sin6_scope_id);
2489 + }
2490 + if (!ep->dst) {
2491 +diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
2492 +index 33cf1035030b..6f3c0ea99dd0 100644
2493 +--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
2494 ++++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
2495 +@@ -241,7 +241,6 @@ void hns_roce_qp_free(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp)
2496 +
2497 + if ((hr_qp->ibqp.qp_type) != IB_QPT_GSI) {
2498 + hns_roce_table_put(hr_dev, &qp_table->irrl_table, hr_qp->qpn);
2499 +- hns_roce_table_put(hr_dev, &qp_table->qp_table, hr_qp->qpn);
2500 + }
2501 + }
2502 +
2503 +diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
2504 +index a7bc89f5dae7..4d906a790481 100644
2505 +--- a/drivers/infiniband/hw/mlx5/qp.c
2506 ++++ b/drivers/infiniband/hw/mlx5/qp.c
2507 +@@ -2324,6 +2324,11 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q
2508 + [MLX5_QP_ST_UD] = MLX5_QP_OPTPAR_PKEY_INDEX |
2509 + MLX5_QP_OPTPAR_Q_KEY |
2510 + MLX5_QP_OPTPAR_PRI_PORT,
2511 ++ [MLX5_QP_ST_XRC] = MLX5_QP_OPTPAR_RRE |
2512 ++ MLX5_QP_OPTPAR_RAE |
2513 ++ MLX5_QP_OPTPAR_RWE |
2514 ++ MLX5_QP_OPTPAR_PKEY_INDEX |
2515 ++ MLX5_QP_OPTPAR_PRI_PORT,
2516 + },
2517 + [MLX5_QP_STATE_RTR] = {
2518 + [MLX5_QP_ST_RC] = MLX5_QP_OPTPAR_ALT_ADDR_PATH |
2519 +@@ -2357,6 +2362,12 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q
2520 + MLX5_QP_OPTPAR_RWE |
2521 + MLX5_QP_OPTPAR_PM_STATE,
2522 + [MLX5_QP_ST_UD] = MLX5_QP_OPTPAR_Q_KEY,
2523 ++ [MLX5_QP_ST_XRC] = MLX5_QP_OPTPAR_ALT_ADDR_PATH |
2524 ++ MLX5_QP_OPTPAR_RRE |
2525 ++ MLX5_QP_OPTPAR_RAE |
2526 ++ MLX5_QP_OPTPAR_RWE |
2527 ++ MLX5_QP_OPTPAR_PM_STATE |
2528 ++ MLX5_QP_OPTPAR_RNR_TIMEOUT,
2529 + },
2530 + },
2531 + [MLX5_QP_STATE_RTS] = {
2532 +@@ -2373,6 +2384,12 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q
2533 + [MLX5_QP_ST_UD] = MLX5_QP_OPTPAR_Q_KEY |
2534 + MLX5_QP_OPTPAR_SRQN |
2535 + MLX5_QP_OPTPAR_CQN_RCV,
2536 ++ [MLX5_QP_ST_XRC] = MLX5_QP_OPTPAR_RRE |
2537 ++ MLX5_QP_OPTPAR_RAE |
2538 ++ MLX5_QP_OPTPAR_RWE |
2539 ++ MLX5_QP_OPTPAR_RNR_TIMEOUT |
2540 ++ MLX5_QP_OPTPAR_PM_STATE |
2541 ++ MLX5_QP_OPTPAR_ALT_ADDR_PATH,
2542 + },
2543 + },
2544 + [MLX5_QP_STATE_SQER] = {
2545 +@@ -2384,6 +2401,10 @@ static enum mlx5_qp_optpar opt_mask[MLX5_QP_NUM_STATE][MLX5_QP_NUM_STATE][MLX5_Q
2546 + MLX5_QP_OPTPAR_RWE |
2547 + MLX5_QP_OPTPAR_RAE |
2548 + MLX5_QP_OPTPAR_RRE,
2549 ++ [MLX5_QP_ST_XRC] = MLX5_QP_OPTPAR_RNR_TIMEOUT |
2550 ++ MLX5_QP_OPTPAR_RWE |
2551 ++ MLX5_QP_OPTPAR_RAE |
2552 ++ MLX5_QP_OPTPAR_RRE,
2553 + },
2554 + },
2555 + };
2556 +diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
2557 +index 6af44f8db3d5..4d28bd8eff01 100644
2558 +--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
2559 ++++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
2560 +@@ -55,7 +55,7 @@
2561 +
2562 + int ocrdma_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
2563 + {
2564 +- if (index > 1)
2565 ++ if (index > 0)
2566 + return -EINVAL;
2567 +
2568 + *pkey = 0xffff;
2569 +diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
2570 +index cd0408c2b376..7603a1641c7d 100644
2571 +--- a/drivers/infiniband/hw/qedr/verbs.c
2572 ++++ b/drivers/infiniband/hw/qedr/verbs.c
2573 +@@ -54,7 +54,7 @@
2574 +
2575 + int qedr_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
2576 + {
2577 +- if (index > QEDR_ROCE_PKEY_TABLE_LEN)
2578 ++ if (index >= QEDR_ROCE_PKEY_TABLE_LEN)
2579 + return -EINVAL;
2580 +
2581 + *pkey = QEDR_ROCE_PKEY_DEFAULT;
2582 +diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
2583 +index a5bfbba6bbac..cacb720f44a0 100644
2584 +--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
2585 ++++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
2586 +@@ -425,7 +425,7 @@ int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
2587 + int usnic_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index,
2588 + u16 *pkey)
2589 + {
2590 +- if (index > 1)
2591 ++ if (index > 0)
2592 + return -EINVAL;
2593 +
2594 + *pkey = 0xffff;
2595 +diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c
2596 +index e5e6a5e7dee9..5ac88412f1ff 100644
2597 +--- a/drivers/infiniband/sw/rxe/rxe_cq.c
2598 ++++ b/drivers/infiniband/sw/rxe/rxe_cq.c
2599 +@@ -30,7 +30,7 @@
2600 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2601 + * SOFTWARE.
2602 + */
2603 +-
2604 ++#include <linux/vmalloc.h>
2605 + #include "rxe.h"
2606 + #include "rxe_loc.h"
2607 + #include "rxe_queue.h"
2608 +@@ -89,7 +89,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
2609 + err = do_mmap_info(rxe, udata, false, context, cq->queue->buf,
2610 + cq->queue->buf_size, &cq->queue->ip);
2611 + if (err) {
2612 +- kvfree(cq->queue->buf);
2613 ++ vfree(cq->queue->buf);
2614 + kfree(cq->queue);
2615 + return err;
2616 + }
2617 +diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
2618 +index 44b2108253bd..d6672127808b 100644
2619 +--- a/drivers/infiniband/sw/rxe/rxe_qp.c
2620 ++++ b/drivers/infiniband/sw/rxe/rxe_qp.c
2621 +@@ -34,6 +34,7 @@
2622 + #include <linux/skbuff.h>
2623 + #include <linux/delay.h>
2624 + #include <linux/sched.h>
2625 ++#include <linux/vmalloc.h>
2626 +
2627 + #include "rxe.h"
2628 + #include "rxe_loc.h"
2629 +@@ -255,7 +256,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp,
2630 + qp->sq.queue->buf_size, &qp->sq.queue->ip);
2631 +
2632 + if (err) {
2633 +- kvfree(qp->sq.queue->buf);
2634 ++ vfree(qp->sq.queue->buf);
2635 + kfree(qp->sq.queue);
2636 + return err;
2637 + }
2638 +@@ -312,7 +313,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp,
2639 + qp->rq.queue->buf_size,
2640 + &qp->rq.queue->ip);
2641 + if (err) {
2642 +- kvfree(qp->rq.queue->buf);
2643 ++ vfree(qp->rq.queue->buf);
2644 + kfree(qp->rq.queue);
2645 + return err;
2646 + }
2647 +diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
2648 +index cb48e22afff7..a3614f7f0007 100644
2649 +--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
2650 ++++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
2651 +@@ -197,7 +197,7 @@ struct iser_data_buf {
2652 + struct scatterlist *sg;
2653 + int size;
2654 + unsigned long data_len;
2655 +- unsigned int dma_nents;
2656 ++ int dma_nents;
2657 + };
2658 +
2659 + /* fwd declarations */
2660 +diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
2661 +index 9c3e9ab53a41..759c2fe033e7 100644
2662 +--- a/drivers/infiniband/ulp/iser/iser_memory.c
2663 ++++ b/drivers/infiniband/ulp/iser/iser_memory.c
2664 +@@ -240,8 +240,8 @@ int iser_fast_reg_fmr(struct iscsi_iser_task *iser_task,
2665 + page_vec->npages = 0;
2666 + page_vec->fake_mr.page_size = SIZE_4K;
2667 + plen = ib_sg_to_pages(&page_vec->fake_mr, mem->sg,
2668 +- mem->size, NULL, iser_set_page);
2669 +- if (unlikely(plen < mem->size)) {
2670 ++ mem->dma_nents, NULL, iser_set_page);
2671 ++ if (unlikely(plen < mem->dma_nents)) {
2672 + iser_err("page vec too short to hold this SG\n");
2673 + iser_data_buf_dump(mem, device->ib_device);
2674 + iser_dump_page_vec(page_vec);
2675 +@@ -450,10 +450,10 @@ static int iser_fast_reg_mr(struct iscsi_iser_task *iser_task,
2676 +
2677 + ib_update_fast_reg_key(mr, ib_inc_rkey(mr->rkey));
2678 +
2679 +- n = ib_map_mr_sg(mr, mem->sg, mem->size, NULL, SIZE_4K);
2680 +- if (unlikely(n != mem->size)) {
2681 ++ n = ib_map_mr_sg(mr, mem->sg, mem->dma_nents, NULL, SIZE_4K);
2682 ++ if (unlikely(n != mem->dma_nents)) {
2683 + iser_err("failed to map sg (%d/%d)\n",
2684 +- n, mem->size);
2685 ++ n, mem->dma_nents);
2686 + return n < 0 ? n : -EINVAL;
2687 + }
2688 +
2689 +diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
2690 +index 02a5e2d7e574..0d2ab9a2cf44 100644
2691 +--- a/drivers/infiniband/ulp/isert/ib_isert.c
2692 ++++ b/drivers/infiniband/ulp/isert/ib_isert.c
2693 +@@ -2555,17 +2555,6 @@ isert_wait4logout(struct isert_conn *isert_conn)
2694 + }
2695 + }
2696 +
2697 +-static void
2698 +-isert_wait4cmds(struct iscsi_conn *conn)
2699 +-{
2700 +- isert_info("iscsi_conn %p\n", conn);
2701 +-
2702 +- if (conn->sess) {
2703 +- target_sess_cmd_list_set_waiting(conn->sess->se_sess);
2704 +- target_wait_for_sess_cmds(conn->sess->se_sess);
2705 +- }
2706 +-}
2707 +-
2708 + /**
2709 + * isert_put_unsol_pending_cmds() - Drop commands waiting for
2710 + * unsolicitate dataout
2711 +@@ -2613,7 +2602,6 @@ static void isert_wait_conn(struct iscsi_conn *conn)
2712 +
2713 + ib_drain_qp(isert_conn->qp);
2714 + isert_put_unsol_pending_cmds(conn);
2715 +- isert_wait4cmds(conn);
2716 + isert_wait4logout(isert_conn);
2717 +
2718 + queue_work(isert_release_wq, &isert_conn->release_work);
2719 +diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c
2720 +index 8567ee47761e..ae3b04557074 100644
2721 +--- a/drivers/input/keyboard/nomadik-ske-keypad.c
2722 ++++ b/drivers/input/keyboard/nomadik-ske-keypad.c
2723 +@@ -100,7 +100,7 @@ static int __init ske_keypad_chip_init(struct ske_keypad *keypad)
2724 + while ((readl(keypad->reg_base + SKE_RIS) != 0x00000000) && timeout--)
2725 + cpu_relax();
2726 +
2727 +- if (!timeout)
2728 ++ if (timeout == -1)
2729 + return -EINVAL;
2730 +
2731 + /*
2732 +diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c
2733 +index a3fe4a990cc9..c7b889d13edd 100644
2734 +--- a/drivers/input/misc/keyspan_remote.c
2735 ++++ b/drivers/input/misc/keyspan_remote.c
2736 +@@ -344,7 +344,8 @@ static int keyspan_setup(struct usb_device* dev)
2737 + int retval = 0;
2738 +
2739 + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
2740 +- 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0);
2741 ++ 0x11, 0x40, 0x5601, 0x0, NULL, 0,
2742 ++ USB_CTRL_SET_TIMEOUT);
2743 + if (retval) {
2744 + dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n",
2745 + __func__, retval);
2746 +@@ -352,7 +353,8 @@ static int keyspan_setup(struct usb_device* dev)
2747 + }
2748 +
2749 + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
2750 +- 0x44, 0x40, 0x0, 0x0, NULL, 0, 0);
2751 ++ 0x44, 0x40, 0x0, 0x0, NULL, 0,
2752 ++ USB_CTRL_SET_TIMEOUT);
2753 + if (retval) {
2754 + dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n",
2755 + __func__, retval);
2756 +@@ -360,7 +362,8 @@ static int keyspan_setup(struct usb_device* dev)
2757 + }
2758 +
2759 + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
2760 +- 0x22, 0x40, 0x0, 0x0, NULL, 0, 0);
2761 ++ 0x22, 0x40, 0x0, 0x0, NULL, 0,
2762 ++ USB_CTRL_SET_TIMEOUT);
2763 + if (retval) {
2764 + dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n",
2765 + __func__, retval);
2766 +diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
2767 +index 4613f0aefd08..5a7e5e073e52 100644
2768 +--- a/drivers/input/tablet/aiptek.c
2769 ++++ b/drivers/input/tablet/aiptek.c
2770 +@@ -1822,14 +1822,14 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2771 + input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0);
2772 +
2773 + /* Verify that a device really has an endpoint */
2774 +- if (intf->altsetting[0].desc.bNumEndpoints < 1) {
2775 ++ if (intf->cur_altsetting->desc.bNumEndpoints < 1) {
2776 + dev_err(&intf->dev,
2777 + "interface has %d endpoints, but must have minimum 1\n",
2778 +- intf->altsetting[0].desc.bNumEndpoints);
2779 ++ intf->cur_altsetting->desc.bNumEndpoints);
2780 + err = -EINVAL;
2781 + goto fail3;
2782 + }
2783 +- endpoint = &intf->altsetting[0].endpoint[0].desc;
2784 ++ endpoint = &intf->cur_altsetting->endpoint[0].desc;
2785 +
2786 + /* Go set up our URB, which is called when the tablet receives
2787 + * input.
2788 +diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
2789 +index 8af736dc4b18..dd8dc335daca 100644
2790 +--- a/drivers/input/tablet/gtco.c
2791 ++++ b/drivers/input/tablet/gtco.c
2792 +@@ -875,18 +875,14 @@ static int gtco_probe(struct usb_interface *usbinterface,
2793 + }
2794 +
2795 + /* Sanity check that a device has an endpoint */
2796 +- if (usbinterface->altsetting[0].desc.bNumEndpoints < 1) {
2797 ++ if (usbinterface->cur_altsetting->desc.bNumEndpoints < 1) {
2798 + dev_err(&usbinterface->dev,
2799 + "Invalid number of endpoints\n");
2800 + error = -EINVAL;
2801 + goto err_free_urb;
2802 + }
2803 +
2804 +- /*
2805 +- * The endpoint is always altsetting 0, we know this since we know
2806 +- * this device only has one interrupt endpoint
2807 +- */
2808 +- endpoint = &usbinterface->altsetting[0].endpoint[0].desc;
2809 ++ endpoint = &usbinterface->cur_altsetting->endpoint[0].desc;
2810 +
2811 + /* Some debug */
2812 + dev_dbg(&usbinterface->dev, "gtco # interfaces: %d\n", usbinterface->num_altsetting);
2813 +@@ -973,7 +969,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
2814 + input_dev->dev.parent = &usbinterface->dev;
2815 +
2816 + /* Setup the URB, it will be posted later on open of input device */
2817 +- endpoint = &usbinterface->altsetting[0].endpoint[0].desc;
2818 ++ endpoint = &usbinterface->cur_altsetting->endpoint[0].desc;
2819 +
2820 + usb_fill_int_urb(gtco->urbinfo,
2821 + udev,
2822 +diff --git a/drivers/input/tablet/pegasus_notetaker.c b/drivers/input/tablet/pegasus_notetaker.c
2823 +index 47de5a81172f..2319144802c9 100644
2824 +--- a/drivers/input/tablet/pegasus_notetaker.c
2825 ++++ b/drivers/input/tablet/pegasus_notetaker.c
2826 +@@ -260,7 +260,7 @@ static int pegasus_probe(struct usb_interface *intf,
2827 + return -ENODEV;
2828 +
2829 + /* Sanity check that the device has an endpoint */
2830 +- if (intf->altsetting[0].desc.bNumEndpoints < 1) {
2831 ++ if (intf->cur_altsetting->desc.bNumEndpoints < 1) {
2832 + dev_err(&intf->dev, "Invalid number of endpoints\n");
2833 + return -EINVAL;
2834 + }
2835 +diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
2836 +index d07dd29d4848..9a94d65bf483 100644
2837 +--- a/drivers/input/touchscreen/sun4i-ts.c
2838 ++++ b/drivers/input/touchscreen/sun4i-ts.c
2839 +@@ -246,6 +246,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
2840 + struct device *dev = &pdev->dev;
2841 + struct device_node *np = dev->of_node;
2842 + struct device *hwmon;
2843 ++ struct thermal_zone_device *thermal;
2844 + int error;
2845 + u32 reg;
2846 + bool ts_attached;
2847 +@@ -365,7 +366,10 @@ static int sun4i_ts_probe(struct platform_device *pdev)
2848 + if (IS_ERR(hwmon))
2849 + return PTR_ERR(hwmon);
2850 +
2851 +- devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, &sun4i_ts_tz_ops);
2852 ++ thermal = devm_thermal_zone_of_sensor_register(ts->dev, 0, ts,
2853 ++ &sun4i_ts_tz_ops);
2854 ++ if (IS_ERR(thermal))
2855 ++ return PTR_ERR(thermal);
2856 +
2857 + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
2858 +
2859 +diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
2860 +index 4c0eecae065c..2180fa8b695b 100644
2861 +--- a/drivers/input/touchscreen/sur40.c
2862 ++++ b/drivers/input/touchscreen/sur40.c
2863 +@@ -523,7 +523,7 @@ static int sur40_probe(struct usb_interface *interface,
2864 + int error;
2865 +
2866 + /* Check if we really have the right interface. */
2867 +- iface_desc = &interface->altsetting[0];
2868 ++ iface_desc = interface->cur_altsetting;
2869 + if (iface_desc->desc.bInterfaceClass != 0xFF)
2870 + return -ENODEV;
2871 +
2872 +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
2873 +index c898c70472bb..bb0448c91f67 100644
2874 +--- a/drivers/iommu/amd_iommu.c
2875 ++++ b/drivers/iommu/amd_iommu.c
2876 +@@ -2113,6 +2113,8 @@ skip_ats_check:
2877 + */
2878 + domain_flush_tlb_pde(domain);
2879 +
2880 ++ domain_flush_complete(domain);
2881 ++
2882 + return ret;
2883 + }
2884 +
2885 +diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
2886 +index 9bb8d64b6f94..c113e46fdc3a 100644
2887 +--- a/drivers/iommu/amd_iommu_init.c
2888 ++++ b/drivers/iommu/amd_iommu_init.c
2889 +@@ -383,6 +383,9 @@ static void iommu_enable(struct amd_iommu *iommu)
2890 +
2891 + static void iommu_disable(struct amd_iommu *iommu)
2892 + {
2893 ++ if (!iommu->mmio_base)
2894 ++ return;
2895 ++
2896 + /* Disable command buffer */
2897 + iommu_feature_disable(iommu, CONTROL_CMDBUF_EN);
2898 +
2899 +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
2900 +index 25cc6ae87039..5c6e0a9fd2f3 100644
2901 +--- a/drivers/iommu/intel-iommu.c
2902 ++++ b/drivers/iommu/intel-iommu.c
2903 +@@ -3345,9 +3345,12 @@ static int __init init_dmars(void)
2904 + iommu_identity_mapping |= IDENTMAP_ALL;
2905 +
2906 + #ifdef CONFIG_INTEL_IOMMU_BROKEN_GFX_WA
2907 +- iommu_identity_mapping |= IDENTMAP_GFX;
2908 ++ dmar_map_gfx = 0;
2909 + #endif
2910 +
2911 ++ if (!dmar_map_gfx)
2912 ++ iommu_identity_mapping |= IDENTMAP_GFX;
2913 ++
2914 + check_tylersburg_isoch();
2915 +
2916 + if (iommu_identity_mapping) {
2917 +diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
2918 +index 71b89e47e952..dbcc13efaf3c 100644
2919 +--- a/drivers/iommu/iommu.c
2920 ++++ b/drivers/iommu/iommu.c
2921 +@@ -1582,9 +1582,9 @@ int iommu_request_dm_for_dev(struct device *dev)
2922 + int ret;
2923 +
2924 + /* Device must already be in a group before calling this function */
2925 +- group = iommu_group_get_for_dev(dev);
2926 +- if (IS_ERR(group))
2927 +- return PTR_ERR(group);
2928 ++ group = iommu_group_get(dev);
2929 ++ if (!group)
2930 ++ return -EINVAL;
2931 +
2932 + mutex_lock(&group->mutex);
2933 +
2934 +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
2935 +index 080f9afcde8d..526e9d5a4fb1 100644
2936 +--- a/drivers/md/bcache/super.c
2937 ++++ b/drivers/md/bcache/super.c
2938 +@@ -1398,9 +1398,6 @@ static void cache_set_flush(struct closure *cl)
2939 + struct btree *b;
2940 + unsigned i;
2941 +
2942 +- if (!c)
2943 +- closure_return(cl);
2944 +-
2945 + bch_cache_accounting_destroy(&c->accounting);
2946 +
2947 + kobject_put(&c->internal);
2948 +diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
2949 +index f7ff408567ad..63bff4cc7098 100644
2950 +--- a/drivers/md/bitmap.c
2951 ++++ b/drivers/md/bitmap.c
2952 +@@ -1699,7 +1699,7 @@ void bitmap_flush(struct mddev *mddev)
2953 + /*
2954 + * free memory that was allocated
2955 + */
2956 +-static void bitmap_free(struct bitmap *bitmap)
2957 ++static void md_bitmap_free(struct bitmap *bitmap)
2958 + {
2959 + unsigned long k, pages;
2960 + struct bitmap_page *bp;
2961 +@@ -1749,7 +1749,7 @@ void bitmap_destroy(struct mddev *mddev)
2962 + if (mddev->thread)
2963 + mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
2964 +
2965 +- bitmap_free(bitmap);
2966 ++ md_bitmap_free(bitmap);
2967 + }
2968 +
2969 + /*
2970 +@@ -1834,7 +1834,7 @@ struct bitmap *bitmap_create(struct mddev *mddev, int slot)
2971 +
2972 + return bitmap;
2973 + error:
2974 +- bitmap_free(bitmap);
2975 ++ md_bitmap_free(bitmap);
2976 + return ERR_PTR(err);
2977 + }
2978 +
2979 +@@ -1936,7 +1936,7 @@ int bitmap_copy_from_slot(struct mddev *mddev, int slot,
2980 + *low = lo;
2981 + *high = hi;
2982 + err:
2983 +- bitmap_free(bitmap);
2984 ++ md_bitmap_free(bitmap);
2985 + return rv;
2986 + }
2987 + EXPORT_SYMBOL_GPL(bitmap_copy_from_slot);
2988 +diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
2989 +index ade3c48e2e0c..18546f950d79 100644
2990 +--- a/drivers/media/i2c/ov2659.c
2991 ++++ b/drivers/media/i2c/ov2659.c
2992 +@@ -1137,7 +1137,7 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd,
2993 + mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
2994 + *mf = fmt->format;
2995 + #else
2996 +- return -ENOTTY;
2997 ++ ret = -ENOTTY;
2998 + #endif
2999 + } else {
3000 + s64 val;
3001 +diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c
3002 +index 7a119466f973..3c959e48855c 100644
3003 +--- a/drivers/media/i2c/soc_camera/ov6650.c
3004 ++++ b/drivers/media/i2c/soc_camera/ov6650.c
3005 +@@ -203,7 +203,6 @@ struct ov6650 {
3006 + unsigned long pclk_max; /* from resolution and format */
3007 + struct v4l2_fract tpf; /* as requested with s_parm */
3008 + u32 code;
3009 +- enum v4l2_colorspace colorspace;
3010 + };
3011 +
3012 +
3013 +@@ -216,6 +215,17 @@ static u32 ov6650_codes[] = {
3014 + MEDIA_BUS_FMT_Y8_1X8,
3015 + };
3016 +
3017 ++static const struct v4l2_mbus_framefmt ov6650_def_fmt = {
3018 ++ .width = W_CIF,
3019 ++ .height = H_CIF,
3020 ++ .code = MEDIA_BUS_FMT_SBGGR8_1X8,
3021 ++ .colorspace = V4L2_COLORSPACE_SRGB,
3022 ++ .field = V4L2_FIELD_NONE,
3023 ++ .ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT,
3024 ++ .quantization = V4L2_QUANTIZATION_DEFAULT,
3025 ++ .xfer_func = V4L2_XFER_FUNC_DEFAULT,
3026 ++};
3027 ++
3028 + /* read a register */
3029 + static int ov6650_reg_read(struct i2c_client *client, u8 reg, u8 *val)
3030 + {
3031 +@@ -512,12 +522,20 @@ static int ov6650_get_fmt(struct v4l2_subdev *sd,
3032 + if (format->pad)
3033 + return -EINVAL;
3034 +
3035 +- mf->width = priv->rect.width >> priv->half_scale;
3036 +- mf->height = priv->rect.height >> priv->half_scale;
3037 +- mf->code = priv->code;
3038 +- mf->colorspace = priv->colorspace;
3039 +- mf->field = V4L2_FIELD_NONE;
3040 ++ /* initialize response with default media bus frame format */
3041 ++ *mf = ov6650_def_fmt;
3042 +
3043 ++ /* update media bus format code and frame size */
3044 ++ if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
3045 ++ mf->width = cfg->try_fmt.width;
3046 ++ mf->height = cfg->try_fmt.height;
3047 ++ mf->code = cfg->try_fmt.code;
3048 ++
3049 ++ } else {
3050 ++ mf->width = priv->rect.width >> priv->half_scale;
3051 ++ mf->height = priv->rect.height >> priv->half_scale;
3052 ++ mf->code = priv->code;
3053 ++ }
3054 + return 0;
3055 + }
3056 +
3057 +@@ -624,11 +642,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
3058 + priv->pclk_max = 8000000;
3059 + }
3060 +
3061 +- if (code == MEDIA_BUS_FMT_SBGGR8_1X8)
3062 +- priv->colorspace = V4L2_COLORSPACE_SRGB;
3063 +- else if (code != 0)
3064 +- priv->colorspace = V4L2_COLORSPACE_JPEG;
3065 +-
3066 + if (half_scale) {
3067 + dev_dbg(&client->dev, "max resolution: QCIF\n");
3068 + coma_set |= COMA_QCIF;
3069 +@@ -684,11 +697,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
3070 + if (!ret)
3071 + priv->code = code;
3072 +
3073 +- if (!ret) {
3074 +- mf->colorspace = priv->colorspace;
3075 +- mf->width = priv->rect.width >> half_scale;
3076 +- mf->height = priv->rect.height >> half_scale;
3077 +- }
3078 + return ret;
3079 + }
3080 +
3081 +@@ -707,8 +715,6 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd,
3082 + v4l_bound_align_image(&mf->width, 2, W_CIF, 1,
3083 + &mf->height, 2, H_CIF, 1, 0);
3084 +
3085 +- mf->field = V4L2_FIELD_NONE;
3086 +-
3087 + switch (mf->code) {
3088 + case MEDIA_BUS_FMT_Y10_1X10:
3089 + mf->code = MEDIA_BUS_FMT_Y8_1X8;
3090 +@@ -717,19 +723,38 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd,
3091 + case MEDIA_BUS_FMT_YUYV8_2X8:
3092 + case MEDIA_BUS_FMT_VYUY8_2X8:
3093 + case MEDIA_BUS_FMT_UYVY8_2X8:
3094 +- mf->colorspace = V4L2_COLORSPACE_JPEG;
3095 + break;
3096 + default:
3097 + mf->code = MEDIA_BUS_FMT_SBGGR8_1X8;
3098 + case MEDIA_BUS_FMT_SBGGR8_1X8:
3099 +- mf->colorspace = V4L2_COLORSPACE_SRGB;
3100 + break;
3101 + }
3102 +
3103 +- if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
3104 +- return ov6650_s_fmt(sd, mf);
3105 +- cfg->try_fmt = *mf;
3106 ++ if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
3107 ++ /* store media bus format code and frame size in pad config */
3108 ++ cfg->try_fmt.width = mf->width;
3109 ++ cfg->try_fmt.height = mf->height;
3110 ++ cfg->try_fmt.code = mf->code;
3111 +
3112 ++ /* return default mbus frame format updated with pad config */
3113 ++ *mf = ov6650_def_fmt;
3114 ++ mf->width = cfg->try_fmt.width;
3115 ++ mf->height = cfg->try_fmt.height;
3116 ++ mf->code = cfg->try_fmt.code;
3117 ++
3118 ++ } else {
3119 ++ /* apply new media bus format code and frame size */
3120 ++ int ret = ov6650_s_fmt(sd, mf);
3121 ++
3122 ++ if (ret)
3123 ++ return ret;
3124 ++
3125 ++ /* return default format updated with active size and code */
3126 ++ *mf = ov6650_def_fmt;
3127 ++ mf->width = priv->rect.width >> priv->half_scale;
3128 ++ mf->height = priv->rect.height >> priv->half_scale;
3129 ++ mf->code = priv->code;
3130 ++ }
3131 + return 0;
3132 + }
3133 +
3134 +@@ -1048,7 +1073,6 @@ static int ov6650_probe(struct i2c_client *client,
3135 + priv->rect.height = H_CIF;
3136 + priv->half_scale = false;
3137 + priv->code = MEDIA_BUS_FMT_YUYV8_2X8;
3138 +- priv->colorspace = V4L2_COLORSPACE_JPEG;
3139 +
3140 + ret = ov6650_video_probe(client);
3141 + if (ret)
3142 +diff --git a/drivers/media/pci/cx18/cx18-fileops.c b/drivers/media/pci/cx18/cx18-fileops.c
3143 +index df837408efd5..0171dc5b8809 100644
3144 +--- a/drivers/media/pci/cx18/cx18-fileops.c
3145 ++++ b/drivers/media/pci/cx18/cx18-fileops.c
3146 +@@ -490,7 +490,7 @@ static ssize_t cx18_read_pos(struct cx18_stream *s, char __user *ubuf,
3147 +
3148 + CX18_DEBUG_HI_FILE("read %zd from %s, got %zd\n", count, s->name, rc);
3149 + if (rc > 0)
3150 +- pos += rc;
3151 ++ *pos += rc;
3152 + return rc;
3153 + }
3154 +
3155 +diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c
3156 +index 818f3c2fc98d..1d86e57f4d9f 100644
3157 +--- a/drivers/media/pci/cx23885/cx23885-dvb.c
3158 ++++ b/drivers/media/pci/cx23885/cx23885-dvb.c
3159 +@@ -1471,8 +1471,9 @@ static int dvb_register(struct cx23885_tsport *port)
3160 + if (fe0->dvb.frontend != NULL) {
3161 + struct i2c_adapter *tun_i2c;
3162 +
3163 +- fe0->dvb.frontend->sec_priv = kmalloc(sizeof(dib7000p_ops), GFP_KERNEL);
3164 +- memcpy(fe0->dvb.frontend->sec_priv, &dib7000p_ops, sizeof(dib7000p_ops));
3165 ++ fe0->dvb.frontend->sec_priv = kmemdup(&dib7000p_ops, sizeof(dib7000p_ops), GFP_KERNEL);
3166 ++ if (!fe0->dvb.frontend->sec_priv)
3167 ++ return -ENOMEM;
3168 + tun_i2c = dib7000p_ops.get_i2c_master(fe0->dvb.frontend, DIBX000_I2C_INTERFACE_TUNER, 1);
3169 + if (!dvb_attach(dib0070_attach, fe0->dvb.frontend, tun_i2c, &dib7070p_dib0070_config))
3170 + return -ENODEV;
3171 +diff --git a/drivers/media/pci/ivtv/ivtv-fileops.c b/drivers/media/pci/ivtv/ivtv-fileops.c
3172 +index c9bd018e53de..e2b19c3eaa87 100644
3173 +--- a/drivers/media/pci/ivtv/ivtv-fileops.c
3174 ++++ b/drivers/media/pci/ivtv/ivtv-fileops.c
3175 +@@ -420,7 +420,7 @@ static ssize_t ivtv_read_pos(struct ivtv_stream *s, char __user *ubuf, size_t co
3176 +
3177 + IVTV_DEBUG_HI_FILE("read %zd from %s, got %zd\n", count, s->name, rc);
3178 + if (rc > 0)
3179 +- pos += rc;
3180 ++ *pos += rc;
3181 + return rc;
3182 + }
3183 +
3184 +diff --git a/drivers/media/pci/tw5864/tw5864-video.c b/drivers/media/pci/tw5864/tw5864-video.c
3185 +index 1ddf80f85c24..27ff6e0d9845 100644
3186 +--- a/drivers/media/pci/tw5864/tw5864-video.c
3187 ++++ b/drivers/media/pci/tw5864/tw5864-video.c
3188 +@@ -1386,13 +1386,13 @@ static void tw5864_handle_frame(struct tw5864_h264_frame *frame)
3189 + input->vb = NULL;
3190 + spin_unlock_irqrestore(&input->slock, flags);
3191 +
3192 +- v4l2_buf = to_vb2_v4l2_buffer(&vb->vb.vb2_buf);
3193 +-
3194 + if (!vb) { /* Gone because of disabling */
3195 + dev_dbg(&dev->pci->dev, "vb is empty, dropping frame\n");
3196 + return;
3197 + }
3198 +
3199 ++ v4l2_buf = to_vb2_v4l2_buffer(&vb->vb.vb2_buf);
3200 ++
3201 + /*
3202 + * Check for space.
3203 + * Mind the overhead of startcode emulation prevention.
3204 +diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c
3205 +index 78e37cf3470f..b51b875c5a61 100644
3206 +--- a/drivers/media/platform/davinci/isif.c
3207 ++++ b/drivers/media/platform/davinci/isif.c
3208 +@@ -890,9 +890,7 @@ static int isif_set_hw_if_params(struct vpfe_hw_if_param *params)
3209 + static int isif_config_ycbcr(void)
3210 + {
3211 + struct isif_ycbcr_config *params = &isif_cfg.ycbcr;
3212 +- struct vpss_pg_frame_size frame_size;
3213 + u32 modeset = 0, ccdcfg = 0;
3214 +- struct vpss_sync_pol sync;
3215 +
3216 + dev_dbg(isif_cfg.dev, "\nStarting isif_config_ycbcr...");
3217 +
3218 +@@ -980,13 +978,6 @@ static int isif_config_ycbcr(void)
3219 + /* two fields are interleaved in memory */
3220 + regw(0x00000249, SDOFST);
3221 +
3222 +- /* Setup test pattern if enabled */
3223 +- if (isif_cfg.bayer.config_params.test_pat_gen) {
3224 +- sync.ccdpg_hdpol = params->hd_pol;
3225 +- sync.ccdpg_vdpol = params->vd_pol;
3226 +- dm365_vpss_set_sync_pol(sync);
3227 +- dm365_vpss_set_pg_frame_size(frame_size);
3228 +- }
3229 + return 0;
3230 + }
3231 +
3232 +diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
3233 +index abce9c4a1a8e..59518c08528b 100644
3234 +--- a/drivers/media/platform/davinci/vpbe.c
3235 ++++ b/drivers/media/platform/davinci/vpbe.c
3236 +@@ -130,7 +130,7 @@ static int vpbe_enum_outputs(struct vpbe_device *vpbe_dev,
3237 + struct v4l2_output *output)
3238 + {
3239 + struct vpbe_config *cfg = vpbe_dev->cfg;
3240 +- int temp_index = output->index;
3241 ++ unsigned int temp_index = output->index;
3242 +
3243 + if (temp_index >= cfg->num_outputs)
3244 + return -EINVAL;
3245 +diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
3246 +index a31b95cb3b09..77ec70f5fef6 100644
3247 +--- a/drivers/media/platform/omap/omap_vout.c
3248 ++++ b/drivers/media/platform/omap/omap_vout.c
3249 +@@ -1526,23 +1526,20 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b)
3250 + unsigned long size;
3251 + struct videobuf_buffer *vb;
3252 +
3253 +- vb = q->bufs[b->index];
3254 +-
3255 + if (!vout->streaming)
3256 + return -EINVAL;
3257 +
3258 +- if (file->f_flags & O_NONBLOCK)
3259 +- /* Call videobuf_dqbuf for non blocking mode */
3260 +- ret = videobuf_dqbuf(q, (struct v4l2_buffer *)b, 1);
3261 +- else
3262 +- /* Call videobuf_dqbuf for blocking mode */
3263 +- ret = videobuf_dqbuf(q, (struct v4l2_buffer *)b, 0);
3264 ++ ret = videobuf_dqbuf(q, b, !!(file->f_flags & O_NONBLOCK));
3265 ++ if (ret)
3266 ++ return ret;
3267 ++
3268 ++ vb = q->bufs[b->index];
3269 +
3270 + addr = (unsigned long) vout->buf_phy_addr[vb->i];
3271 + size = (unsigned long) vb->size;
3272 + dma_unmap_single(vout->vid_dev->v4l2_dev.dev, addr,
3273 + size, DMA_TO_DEVICE);
3274 +- return ret;
3275 ++ return 0;
3276 + }
3277 +
3278 + static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i)
3279 +diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
3280 +index c89922fb42ce..a63f4eec366e 100644
3281 +--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
3282 ++++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
3283 +@@ -1963,7 +1963,7 @@ static int s5p_jpeg_controls_create(struct s5p_jpeg_ctx *ctx)
3284 +
3285 + v4l2_ctrl_new_std(&ctx->ctrl_handler, &s5p_jpeg_ctrl_ops,
3286 + V4L2_CID_JPEG_RESTART_INTERVAL,
3287 +- 0, 3, 0xffff, 0);
3288 ++ 0, 0xffff, 1, 0);
3289 + if (ctx->jpeg->variant->version == SJPEG_S5P)
3290 + mask = ~0x06; /* 422, 420 */
3291 + }
3292 +diff --git a/drivers/media/platform/vivid/vivid-osd.c b/drivers/media/platform/vivid/vivid-osd.c
3293 +index bdc380b14e0c..a95b7c56569e 100644
3294 +--- a/drivers/media/platform/vivid/vivid-osd.c
3295 ++++ b/drivers/media/platform/vivid/vivid-osd.c
3296 +@@ -167,7 +167,7 @@ static int _vivid_fb_check_var(struct fb_var_screeninfo *var, struct vivid_dev *
3297 + var->nonstd = 0;
3298 +
3299 + var->vmode &= ~FB_VMODE_MASK;
3300 +- var->vmode = FB_VMODE_NONINTERLACED;
3301 ++ var->vmode |= FB_VMODE_NONINTERLACED;
3302 +
3303 + /* Dummy values */
3304 + var->hsync_len = 24;
3305 +diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c
3306 +index c1457cf46698..db987dda356e 100644
3307 +--- a/drivers/media/radio/wl128x/fmdrv_common.c
3308 ++++ b/drivers/media/radio/wl128x/fmdrv_common.c
3309 +@@ -1278,8 +1278,9 @@ static int fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name)
3310 +
3311 + switch (action->type) {
3312 + case ACTION_SEND_COMMAND: /* Send */
3313 +- if (fmc_send_cmd(fmdev, 0, 0, action->data,
3314 +- action->size, NULL, NULL))
3315 ++ ret = fmc_send_cmd(fmdev, 0, 0, action->data,
3316 ++ action->size, NULL, NULL);
3317 ++ if (ret)
3318 + goto rel_fw;
3319 +
3320 + cmd_cnt++;
3321 +diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
3322 +index 22dd8c055048..71cecd7aeea0 100644
3323 +--- a/drivers/mfd/intel-lpss.c
3324 ++++ b/drivers/mfd/intel-lpss.c
3325 +@@ -533,6 +533,7 @@ module_init(intel_lpss_init);
3326 +
3327 + static void __exit intel_lpss_exit(void)
3328 + {
3329 ++ ida_destroy(&intel_lpss_devid_ida);
3330 + debugfs_remove(intel_lpss_debugfs);
3331 + }
3332 + module_exit(intel_lpss_exit);
3333 +diff --git a/drivers/misc/mic/card/mic_x100.c b/drivers/misc/mic/card/mic_x100.c
3334 +index b9f0710ffa6b..4007adc666f3 100644
3335 +--- a/drivers/misc/mic/card/mic_x100.c
3336 ++++ b/drivers/misc/mic/card/mic_x100.c
3337 +@@ -249,6 +249,9 @@ static int __init mic_probe(struct platform_device *pdev)
3338 + mdrv->dev = &pdev->dev;
3339 + snprintf(mdrv->name, sizeof(mic_driver_name), mic_driver_name);
3340 +
3341 ++ /* FIXME: use dma_set_mask_and_coherent() and check result */
3342 ++ dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
3343 ++
3344 + mdev->mmio.pa = MIC_X100_MMIO_BASE;
3345 + mdev->mmio.len = MIC_X100_MMIO_LEN;
3346 + mdev->mmio.va = devm_ioremap(&pdev->dev, MIC_X100_MMIO_BASE,
3347 +@@ -294,18 +297,6 @@ static void mic_platform_shutdown(struct platform_device *pdev)
3348 + mic_remove(pdev);
3349 + }
3350 +
3351 +-static u64 mic_dma_mask = DMA_BIT_MASK(64);
3352 +-
3353 +-static struct platform_device mic_platform_dev = {
3354 +- .name = mic_driver_name,
3355 +- .id = 0,
3356 +- .num_resources = 0,
3357 +- .dev = {
3358 +- .dma_mask = &mic_dma_mask,
3359 +- .coherent_dma_mask = DMA_BIT_MASK(64),
3360 +- },
3361 +-};
3362 +-
3363 + static struct platform_driver __refdata mic_platform_driver = {
3364 + .probe = mic_probe,
3365 + .remove = mic_remove,
3366 +@@ -315,6 +306,8 @@ static struct platform_driver __refdata mic_platform_driver = {
3367 + },
3368 + };
3369 +
3370 ++static struct platform_device *mic_platform_dev;
3371 ++
3372 + static int __init mic_init(void)
3373 + {
3374 + int ret;
3375 +@@ -328,9 +321,12 @@ static int __init mic_init(void)
3376 +
3377 + request_module("mic_x100_dma");
3378 + mic_init_card_debugfs();
3379 +- ret = platform_device_register(&mic_platform_dev);
3380 ++
3381 ++ mic_platform_dev = platform_device_register_simple(mic_driver_name,
3382 ++ 0, NULL, 0);
3383 ++ ret = PTR_ERR_OR_ZERO(mic_platform_dev);
3384 + if (ret) {
3385 +- pr_err("platform_device_register ret %d\n", ret);
3386 ++ pr_err("platform_device_register_full ret %d\n", ret);
3387 + goto cleanup_debugfs;
3388 + }
3389 + ret = platform_driver_register(&mic_platform_driver);
3390 +@@ -341,7 +337,7 @@ static int __init mic_init(void)
3391 + return ret;
3392 +
3393 + device_unregister:
3394 +- platform_device_unregister(&mic_platform_dev);
3395 ++ platform_device_unregister(mic_platform_dev);
3396 + cleanup_debugfs:
3397 + mic_exit_card_debugfs();
3398 + done:
3399 +@@ -351,7 +347,7 @@ done:
3400 + static void __exit mic_exit(void)
3401 + {
3402 + platform_driver_unregister(&mic_platform_driver);
3403 +- platform_device_unregister(&mic_platform_dev);
3404 ++ platform_device_unregister(mic_platform_dev);
3405 + mic_exit_card_debugfs();
3406 + }
3407 +
3408 +diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
3409 +index 6956f7e7d439..ca5f0102daef 100644
3410 +--- a/drivers/misc/sgi-xp/xpc_partition.c
3411 ++++ b/drivers/misc/sgi-xp/xpc_partition.c
3412 +@@ -70,7 +70,7 @@ xpc_get_rsvd_page_pa(int nasid)
3413 + unsigned long rp_pa = nasid; /* seed with nasid */
3414 + size_t len = 0;
3415 + size_t buf_len = 0;
3416 +- void *buf = buf;
3417 ++ void *buf = NULL;
3418 + void *buf_base = NULL;
3419 + enum xp_retval (*get_partition_rsvd_page_pa)
3420 + (void *, u64 *, unsigned long *, size_t *) =
3421 +diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
3422 +index 159f6f64c68e..ed6473731b45 100644
3423 +--- a/drivers/mmc/host/sdhci-brcmstb.c
3424 ++++ b/drivers/mmc/host/sdhci-brcmstb.c
3425 +@@ -90,7 +90,9 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
3426 + host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ;
3427 +
3428 + sdhci_get_of_property(pdev);
3429 +- mmc_of_parse(host->mmc);
3430 ++ res = mmc_of_parse(host->mmc);
3431 ++ if (res)
3432 ++ goto err;
3433 +
3434 + /*
3435 + * Supply the existing CAPS, but clear the UHS modes. This
3436 +diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
3437 +index 088a3ae0dff0..ec1949045295 100644
3438 +--- a/drivers/mmc/host/sdhci-tegra.c
3439 ++++ b/drivers/mmc/host/sdhci-tegra.c
3440 +@@ -174,7 +174,7 @@ static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask)
3441 + misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_DDR50;
3442 + if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR104)
3443 + misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDR104;
3444 +- if (soc_data->nvquirks & SDHCI_MISC_CTRL_ENABLE_SDR50)
3445 ++ if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR50)
3446 + clk_ctrl |= SDHCI_CLOCK_CTRL_SDR50_TUNING_OVERRIDE;
3447 + }
3448 +
3449 +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
3450 +index bd43dc7f4c63..68b736547d81 100644
3451 +--- a/drivers/mmc/host/sdhci.c
3452 ++++ b/drivers/mmc/host/sdhci.c
3453 +@@ -3243,11 +3243,13 @@ int sdhci_setup_host(struct sdhci_host *host)
3454 + if (host->ops->get_min_clock)
3455 + mmc->f_min = host->ops->get_min_clock(host);
3456 + else if (host->version >= SDHCI_SPEC_300) {
3457 +- if (host->clk_mul) {
3458 +- mmc->f_min = (host->max_clk * host->clk_mul) / 1024;
3459 ++ if (host->clk_mul)
3460 + max_clk = host->max_clk * host->clk_mul;
3461 +- } else
3462 +- mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300;
3463 ++ /*
3464 ++ * Divided Clock Mode minimum clock rate is always less than
3465 ++ * Programmable Clock Mode minimum clock rate.
3466 ++ */
3467 ++ mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300;
3468 + } else
3469 + mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200;
3470 +
3471 +diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
3472 +index 020437900fce..453a2ea7895b 100644
3473 +--- a/drivers/net/can/slcan.c
3474 ++++ b/drivers/net/can/slcan.c
3475 +@@ -344,9 +344,16 @@ static void slcan_transmit(struct work_struct *work)
3476 + */
3477 + static void slcan_write_wakeup(struct tty_struct *tty)
3478 + {
3479 +- struct slcan *sl = tty->disc_data;
3480 ++ struct slcan *sl;
3481 ++
3482 ++ rcu_read_lock();
3483 ++ sl = rcu_dereference(tty->disc_data);
3484 ++ if (!sl)
3485 ++ goto out;
3486 +
3487 + schedule_work(&sl->tx_work);
3488 ++out:
3489 ++ rcu_read_unlock();
3490 + }
3491 +
3492 + /* Send a can_frame to a TTY queue. */
3493 +@@ -640,10 +647,11 @@ static void slcan_close(struct tty_struct *tty)
3494 + return;
3495 +
3496 + spin_lock_bh(&sl->lock);
3497 +- tty->disc_data = NULL;
3498 ++ rcu_assign_pointer(tty->disc_data, NULL);
3499 + sl->tty = NULL;
3500 + spin_unlock_bh(&sl->lock);
3501 +
3502 ++ synchronize_rcu();
3503 + flush_work(&sl->tx_work);
3504 +
3505 + /* Flush network side */
3506 +diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
3507 +index ebfbaf8597f4..3bbe85aae49b 100644
3508 +--- a/drivers/net/dsa/qca8k.c
3509 ++++ b/drivers/net/dsa/qca8k.c
3510 +@@ -460,6 +460,18 @@ qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode)
3511 + qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL,
3512 + QCA8K_PORT_PAD_RGMII_RX_DELAY_EN);
3513 + break;
3514 ++ case PHY_INTERFACE_MODE_RGMII_ID:
3515 ++ /* RGMII_ID needs internal delay. This is enabled through
3516 ++ * PORT5_PAD_CTRL for all ports, rather than individual port
3517 ++ * registers
3518 ++ */
3519 ++ qca8k_write(priv, reg,
3520 ++ QCA8K_PORT_PAD_RGMII_EN |
3521 ++ QCA8K_PORT_PAD_RGMII_TX_DELAY(QCA8K_MAX_DELAY) |
3522 ++ QCA8K_PORT_PAD_RGMII_RX_DELAY(QCA8K_MAX_DELAY));
3523 ++ qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL,
3524 ++ QCA8K_PORT_PAD_RGMII_RX_DELAY_EN);
3525 ++ break;
3526 + case PHY_INTERFACE_MODE_SGMII:
3527 + qca8k_write(priv, reg, QCA8K_PORT_PAD_SGMII_EN);
3528 + break;
3529 +diff --git a/drivers/net/dsa/qca8k.h b/drivers/net/dsa/qca8k.h
3530 +index 9c22bc3210cd..db95168ca111 100644
3531 +--- a/drivers/net/dsa/qca8k.h
3532 ++++ b/drivers/net/dsa/qca8k.h
3533 +@@ -40,6 +40,7 @@
3534 + ((0x8 + (x & 0x3)) << 22)
3535 + #define QCA8K_PORT_PAD_RGMII_RX_DELAY(x) \
3536 + ((0x10 + (x & 0x3)) << 20)
3537 ++#define QCA8K_MAX_DELAY 3
3538 + #define QCA8K_PORT_PAD_RGMII_RX_DELAY_EN BIT(24)
3539 + #define QCA8K_PORT_PAD_SGMII_EN BIT(7)
3540 + #define QCA8K_REG_MODULE_EN 0x030
3541 +diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
3542 +index bcd993140f84..912dc09bc7a7 100644
3543 +--- a/drivers/net/ethernet/amazon/ena/ena_com.c
3544 ++++ b/drivers/net/ethernet/amazon/ena/ena_com.c
3545 +@@ -1967,7 +1967,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)
3546 + if (unlikely(ret))
3547 + return ret;
3548 +
3549 +- if (get_resp.u.flow_hash_func.supported_func & (1 << rss->hash_func)) {
3550 ++ if (!(get_resp.u.flow_hash_func.supported_func & BIT(rss->hash_func))) {
3551 + pr_err("Func hash %d isn't supported by device, abort\n",
3552 + rss->hash_func);
3553 + return -EPERM;
3554 +@@ -2052,6 +2052,7 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
3555 + return -EINVAL;
3556 + }
3557 +
3558 ++ rss->hash_func = func;
3559 + rc = ena_com_set_hash_function(ena_dev);
3560 +
3561 + /* Restore the old function */
3562 +diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
3563 +index 67b2338f8fb3..06fd061a20e9 100644
3564 +--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
3565 ++++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
3566 +@@ -697,8 +697,8 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir,
3567 + if (indir) {
3568 + for (i = 0; i < ENA_RX_RSS_TABLE_SIZE; i++) {
3569 + rc = ena_com_indirect_table_fill_entry(ena_dev,
3570 +- ENA_IO_RXQ_IDX(indir[i]),
3571 +- i);
3572 ++ i,
3573 ++ ENA_IO_RXQ_IDX(indir[i]));
3574 + if (unlikely(rc)) {
3575 + netif_err(adapter, drv, netdev,
3576 + "Cannot fill indirect table (index is too large)\n");
3577 +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
3578 +index 961f31c8356b..da21886609e3 100644
3579 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
3580 ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
3581 +@@ -1702,6 +1702,7 @@ err_setup_rx:
3582 + err_setup_tx:
3583 + ena_free_io_irq(adapter);
3584 + err_req_irq:
3585 ++ ena_del_napi(adapter);
3586 +
3587 + return rc;
3588 + }
3589 +diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
3590 +index 95874c10c23b..e3b41af65d18 100644
3591 +--- a/drivers/net/ethernet/broadcom/bcmsysport.c
3592 ++++ b/drivers/net/ethernet/broadcom/bcmsysport.c
3593 +@@ -1773,7 +1773,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
3594 +
3595 + priv->phy_interface = of_get_phy_mode(dn);
3596 + /* Default to GMII interface mode */
3597 +- if (priv->phy_interface < 0)
3598 ++ if ((int)priv->phy_interface < 0)
3599 + priv->phy_interface = PHY_INTERFACE_MODE_GMII;
3600 +
3601 + /* In the case of a fixed PHY, the DT node associated
3602 +diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
3603 +index d1a2159e40d6..9627ed0b2f1c 100644
3604 +--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
3605 ++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
3606 +@@ -2440,6 +2440,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
3607 +
3608 + if (!is_offload(adapter))
3609 + return -EOPNOTSUPP;
3610 ++ if (!capable(CAP_NET_ADMIN))
3611 ++ return -EPERM;
3612 + if (!(adapter->flags & FULL_INIT_DONE))
3613 + return -EIO; /* need the memory controllers */
3614 + if (copy_from_user(&t, useraddr, sizeof(t)))
3615 +diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
3616 +index e69a6bed31a9..dd24c352b200 100644
3617 +--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
3618 ++++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
3619 +@@ -929,7 +929,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
3620 + goto err_free_mdio;
3621 +
3622 + priv->phy_mode = of_get_phy_mode(node);
3623 +- if (priv->phy_mode < 0) {
3624 ++ if ((int)priv->phy_mode < 0) {
3625 + netdev_err(ndev, "not find phy-mode\n");
3626 + ret = -EINVAL;
3627 + goto err_mdiobus;
3628 +diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
3629 +index 2dd17e01e3a7..3692adb8902d 100644
3630 +--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
3631 ++++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
3632 +@@ -1476,7 +1476,7 @@ static int ehea_init_port_res(struct ehea_port *port, struct ehea_port_res *pr,
3633 +
3634 + memset(pr, 0, sizeof(struct ehea_port_res));
3635 +
3636 +- pr->tx_bytes = rx_bytes;
3637 ++ pr->tx_bytes = tx_bytes;
3638 + pr->tx_packets = tx_packets;
3639 + pr->rx_bytes = rx_bytes;
3640 + pr->rx_packets = rx_packets;
3641 +diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h
3642 +index b2a745b579fd..fdc69218c8ca 100644
3643 +--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h
3644 ++++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h
3645 +@@ -1873,7 +1873,7 @@ static inline void mlxsw_reg_qtct_pack(char *payload, u8 local_port,
3646 + * Configures the ETS elements.
3647 + */
3648 + #define MLXSW_REG_QEEC_ID 0x400D
3649 +-#define MLXSW_REG_QEEC_LEN 0x1C
3650 ++#define MLXSW_REG_QEEC_LEN 0x20
3651 +
3652 + static const struct mlxsw_reg_info mlxsw_reg_qeec = {
3653 + .id = MLXSW_REG_QEEC_ID,
3654 +@@ -1918,6 +1918,15 @@ MLXSW_ITEM32(reg, qeec, element_index, 0x04, 0, 8);
3655 + */
3656 + MLXSW_ITEM32(reg, qeec, next_element_index, 0x08, 0, 8);
3657 +
3658 ++/* reg_qeec_mise
3659 ++ * Min shaper configuration enable. Enables configuration of the min
3660 ++ * shaper on this ETS element
3661 ++ * 0 - Disable
3662 ++ * 1 - Enable
3663 ++ * Access: RW
3664 ++ */
3665 ++MLXSW_ITEM32(reg, qeec, mise, 0x0C, 31, 1);
3666 ++
3667 + enum {
3668 + MLXSW_REG_QEEC_BYTES_MODE,
3669 + MLXSW_REG_QEEC_PACKETS_MODE,
3670 +@@ -1934,6 +1943,17 @@ enum {
3671 + */
3672 + MLXSW_ITEM32(reg, qeec, pb, 0x0C, 28, 1);
3673 +
3674 ++/* The smallest permitted min shaper rate. */
3675 ++#define MLXSW_REG_QEEC_MIS_MIN 200000 /* Kbps */
3676 ++
3677 ++/* reg_qeec_min_shaper_rate
3678 ++ * Min shaper information rate.
3679 ++ * For CPU port, can only be configured for port hierarchy.
3680 ++ * When in bytes mode, value is specified in units of 1000bps.
3681 ++ * Access: RW
3682 ++ */
3683 ++MLXSW_ITEM32(reg, qeec, min_shaper_rate, 0x0C, 0, 28);
3684 ++
3685 + /* reg_qeec_mase
3686 + * Max shaper configuration enable. Enables configuration of the max
3687 + * shaper on this ETS element.
3688 +diff --git a/drivers/net/ethernet/natsemi/sonic.c b/drivers/net/ethernet/natsemi/sonic.c
3689 +index 23821540ab07..a051dddcbd76 100644
3690 +--- a/drivers/net/ethernet/natsemi/sonic.c
3691 ++++ b/drivers/net/ethernet/natsemi/sonic.c
3692 +@@ -221,9 +221,9 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
3693 +
3694 + laddr = dma_map_single(lp->device, skb->data, length, DMA_TO_DEVICE);
3695 + if (!laddr) {
3696 +- printk(KERN_ERR "%s: failed to map tx DMA buffer.\n", dev->name);
3697 +- dev_kfree_skb(skb);
3698 +- return NETDEV_TX_BUSY;
3699 ++ pr_err_ratelimited("%s: failed to map tx DMA buffer.\n", dev->name);
3700 ++ dev_kfree_skb_any(skb);
3701 ++ return NETDEV_TX_OK;
3702 + }
3703 +
3704 + sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */
3705 +diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
3706 +index 2f4a837f0d6a..dcd56ac68748 100644
3707 +--- a/drivers/net/ethernet/pasemi/pasemi_mac.c
3708 ++++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
3709 +@@ -1053,7 +1053,6 @@ static int pasemi_mac_phy_init(struct net_device *dev)
3710 +
3711 + dn = pci_device_to_OF_node(mac->pdev);
3712 + phy_dn = of_parse_phandle(dn, "phy-handle", 0);
3713 +- of_node_put(phy_dn);
3714 +
3715 + mac->link = 0;
3716 + mac->speed = 0;
3717 +@@ -1062,6 +1061,7 @@ static int pasemi_mac_phy_init(struct net_device *dev)
3718 + phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0,
3719 + PHY_INTERFACE_MODE_SGMII);
3720 +
3721 ++ of_node_put(phy_dn);
3722 + if (!phydev) {
3723 + printk(KERN_ERR "%s: Could not attach to phy\n", dev->name);
3724 + return -ENODEV;
3725 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c
3726 +index 715776e2cfe5..2d198f6ee21d 100644
3727 +--- a/drivers/net/ethernet/qlogic/qed/qed_l2.c
3728 ++++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c
3729 +@@ -1328,10 +1328,9 @@ static void __qed_get_vport_pstats_addrlen(struct qed_hwfn *p_hwfn,
3730 + }
3731 + }
3732 +
3733 +-static void __qed_get_vport_pstats(struct qed_hwfn *p_hwfn,
3734 +- struct qed_ptt *p_ptt,
3735 +- struct qed_eth_stats *p_stats,
3736 +- u16 statistics_bin)
3737 ++static noinline_for_stack void
3738 ++__qed_get_vport_pstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
3739 ++ struct qed_eth_stats *p_stats, u16 statistics_bin)
3740 + {
3741 + struct eth_pstorm_per_queue_stat pstats;
3742 + u32 pstats_addr = 0, pstats_len = 0;
3743 +@@ -1351,10 +1350,9 @@ static void __qed_get_vport_pstats(struct qed_hwfn *p_hwfn,
3744 + p_stats->tx_err_drop_pkts += HILO_64_REGPAIR(pstats.error_drop_pkts);
3745 + }
3746 +
3747 +-static void __qed_get_vport_tstats(struct qed_hwfn *p_hwfn,
3748 +- struct qed_ptt *p_ptt,
3749 +- struct qed_eth_stats *p_stats,
3750 +- u16 statistics_bin)
3751 ++static noinline_for_stack void
3752 ++__qed_get_vport_tstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
3753 ++ struct qed_eth_stats *p_stats, u16 statistics_bin)
3754 + {
3755 + struct tstorm_per_port_stat tstats;
3756 + u32 tstats_addr, tstats_len;
3757 +@@ -1397,10 +1395,9 @@ static void __qed_get_vport_ustats_addrlen(struct qed_hwfn *p_hwfn,
3758 + }
3759 + }
3760 +
3761 +-static void __qed_get_vport_ustats(struct qed_hwfn *p_hwfn,
3762 +- struct qed_ptt *p_ptt,
3763 +- struct qed_eth_stats *p_stats,
3764 +- u16 statistics_bin)
3765 ++static noinline_for_stack
3766 ++void __qed_get_vport_ustats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
3767 ++ struct qed_eth_stats *p_stats, u16 statistics_bin)
3768 + {
3769 + struct eth_ustorm_per_queue_stat ustats;
3770 + u32 ustats_addr = 0, ustats_len = 0;
3771 +@@ -1436,10 +1433,9 @@ static void __qed_get_vport_mstats_addrlen(struct qed_hwfn *p_hwfn,
3772 + }
3773 + }
3774 +
3775 +-static void __qed_get_vport_mstats(struct qed_hwfn *p_hwfn,
3776 +- struct qed_ptt *p_ptt,
3777 +- struct qed_eth_stats *p_stats,
3778 +- u16 statistics_bin)
3779 ++static noinline_for_stack void
3780 ++__qed_get_vport_mstats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
3781 ++ struct qed_eth_stats *p_stats, u16 statistics_bin)
3782 + {
3783 + struct eth_mstorm_per_queue_stat mstats;
3784 + u32 mstats_addr = 0, mstats_len = 0;
3785 +@@ -1463,9 +1459,9 @@ static void __qed_get_vport_mstats(struct qed_hwfn *p_hwfn,
3786 + HILO_64_REGPAIR(mstats.tpa_coalesced_bytes);
3787 + }
3788 +
3789 +-static void __qed_get_vport_port_stats(struct qed_hwfn *p_hwfn,
3790 +- struct qed_ptt *p_ptt,
3791 +- struct qed_eth_stats *p_stats)
3792 ++static noinline_for_stack void
3793 ++__qed_get_vport_port_stats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
3794 ++ struct qed_eth_stats *p_stats)
3795 + {
3796 + struct port_stats port_stats;
3797 + int j;
3798 +diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
3799 +index 21f546587e3d..31583d6f044f 100644
3800 +--- a/drivers/net/ethernet/qualcomm/qca_spi.c
3801 ++++ b/drivers/net/ethernet/qualcomm/qca_spi.c
3802 +@@ -438,7 +438,6 @@ qcaspi_qca7k_sync(struct qcaspi *qca, int event)
3803 + u16 signature = 0;
3804 + u16 spi_config;
3805 + u16 wrbuf_space = 0;
3806 +- static u16 reset_count;
3807 +
3808 + if (event == QCASPI_EVENT_CPUON) {
3809 + /* Read signature twice, if not valid
3810 +@@ -491,13 +490,13 @@ qcaspi_qca7k_sync(struct qcaspi *qca, int event)
3811 +
3812 + qca->sync = QCASPI_SYNC_RESET;
3813 + qca->stats.trig_reset++;
3814 +- reset_count = 0;
3815 ++ qca->reset_count = 0;
3816 + break;
3817 + case QCASPI_SYNC_RESET:
3818 +- reset_count++;
3819 ++ qca->reset_count++;
3820 + netdev_dbg(qca->net_dev, "sync: waiting for CPU on, count %u.\n",
3821 +- reset_count);
3822 +- if (reset_count >= QCASPI_RESET_TIMEOUT) {
3823 ++ qca->reset_count);
3824 ++ if (qca->reset_count >= QCASPI_RESET_TIMEOUT) {
3825 + /* reset did not seem to take place, try again */
3826 + qca->sync = QCASPI_SYNC_UNKNOWN;
3827 + qca->stats.reset_timeout++;
3828 +diff --git a/drivers/net/ethernet/qualcomm/qca_spi.h b/drivers/net/ethernet/qualcomm/qca_spi.h
3829 +index 6e31a0e744a4..c48c314ca4df 100644
3830 +--- a/drivers/net/ethernet/qualcomm/qca_spi.h
3831 ++++ b/drivers/net/ethernet/qualcomm/qca_spi.h
3832 +@@ -97,6 +97,7 @@ struct qcaspi {
3833 +
3834 + unsigned int intr_req;
3835 + unsigned int intr_svc;
3836 ++ u16 reset_count;
3837 +
3838 + #ifdef CONFIG_DEBUG_FS
3839 + struct dentry *device_root;
3840 +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
3841 +index 49300194d3f9..6f8d4810ce97 100644
3842 +--- a/drivers/net/ethernet/renesas/sh_eth.c
3843 ++++ b/drivers/net/ethernet/renesas/sh_eth.c
3844 +@@ -2929,12 +2929,16 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
3845 + struct device_node *np = dev->of_node;
3846 + struct sh_eth_plat_data *pdata;
3847 + const char *mac_addr;
3848 ++ int ret;
3849 +
3850 + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
3851 + if (!pdata)
3852 + return NULL;
3853 +
3854 +- pdata->phy_interface = of_get_phy_mode(np);
3855 ++ ret = of_get_phy_mode(np);
3856 ++ if (ret < 0)
3857 ++ return NULL;
3858 ++ pdata->phy_interface = ret;
3859 +
3860 + mac_addr = of_get_mac_address(np);
3861 + if (mac_addr)
3862 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
3863 +index 866444b6c82f..11a4a81b0397 100644
3864 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
3865 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
3866 +@@ -203,7 +203,7 @@ static int ipq806x_gmac_of_parse(struct ipq806x_gmac *gmac)
3867 + struct device *dev = &gmac->pdev->dev;
3868 +
3869 + gmac->phy_mode = of_get_phy_mode(dev->of_node);
3870 +- if (gmac->phy_mode < 0) {
3871 ++ if ((int)gmac->phy_mode < 0) {
3872 + dev_err(dev, "missing phy mode property\n");
3873 + return -EINVAL;
3874 + }
3875 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
3876 +index f356a44bcb81..6704d3e0392d 100644
3877 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
3878 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
3879 +@@ -280,7 +280,7 @@ static int meson8b_dwmac_probe(struct platform_device *pdev)
3880 +
3881 + dwmac->pdev = pdev;
3882 + dwmac->phy_mode = of_get_phy_mode(pdev->dev.of_node);
3883 +- if (dwmac->phy_mode < 0) {
3884 ++ if ((int)dwmac->phy_mode < 0) {
3885 + dev_err(&pdev->dev, "missing phy-mode property\n");
3886 + ret = -EINVAL;
3887 + goto err_remove_config_dt;
3888 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
3889 +index f46f2bfc2cc0..4216c0a5eaf5 100644
3890 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
3891 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
3892 +@@ -168,7 +168,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
3893 + }
3894 +
3895 + /* Handle multiple unicast addresses */
3896 +- if (netdev_uc_count(dev) > GMAC_MAX_PERFECT_ADDRESSES) {
3897 ++ if (netdev_uc_count(dev) > hw->unicast_filter_entries) {
3898 + /* Switch to promiscuous mode if more than 128 addrs
3899 + * are required
3900 + */
3901 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
3902 +index 3eb281d1db08..231330809037 100644
3903 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
3904 ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
3905 +@@ -158,7 +158,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp,
3906 + /* structure describing a PTP hardware clock */
3907 + static struct ptp_clock_info stmmac_ptp_clock_ops = {
3908 + .owner = THIS_MODULE,
3909 +- .name = "stmmac_ptp_clock",
3910 ++ .name = "stmmac ptp",
3911 + .max_adj = 62500000,
3912 + .n_alarm = 0,
3913 + .n_ext_ts = 0,
3914 +diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
3915 +index c2898718b593..5077c69eb652 100644
3916 +--- a/drivers/net/gtp.c
3917 ++++ b/drivers/net/gtp.c
3918 +@@ -836,7 +836,9 @@ static int gtp_encap_enable(struct net_device *dev, struct gtp_dev *gtp,
3919 + return -ENOENT;
3920 + }
3921 +
3922 +- if (sock0->sk->sk_protocol != IPPROTO_UDP) {
3923 ++ if (sock0->sk->sk_protocol != IPPROTO_UDP ||
3924 ++ sock0->sk->sk_type != SOCK_DGRAM ||
3925 ++ (sock0->sk->sk_family != AF_INET && sock0->sk->sk_family != AF_INET6)) {
3926 + netdev_dbg(dev, "socket fd=%d not UDP\n", fd_gtp0);
3927 + err = -EINVAL;
3928 + goto err1;
3929 +diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
3930 +index eb5167210681..3ab2eb677a59 100644
3931 +--- a/drivers/net/phy/fixed_phy.c
3932 ++++ b/drivers/net/phy/fixed_phy.c
3933 +@@ -67,11 +67,11 @@ static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num)
3934 + do {
3935 + s = read_seqcount_begin(&fp->seqcount);
3936 + /* Issue callback if user registered it. */
3937 +- if (fp->link_update) {
3938 ++ if (fp->link_update)
3939 + fp->link_update(fp->phydev->attached_dev,
3940 + &fp->status);
3941 +- fixed_phy_update(fp);
3942 +- }
3943 ++ /* Check the GPIO for change in status */
3944 ++ fixed_phy_update(fp);
3945 + state = fp->status;
3946 + } while (read_seqcount_retry(&fp->seqcount, s));
3947 +
3948 +diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
3949 +index 5fde8e335f13..82a4487bc66e 100644
3950 +--- a/drivers/net/phy/phy.c
3951 ++++ b/drivers/net/phy/phy.c
3952 +@@ -463,7 +463,8 @@ int phy_ethtool_ksettings_get(struct phy_device *phydev,
3953 + cmd->base.port = PORT_BNC;
3954 + else
3955 + cmd->base.port = PORT_MII;
3956 +-
3957 ++ cmd->base.transceiver = phy_is_internal(phydev) ?
3958 ++ XCVR_INTERNAL : XCVR_EXTERNAL;
3959 + cmd->base.phy_address = phydev->mdio.addr;
3960 + cmd->base.autoneg = phydev->autoneg;
3961 + cmd->base.eth_tp_mdix_ctrl = phydev->mdix;
3962 +diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
3963 +index 3289fd910c4a..487d0372a444 100644
3964 +--- a/drivers/net/phy/phy_device.c
3965 ++++ b/drivers/net/phy/phy_device.c
3966 +@@ -80,7 +80,7 @@ static LIST_HEAD(phy_fixup_list);
3967 + static DEFINE_MUTEX(phy_fixup_lock);
3968 +
3969 + #ifdef CONFIG_PM
3970 +-static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
3971 ++static bool mdio_bus_phy_may_suspend(struct phy_device *phydev, bool suspend)
3972 + {
3973 + struct device_driver *drv = phydev->mdio.dev.driver;
3974 + struct phy_driver *phydrv = to_phy_driver(drv);
3975 +@@ -92,10 +92,11 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
3976 + /* PHY not attached? May suspend if the PHY has not already been
3977 + * suspended as part of a prior call to phy_disconnect() ->
3978 + * phy_detach() -> phy_suspend() because the parent netdev might be the
3979 +- * MDIO bus driver and clock gated at this point.
3980 ++ * MDIO bus driver and clock gated at this point. Also may resume if
3981 ++ * PHY is not attached.
3982 + */
3983 + if (!netdev)
3984 +- return !phydev->suspended;
3985 ++ return suspend ? !phydev->suspended : phydev->suspended;
3986 +
3987 + /* Don't suspend PHY if the attached netdev parent may wakeup.
3988 + * The parent may point to a PCI device, as in tg3 driver.
3989 +@@ -125,7 +126,7 @@ static int mdio_bus_phy_suspend(struct device *dev)
3990 + if (phydev->attached_dev && phydev->adjust_link)
3991 + phy_stop_machine(phydev);
3992 +
3993 +- if (!mdio_bus_phy_may_suspend(phydev))
3994 ++ if (!mdio_bus_phy_may_suspend(phydev, true))
3995 + return 0;
3996 +
3997 + return phy_suspend(phydev);
3998 +@@ -136,7 +137,7 @@ static int mdio_bus_phy_resume(struct device *dev)
3999 + struct phy_device *phydev = to_phy_device(dev);
4000 + int ret;
4001 +
4002 +- if (!mdio_bus_phy_may_suspend(phydev))
4003 ++ if (!mdio_bus_phy_may_suspend(phydev, false))
4004 + goto no_resume;
4005 +
4006 + ret = phy_resume(phydev);
4007 +diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
4008 +index 7ec96c3e38a6..2af09c3851a5 100644
4009 +--- a/drivers/net/slip/slip.c
4010 ++++ b/drivers/net/slip/slip.c
4011 +@@ -452,9 +452,16 @@ static void slip_transmit(struct work_struct *work)
4012 + */
4013 + static void slip_write_wakeup(struct tty_struct *tty)
4014 + {
4015 +- struct slip *sl = tty->disc_data;
4016 ++ struct slip *sl;
4017 ++
4018 ++ rcu_read_lock();
4019 ++ sl = rcu_dereference(tty->disc_data);
4020 ++ if (!sl)
4021 ++ goto out;
4022 +
4023 + schedule_work(&sl->tx_work);
4024 ++out:
4025 ++ rcu_read_unlock();
4026 + }
4027 +
4028 + static void sl_tx_timeout(struct net_device *dev)
4029 +@@ -887,10 +894,11 @@ static void slip_close(struct tty_struct *tty)
4030 + return;
4031 +
4032 + spin_lock_bh(&sl->lock);
4033 +- tty->disc_data = NULL;
4034 ++ rcu_assign_pointer(tty->disc_data, NULL);
4035 + sl->tty = NULL;
4036 + spin_unlock_bh(&sl->lock);
4037 +
4038 ++ synchronize_rcu();
4039 + flush_work(&sl->tx_work);
4040 +
4041 + /* VSV = very important to remove timers */
4042 +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
4043 +index 473dd79e167b..65e94dffaabc 100644
4044 +--- a/drivers/net/usb/lan78xx.c
4045 ++++ b/drivers/net/usb/lan78xx.c
4046 +@@ -30,6 +30,7 @@
4047 + #include <linux/ipv6.h>
4048 + #include <linux/mdio.h>
4049 + #include <net/ip6_checksum.h>
4050 ++#include <net/vxlan.h>
4051 + #include <linux/microchipphy.h>
4052 + #include <linux/of_net.h>
4053 + #include "lan78xx.h"
4054 +@@ -3291,6 +3292,19 @@ static void lan78xx_tx_timeout(struct net_device *net)
4055 + tasklet_schedule(&dev->bh);
4056 + }
4057 +
4058 ++static netdev_features_t lan78xx_features_check(struct sk_buff *skb,
4059 ++ struct net_device *netdev,
4060 ++ netdev_features_t features)
4061 ++{
4062 ++ if (skb->len + TX_OVERHEAD > MAX_SINGLE_PACKET_SIZE)
4063 ++ features &= ~NETIF_F_GSO_MASK;
4064 ++
4065 ++ features = vlan_features_check(skb, features);
4066 ++ features = vxlan_features_check(skb, features);
4067 ++
4068 ++ return features;
4069 ++}
4070 ++
4071 + static const struct net_device_ops lan78xx_netdev_ops = {
4072 + .ndo_open = lan78xx_open,
4073 + .ndo_stop = lan78xx_stop,
4074 +@@ -3304,6 +3318,7 @@ static const struct net_device_ops lan78xx_netdev_ops = {
4075 + .ndo_set_features = lan78xx_set_features,
4076 + .ndo_vlan_rx_add_vid = lan78xx_vlan_rx_add_vid,
4077 + .ndo_vlan_rx_kill_vid = lan78xx_vlan_rx_kill_vid,
4078 ++ .ndo_features_check = lan78xx_features_check,
4079 + };
4080 +
4081 + static void lan78xx_stat_monitor(unsigned long param)
4082 +diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c
4083 +index 6e236a485431..71b4888b30e7 100644
4084 +--- a/drivers/net/wireless/ath/ath9k/dynack.c
4085 ++++ b/drivers/net/wireless/ath/ath9k/dynack.c
4086 +@@ -300,9 +300,9 @@ void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
4087 +
4088 + an->ackto = ackto;
4089 +
4090 +- spin_lock(&da->qlock);
4091 ++ spin_lock_bh(&da->qlock);
4092 + list_add_tail(&an->list, &da->nodes);
4093 +- spin_unlock(&da->qlock);
4094 ++ spin_unlock_bh(&da->qlock);
4095 + }
4096 + EXPORT_SYMBOL(ath_dynack_node_init);
4097 +
4098 +@@ -316,9 +316,9 @@ void ath_dynack_node_deinit(struct ath_hw *ah, struct ath_node *an)
4099 + {
4100 + struct ath_dynack *da = &ah->dynack;
4101 +
4102 +- spin_lock(&da->qlock);
4103 ++ spin_lock_bh(&da->qlock);
4104 + list_del(&an->list);
4105 +- spin_unlock(&da->qlock);
4106 ++ spin_unlock_bh(&da->qlock);
4107 + }
4108 + EXPORT_SYMBOL(ath_dynack_node_deinit);
4109 +
4110 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
4111 +index 2ec3a91a0f6b..bba7ace1a744 100644
4112 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
4113 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
4114 +@@ -106,12 +106,12 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)
4115 + int i;
4116 + struct iwl_rss_config_cmd cmd = {
4117 + .flags = cpu_to_le32(IWL_RSS_ENABLE),
4118 +- .hash_mask = IWL_RSS_HASH_TYPE_IPV4_TCP |
4119 +- IWL_RSS_HASH_TYPE_IPV4_UDP |
4120 +- IWL_RSS_HASH_TYPE_IPV4_PAYLOAD |
4121 +- IWL_RSS_HASH_TYPE_IPV6_TCP |
4122 +- IWL_RSS_HASH_TYPE_IPV6_UDP |
4123 +- IWL_RSS_HASH_TYPE_IPV6_PAYLOAD,
4124 ++ .hash_mask = BIT(IWL_RSS_HASH_TYPE_IPV4_TCP) |
4125 ++ BIT(IWL_RSS_HASH_TYPE_IPV4_UDP) |
4126 ++ BIT(IWL_RSS_HASH_TYPE_IPV4_PAYLOAD) |
4127 ++ BIT(IWL_RSS_HASH_TYPE_IPV6_TCP) |
4128 ++ BIT(IWL_RSS_HASH_TYPE_IPV6_UDP) |
4129 ++ BIT(IWL_RSS_HASH_TYPE_IPV6_PAYLOAD),
4130 + };
4131 +
4132 + if (mvm->trans->num_rx_queues == 1)
4133 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
4134 +index c2bbc8c17beb..bc06d87a0106 100644
4135 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
4136 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
4137 +@@ -810,12 +810,12 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
4138 + bool toggle_bit = phy_info & IWL_RX_MPDU_PHY_AMPDU_TOGGLE;
4139 +
4140 + rx_status->flag |= RX_FLAG_AMPDU_DETAILS;
4141 +- rx_status->ampdu_reference = mvm->ampdu_ref;
4142 + /* toggle is switched whenever new aggregation starts */
4143 + if (toggle_bit != mvm->ampdu_toggle) {
4144 + mvm->ampdu_ref++;
4145 + mvm->ampdu_toggle = toggle_bit;
4146 + }
4147 ++ rx_status->ampdu_reference = mvm->ampdu_ref;
4148 + }
4149 +
4150 + rcu_read_lock();
4151 +diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c
4152 +index 7ff2efadceca..3eab802c7d3f 100644
4153 +--- a/drivers/net/wireless/marvell/libertas/cfg.c
4154 ++++ b/drivers/net/wireless/marvell/libertas/cfg.c
4155 +@@ -272,6 +272,10 @@ add_ie_rates(u8 *tlv, const u8 *ie, int *nrates)
4156 + int hw, ap, ap_max = ie[1];
4157 + u8 hw_rate;
4158 +
4159 ++ if (ap_max > MAX_RATES) {
4160 ++ lbs_deb_assoc("invalid rates\n");
4161 ++ return tlv;
4162 ++ }
4163 + /* Advance past IE header */
4164 + ie += 2;
4165 +
4166 +@@ -1789,6 +1793,9 @@ static int lbs_ibss_join_existing(struct lbs_private *priv,
4167 + struct cmd_ds_802_11_ad_hoc_join cmd;
4168 + u8 preamble = RADIO_PREAMBLE_SHORT;
4169 + int ret = 0;
4170 ++ int hw, i;
4171 ++ u8 rates_max;
4172 ++ u8 *rates;
4173 +
4174 + lbs_deb_enter(LBS_DEB_CFG80211);
4175 +
4176 +@@ -1849,9 +1856,12 @@ static int lbs_ibss_join_existing(struct lbs_private *priv,
4177 + if (!rates_eid) {
4178 + lbs_add_rates(cmd.bss.rates);
4179 + } else {
4180 +- int hw, i;
4181 +- u8 rates_max = rates_eid[1];
4182 +- u8 *rates = cmd.bss.rates;
4183 ++ rates_max = rates_eid[1];
4184 ++ if (rates_max > MAX_RATES) {
4185 ++ lbs_deb_join("invalid rates");
4186 ++ goto out;
4187 ++ }
4188 ++ rates = cmd.bss.rates;
4189 + for (hw = 0; hw < ARRAY_SIZE(lbs_rates); hw++) {
4190 + u8 hw_rate = lbs_rates[hw].bitrate / 5;
4191 + for (i = 0; i < rates_max; i++) {
4192 +diff --git a/drivers/net/wireless/marvell/libertas_tf/cmd.c b/drivers/net/wireless/marvell/libertas_tf/cmd.c
4193 +index 909ac3685010..2b193f1257a5 100644
4194 +--- a/drivers/net/wireless/marvell/libertas_tf/cmd.c
4195 ++++ b/drivers/net/wireless/marvell/libertas_tf/cmd.c
4196 +@@ -69,7 +69,7 @@ static void lbtf_geo_init(struct lbtf_private *priv)
4197 + break;
4198 + }
4199 +
4200 +- for (ch = priv->range.start; ch < priv->range.end; ch++)
4201 ++ for (ch = range->start; ch < range->end; ch++)
4202 + priv->channels[CHAN_TO_IDX(ch)].flags = 0;
4203 + }
4204 +
4205 +diff --git a/drivers/net/wireless/mediatek/mt7601u/phy.c b/drivers/net/wireless/mediatek/mt7601u/phy.c
4206 +index ca09a5d4305e..71a47459bf8a 100644
4207 +--- a/drivers/net/wireless/mediatek/mt7601u/phy.c
4208 ++++ b/drivers/net/wireless/mediatek/mt7601u/phy.c
4209 +@@ -221,7 +221,7 @@ int mt7601u_wait_bbp_ready(struct mt7601u_dev *dev)
4210 +
4211 + do {
4212 + val = mt7601u_bbp_rr(dev, MT_BBP_REG_VERSION);
4213 +- if (val && ~val)
4214 ++ if (val && val != 0xff)
4215 + break;
4216 + } while (--i);
4217 +
4218 +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
4219 +index 1ac4cec5f4f7..e2bce9385eda 100644
4220 +--- a/drivers/nvme/host/pci.c
4221 ++++ b/drivers/nvme/host/pci.c
4222 +@@ -1863,7 +1863,7 @@ static int nvme_pci_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val)
4223 +
4224 + static int nvme_pci_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val)
4225 + {
4226 +- *val = readq(to_nvme_dev(ctrl)->bar + off);
4227 ++ *val = lo_hi_readq(to_nvme_dev(ctrl)->bar + off);
4228 + return 0;
4229 + }
4230 +
4231 +diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
4232 +index 262281bd68fa..1e70851b1530 100644
4233 +--- a/drivers/of/of_mdio.c
4234 ++++ b/drivers/of/of_mdio.c
4235 +@@ -353,7 +353,7 @@ struct phy_device *of_phy_get_and_connect(struct net_device *dev,
4236 + struct phy_device *phy;
4237 +
4238 + iface = of_get_phy_mode(np);
4239 +- if (iface < 0)
4240 ++ if ((int)iface < 0)
4241 + return NULL;
4242 +
4243 + phy_np = of_parse_phandle(np, "phy-handle", 0);
4244 +diff --git a/drivers/pinctrl/sh-pfc/pfc-emev2.c b/drivers/pinctrl/sh-pfc/pfc-emev2.c
4245 +index 1cbbe04d7df6..eafd8edbcbe9 100644
4246 +--- a/drivers/pinctrl/sh-pfc/pfc-emev2.c
4247 ++++ b/drivers/pinctrl/sh-pfc/pfc-emev2.c
4248 +@@ -1263,6 +1263,14 @@ static const char * const dtv_groups[] = {
4249 + "dtv_b",
4250 + };
4251 +
4252 ++static const char * const err_rst_reqb_groups[] = {
4253 ++ "err_rst_reqb",
4254 ++};
4255 ++
4256 ++static const char * const ext_clki_groups[] = {
4257 ++ "ext_clki",
4258 ++};
4259 ++
4260 + static const char * const iic0_groups[] = {
4261 + "iic0",
4262 + };
4263 +@@ -1285,6 +1293,10 @@ static const char * const lcd_groups[] = {
4264 + "yuv3",
4265 + };
4266 +
4267 ++static const char * const lowpwr_groups[] = {
4268 ++ "lowpwr",
4269 ++};
4270 ++
4271 + static const char * const ntsc_groups[] = {
4272 + "ntsc_clk",
4273 + "ntsc_data",
4274 +@@ -1298,6 +1310,10 @@ static const char * const pwm1_groups[] = {
4275 + "pwm1",
4276 + };
4277 +
4278 ++static const char * const ref_clko_groups[] = {
4279 ++ "ref_clko",
4280 ++};
4281 ++
4282 + static const char * const sd_groups[] = {
4283 + "sd_cki",
4284 + };
4285 +@@ -1391,13 +1407,17 @@ static const struct sh_pfc_function pinmux_functions[] = {
4286 + SH_PFC_FUNCTION(cam),
4287 + SH_PFC_FUNCTION(cf),
4288 + SH_PFC_FUNCTION(dtv),
4289 ++ SH_PFC_FUNCTION(err_rst_reqb),
4290 ++ SH_PFC_FUNCTION(ext_clki),
4291 + SH_PFC_FUNCTION(iic0),
4292 + SH_PFC_FUNCTION(iic1),
4293 + SH_PFC_FUNCTION(jtag),
4294 + SH_PFC_FUNCTION(lcd),
4295 ++ SH_PFC_FUNCTION(lowpwr),
4296 + SH_PFC_FUNCTION(ntsc),
4297 + SH_PFC_FUNCTION(pwm0),
4298 + SH_PFC_FUNCTION(pwm1),
4299 ++ SH_PFC_FUNCTION(ref_clko),
4300 + SH_PFC_FUNCTION(sd),
4301 + SH_PFC_FUNCTION(sdi0),
4302 + SH_PFC_FUNCTION(sdi1),
4303 +diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
4304 +index 35f436bcb849..e9739dbcb356 100644
4305 +--- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
4306 ++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
4307 +@@ -1982,7 +1982,7 @@ static const unsigned int gether_gmii_pins[] = {
4308 + */
4309 + 185, 186, 187, 188, 189, 190, 191, 192, 174, 161, 204,
4310 + 171, 170, 169, 168, 167, 166, 173, 172, 176, 184, 183, 203,
4311 +- 205, 163, 206, 207,
4312 ++ 205, 163, 206, 207, 158,
4313 + };
4314 + static const unsigned int gether_gmii_mux[] = {
4315 + ET_ERXD0_MARK, ET_ERXD1_MARK, ET_ERXD2_MARK, ET_ERXD3_MARK,
4316 +@@ -2154,6 +2154,7 @@ static const unsigned int lcd0_data24_1_mux[] = {
4317 + LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
4318 + LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
4319 + LCD0_D8_MARK, LCD0_D9_MARK, LCD0_D10_MARK, LCD0_D11_MARK,
4320 ++ LCD0_D12_MARK, LCD0_D13_MARK, LCD0_D14_MARK, LCD0_D15_MARK,
4321 + LCD0_D16_MARK, LCD0_D17_MARK, LCD0_D18_PORT163_MARK,
4322 + LCD0_D19_PORT162_MARK, LCD0_D20_PORT161_MARK, LCD0_D21_PORT158_MARK,
4323 + LCD0_D22_PORT160_MARK, LCD0_D23_PORT159_MARK,
4324 +diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
4325 +index baa98d7fe947..dd350e296142 100644
4326 +--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
4327 ++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
4328 +@@ -3136,8 +3136,7 @@ static const unsigned int qspi_data4_b_pins[] = {
4329 + RCAR_GP_PIN(6, 4),
4330 + };
4331 + static const unsigned int qspi_data4_b_mux[] = {
4332 +- SPCLK_B_MARK, MOSI_IO0_B_MARK, MISO_IO1_B_MARK,
4333 +- IO2_B_MARK, IO3_B_MARK, SSL_B_MARK,
4334 ++ MOSI_IO0_B_MARK, MISO_IO1_B_MARK, IO2_B_MARK, IO3_B_MARK,
4335 + };
4336 + /* - SCIF0 ------------------------------------------------------------------ */
4337 + static const unsigned int scif0_data_pins[] = {
4338 +@@ -4265,17 +4264,14 @@ static const unsigned int vin1_b_data18_pins[] = {
4339 + };
4340 + static const unsigned int vin1_b_data18_mux[] = {
4341 + /* B */
4342 +- VI1_DATA0_B_MARK, VI1_DATA1_B_MARK,
4343 + VI1_DATA2_B_MARK, VI1_DATA3_B_MARK,
4344 + VI1_DATA4_B_MARK, VI1_DATA5_B_MARK,
4345 + VI1_DATA6_B_MARK, VI1_DATA7_B_MARK,
4346 + /* G */
4347 +- VI1_G0_B_MARK, VI1_G1_B_MARK,
4348 + VI1_G2_B_MARK, VI1_G3_B_MARK,
4349 + VI1_G4_B_MARK, VI1_G5_B_MARK,
4350 + VI1_G6_B_MARK, VI1_G7_B_MARK,
4351 + /* R */
4352 +- VI1_R0_B_MARK, VI1_R1_B_MARK,
4353 + VI1_R2_B_MARK, VI1_R3_B_MARK,
4354 + VI1_R4_B_MARK, VI1_R5_B_MARK,
4355 + VI1_R6_B_MARK, VI1_R7_B_MARK,
4356 +@@ -5082,7 +5078,7 @@ static const char * const scifb2_groups[] = {
4357 + "scifb2_data_b",
4358 + "scifb2_clk_b",
4359 + "scifb2_ctrl_b",
4360 +- "scifb0_data_c",
4361 ++ "scifb2_data_c",
4362 + "scifb2_clk_c",
4363 + "scifb2_data_d",
4364 + };
4365 +diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7792.c b/drivers/pinctrl/sh-pfc/pfc-r8a7792.c
4366 +index 21badb6166b9..97998929db93 100644
4367 +--- a/drivers/pinctrl/sh-pfc/pfc-r8a7792.c
4368 ++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7792.c
4369 +@@ -1863,6 +1863,7 @@ static const char * const vin1_groups[] = {
4370 + "vin1_data8",
4371 + "vin1_data24_b",
4372 + "vin1_data20_b",
4373 ++ "vin1_data18_b",
4374 + "vin1_data16_b",
4375 + "vin1_sync",
4376 + "vin1_field",
4377 +diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
4378 +index ef093ac0cf2f..fe8c9c24634d 100644
4379 +--- a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
4380 ++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
4381 +@@ -4826,7 +4826,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
4382 + FN_AVB_MDC, FN_SSI_SDATA6_B, 0, 0, }
4383 + },
4384 + { PINMUX_CFG_REG_VAR("IPSR9", 0xE6060044, 32,
4385 +- 1, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3) {
4386 ++ 1, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3) {
4387 + /* IP9_31 [1] */
4388 + 0, 0,
4389 + /* IP9_30_28 [3] */
4390 +diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7269.c b/drivers/pinctrl/sh-pfc/pfc-sh7269.c
4391 +index a50d22bef1f4..cfdb4fc177c3 100644
4392 +--- a/drivers/pinctrl/sh-pfc/pfc-sh7269.c
4393 ++++ b/drivers/pinctrl/sh-pfc/pfc-sh7269.c
4394 +@@ -2119,7 +2119,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
4395 + },
4396 +
4397 + { PINMUX_CFG_REG("PCIOR0", 0xfffe3852, 16, 1) {
4398 +- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4399 ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4400 + PC8_IN, PC8_OUT,
4401 + PC7_IN, PC7_OUT,
4402 + PC6_IN, PC6_OUT,
4403 +diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
4404 +index d25e6f674d0a..6dca760f9f28 100644
4405 +--- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
4406 ++++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
4407 +@@ -3086,6 +3086,7 @@ static const unsigned int tpu4_to2_mux[] = {
4408 + };
4409 + static const unsigned int tpu4_to3_pins[] = {
4410 + /* TO */
4411 ++ PIN_NUMBER(6, 26),
4412 + };
4413 + static const unsigned int tpu4_to3_mux[] = {
4414 + TPU4TO3_MARK,
4415 +@@ -3366,7 +3367,8 @@ static const char * const fsic_groups[] = {
4416 + "fsic_sclk_out",
4417 + "fsic_data_in",
4418 + "fsic_data_out",
4419 +- "fsic_spdif",
4420 ++ "fsic_spdif_0",
4421 ++ "fsic_spdif_1",
4422 + };
4423 +
4424 + static const char * const fsid_groups[] = {
4425 +diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7734.c b/drivers/pinctrl/sh-pfc/pfc-sh7734.c
4426 +index 3eccc9b3ca84..c691e5e9d9de 100644
4427 +--- a/drivers/pinctrl/sh-pfc/pfc-sh7734.c
4428 ++++ b/drivers/pinctrl/sh-pfc/pfc-sh7734.c
4429 +@@ -2231,13 +2231,13 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
4430 + FN_LCD_CL1_B, 0, 0,
4431 + /* IP10_5_3 [3] */
4432 + FN_SSI_WS23, FN_VI1_5_B, FN_TX1_D, FN_HSCK0_C, FN_FALE_B,
4433 +- FN_LCD_DON_B, 0, 0, 0,
4434 ++ FN_LCD_DON_B, 0, 0,
4435 + /* IP10_2_0 [3] */
4436 + FN_SSI_SCK23, FN_VI1_4_B, FN_RX1_D, FN_FCLE_B,
4437 + FN_LCD_DATA15_B, 0, 0, 0 }
4438 + },
4439 + { PINMUX_CFG_REG_VAR("IPSR11", 0xFFFC0048, 32,
4440 +- 3, 1, 2, 2, 2, 3, 3, 1, 2, 3, 3, 1, 1, 1, 1) {
4441 ++ 3, 1, 2, 3, 2, 2, 3, 3, 1, 2, 3, 3, 1, 1, 1, 1) {
4442 + /* IP11_31_29 [3] */
4443 + 0, 0, 0, 0, 0, 0, 0, 0,
4444 + /* IP11_28 [1] */
4445 +diff --git a/drivers/platform/mips/cpu_hwmon.c b/drivers/platform/mips/cpu_hwmon.c
4446 +index 4300a558d0f3..d02214a3f8e3 100644
4447 +--- a/drivers/platform/mips/cpu_hwmon.c
4448 ++++ b/drivers/platform/mips/cpu_hwmon.c
4449 +@@ -155,7 +155,7 @@ static int __init loongson_hwmon_init(void)
4450 +
4451 + cpu_hwmon_dev = hwmon_device_register(NULL);
4452 + if (IS_ERR(cpu_hwmon_dev)) {
4453 +- ret = -ENOMEM;
4454 ++ ret = PTR_ERR(cpu_hwmon_dev);
4455 + pr_err("hwmon_device_register fail!\n");
4456 + goto fail_hwmon_device_register;
4457 + }
4458 +diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c
4459 +index fe419935041c..bee2115ecf10 100644
4460 +--- a/drivers/platform/x86/alienware-wmi.c
4461 ++++ b/drivers/platform/x86/alienware-wmi.c
4462 +@@ -570,7 +570,7 @@ static ssize_t show_hdmi_source(struct device *dev,
4463 + return scnprintf(buf, PAGE_SIZE,
4464 + "input [gpu] unknown\n");
4465 + }
4466 +- pr_err("alienware-wmi: unknown HDMI source status: %d\n", out_data);
4467 ++ pr_err("alienware-wmi: unknown HDMI source status: %u\n", status);
4468 + return scnprintf(buf, PAGE_SIZE, "input gpu [unknown]\n");
4469 + }
4470 +
4471 +diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
4472 +index 9e05ae0430a9..cb0b3d3d132f 100644
4473 +--- a/drivers/power/supply/power_supply_core.c
4474 ++++ b/drivers/power/supply/power_supply_core.c
4475 +@@ -764,14 +764,14 @@ __power_supply_register(struct device *parent,
4476 + }
4477 +
4478 + spin_lock_init(&psy->changed_lock);
4479 +- rc = device_init_wakeup(dev, ws);
4480 +- if (rc)
4481 +- goto wakeup_init_failed;
4482 +-
4483 + rc = device_add(dev);
4484 + if (rc)
4485 + goto device_add_failed;
4486 +
4487 ++ rc = device_init_wakeup(dev, ws);
4488 ++ if (rc)
4489 ++ goto wakeup_init_failed;
4490 ++
4491 + rc = psy_register_thermal(psy);
4492 + if (rc)
4493 + goto register_thermal_failed;
4494 +@@ -808,8 +808,8 @@ register_cooler_failed:
4495 + psy_unregister_thermal(psy);
4496 + register_thermal_failed:
4497 + device_del(dev);
4498 +-device_add_failed:
4499 + wakeup_init_failed:
4500 ++device_add_failed:
4501 + check_supplies_failed:
4502 + dev_set_name_failed:
4503 + put_device(dev);
4504 +diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c
4505 +index 5208b3f80ad8..239003807c08 100644
4506 +--- a/drivers/pwm/pwm-lpss.c
4507 ++++ b/drivers/pwm/pwm-lpss.c
4508 +@@ -205,6 +205,12 @@ EXPORT_SYMBOL_GPL(pwm_lpss_probe);
4509 +
4510 + int pwm_lpss_remove(struct pwm_lpss_chip *lpwm)
4511 + {
4512 ++ int i;
4513 ++
4514 ++ for (i = 0; i < lpwm->info->npwm; i++) {
4515 ++ if (pwm_is_enabled(&lpwm->chip.pwms[i]))
4516 ++ pm_runtime_put(lpwm->chip.dev);
4517 ++ }
4518 + return pwmchip_remove(&lpwm->chip);
4519 + }
4520 + EXPORT_SYMBOL_GPL(pwm_lpss_remove);
4521 +diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
4522 +index f58a4867b519..a196439ee14c 100644
4523 +--- a/drivers/pwm/pwm-meson.c
4524 ++++ b/drivers/pwm/pwm-meson.c
4525 +@@ -320,11 +320,6 @@ static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
4526 + if (state->period != channel->state.period ||
4527 + state->duty_cycle != channel->state.duty_cycle ||
4528 + state->polarity != channel->state.polarity) {
4529 +- if (channel->state.enabled) {
4530 +- meson_pwm_disable(meson, pwm->hwpwm);
4531 +- channel->state.enabled = false;
4532 +- }
4533 +-
4534 + if (state->polarity != channel->state.polarity) {
4535 + if (state->polarity == PWM_POLARITY_NORMAL)
4536 + meson->inverter_mask |= BIT(pwm->hwpwm);
4537 +diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c
4538 +index ef989a15aefc..b29fc258eeba 100644
4539 +--- a/drivers/rapidio/rio_cm.c
4540 ++++ b/drivers/rapidio/rio_cm.c
4541 +@@ -1215,7 +1215,9 @@ static int riocm_ch_listen(u16 ch_id)
4542 + riocm_debug(CHOP, "(ch_%d)", ch_id);
4543 +
4544 + ch = riocm_get_channel(ch_id);
4545 +- if (!ch || !riocm_cmp_exch(ch, RIO_CM_CHAN_BOUND, RIO_CM_LISTEN))
4546 ++ if (!ch)
4547 ++ return -EINVAL;
4548 ++ if (!riocm_cmp_exch(ch, RIO_CM_CHAN_BOUND, RIO_CM_LISTEN))
4549 + ret = -EINVAL;
4550 + riocm_put_channel(ch);
4551 + return ret;
4552 +diff --git a/drivers/regulator/pv88060-regulator.c b/drivers/regulator/pv88060-regulator.c
4553 +index 6c4afc73ecac..d229245d2b5e 100644
4554 +--- a/drivers/regulator/pv88060-regulator.c
4555 ++++ b/drivers/regulator/pv88060-regulator.c
4556 +@@ -135,7 +135,7 @@ static int pv88060_set_current_limit(struct regulator_dev *rdev, int min,
4557 + int i;
4558 +
4559 + /* search for closest to maximum */
4560 +- for (i = info->n_current_limits; i >= 0; i--) {
4561 ++ for (i = info->n_current_limits - 1; i >= 0; i--) {
4562 + if (min <= info->current_limits[i]
4563 + && max >= info->current_limits[i]) {
4564 + return regmap_update_bits(rdev->regmap,
4565 +diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88080-regulator.c
4566 +index 954a20eeb26f..a40ecfb77210 100644
4567 +--- a/drivers/regulator/pv88080-regulator.c
4568 ++++ b/drivers/regulator/pv88080-regulator.c
4569 +@@ -279,7 +279,7 @@ static int pv88080_set_current_limit(struct regulator_dev *rdev, int min,
4570 + int i;
4571 +
4572 + /* search for closest to maximum */
4573 +- for (i = info->n_current_limits; i >= 0; i--) {
4574 ++ for (i = info->n_current_limits - 1; i >= 0; i--) {
4575 + if (min <= info->current_limits[i]
4576 + && max >= info->current_limits[i]) {
4577 + return regmap_update_bits(rdev->regmap,
4578 +diff --git a/drivers/regulator/pv88090-regulator.c b/drivers/regulator/pv88090-regulator.c
4579 +index 421641175352..789652c9b014 100644
4580 +--- a/drivers/regulator/pv88090-regulator.c
4581 ++++ b/drivers/regulator/pv88090-regulator.c
4582 +@@ -157,7 +157,7 @@ static int pv88090_set_current_limit(struct regulator_dev *rdev, int min,
4583 + int i;
4584 +
4585 + /* search for closest to maximum */
4586 +- for (i = info->n_current_limits; i >= 0; i--) {
4587 ++ for (i = info->n_current_limits - 1; i >= 0; i--) {
4588 + if (min <= info->current_limits[i]
4589 + && max >= info->current_limits[i]) {
4590 + return regmap_update_bits(rdev->regmap,
4591 +diff --git a/drivers/regulator/tps65086-regulator.c b/drivers/regulator/tps65086-regulator.c
4592 +index 6dbf3cf3951e..12d26261394f 100644
4593 +--- a/drivers/regulator/tps65086-regulator.c
4594 ++++ b/drivers/regulator/tps65086-regulator.c
4595 +@@ -89,8 +89,8 @@ static const struct regulator_linear_range tps65086_buck345_25mv_ranges[] = {
4596 + static const struct regulator_linear_range tps65086_ldoa1_ranges[] = {
4597 + REGULATOR_LINEAR_RANGE(1350000, 0x0, 0x0, 0),
4598 + REGULATOR_LINEAR_RANGE(1500000, 0x1, 0x7, 100000),
4599 +- REGULATOR_LINEAR_RANGE(2300000, 0x8, 0xA, 100000),
4600 +- REGULATOR_LINEAR_RANGE(2700000, 0xB, 0xD, 150000),
4601 ++ REGULATOR_LINEAR_RANGE(2300000, 0x8, 0xB, 100000),
4602 ++ REGULATOR_LINEAR_RANGE(2850000, 0xC, 0xD, 150000),
4603 + REGULATOR_LINEAR_RANGE(3300000, 0xE, 0xE, 0),
4604 + };
4605 +
4606 +diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
4607 +index 5a5bc4bb08d2..df591435d12a 100644
4608 +--- a/drivers/regulator/wm831x-dcdc.c
4609 ++++ b/drivers/regulator/wm831x-dcdc.c
4610 +@@ -327,8 +327,8 @@ static int wm831x_buckv_get_voltage_sel(struct regulator_dev *rdev)
4611 + }
4612 +
4613 + /* Current limit options */
4614 +-static u16 wm831x_dcdc_ilim[] = {
4615 +- 125, 250, 375, 500, 625, 750, 875, 1000
4616 ++static const unsigned int wm831x_dcdc_ilim[] = {
4617 ++ 125000, 250000, 375000, 500000, 625000, 750000, 875000, 1000000
4618 + };
4619 +
4620 + static int wm831x_buckv_set_current_limit(struct regulator_dev *rdev,
4621 +diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c
4622 +index 466bf7f9a285..7da2a1fb50f8 100644
4623 +--- a/drivers/rtc/rtc-88pm80x.c
4624 ++++ b/drivers/rtc/rtc-88pm80x.c
4625 +@@ -116,12 +116,14 @@ static int pm80x_rtc_read_time(struct device *dev, struct rtc_time *tm)
4626 + unsigned char buf[4];
4627 + unsigned long ticks, base, data;
4628 + regmap_raw_read(info->map, PM800_RTC_EXPIRE2_1, buf, 4);
4629 +- base = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4630 ++ base = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4631 ++ (buf[1] << 8) | buf[0];
4632 + dev_dbg(info->dev, "%x-%x-%x-%x\n", buf[0], buf[1], buf[2], buf[3]);
4633 +
4634 + /* load 32-bit read-only counter */
4635 + regmap_raw_read(info->map, PM800_RTC_COUNTER1, buf, 4);
4636 +- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4637 ++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4638 ++ (buf[1] << 8) | buf[0];
4639 + ticks = base + data;
4640 + dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n",
4641 + base, data, ticks);
4642 +@@ -144,7 +146,8 @@ static int pm80x_rtc_set_time(struct device *dev, struct rtc_time *tm)
4643 +
4644 + /* load 32-bit read-only counter */
4645 + regmap_raw_read(info->map, PM800_RTC_COUNTER1, buf, 4);
4646 +- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4647 ++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4648 ++ (buf[1] << 8) | buf[0];
4649 + base = ticks - data;
4650 + dev_dbg(info->dev, "set base:0x%lx, RO count:0x%lx, ticks:0x%lx\n",
4651 + base, data, ticks);
4652 +@@ -165,11 +168,13 @@ static int pm80x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
4653 + int ret;
4654 +
4655 + regmap_raw_read(info->map, PM800_RTC_EXPIRE2_1, buf, 4);
4656 +- base = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4657 ++ base = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4658 ++ (buf[1] << 8) | buf[0];
4659 + dev_dbg(info->dev, "%x-%x-%x-%x\n", buf[0], buf[1], buf[2], buf[3]);
4660 +
4661 + regmap_raw_read(info->map, PM800_RTC_EXPIRE1_1, buf, 4);
4662 +- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4663 ++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4664 ++ (buf[1] << 8) | buf[0];
4665 + ticks = base + data;
4666 + dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n",
4667 + base, data, ticks);
4668 +@@ -192,12 +197,14 @@ static int pm80x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
4669 + regmap_update_bits(info->map, PM800_RTC_CONTROL, PM800_ALARM1_EN, 0);
4670 +
4671 + regmap_raw_read(info->map, PM800_RTC_EXPIRE2_1, buf, 4);
4672 +- base = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4673 ++ base = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4674 ++ (buf[1] << 8) | buf[0];
4675 + dev_dbg(info->dev, "%x-%x-%x-%x\n", buf[0], buf[1], buf[2], buf[3]);
4676 +
4677 + /* load 32-bit read-only counter */
4678 + regmap_raw_read(info->map, PM800_RTC_COUNTER1, buf, 4);
4679 +- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4680 ++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4681 ++ (buf[1] << 8) | buf[0];
4682 + ticks = base + data;
4683 + dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n",
4684 + base, data, ticks);
4685 +diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c
4686 +index 166faae3a59c..7d3e5168fcef 100644
4687 +--- a/drivers/rtc/rtc-88pm860x.c
4688 ++++ b/drivers/rtc/rtc-88pm860x.c
4689 +@@ -115,11 +115,13 @@ static int pm860x_rtc_read_time(struct device *dev, struct rtc_time *tm)
4690 + pm860x_page_bulk_read(info->i2c, REG0_ADDR, 8, buf);
4691 + dev_dbg(info->dev, "%x-%x-%x-%x-%x-%x-%x-%x\n", buf[0], buf[1],
4692 + buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
4693 +- base = (buf[1] << 24) | (buf[3] << 16) | (buf[5] << 8) | buf[7];
4694 ++ base = ((unsigned long)buf[1] << 24) | (buf[3] << 16) |
4695 ++ (buf[5] << 8) | buf[7];
4696 +
4697 + /* load 32-bit read-only counter */
4698 + pm860x_bulk_read(info->i2c, PM8607_RTC_COUNTER1, 4, buf);
4699 +- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4700 ++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4701 ++ (buf[1] << 8) | buf[0];
4702 + ticks = base + data;
4703 + dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n",
4704 + base, data, ticks);
4705 +@@ -145,7 +147,8 @@ static int pm860x_rtc_set_time(struct device *dev, struct rtc_time *tm)
4706 +
4707 + /* load 32-bit read-only counter */
4708 + pm860x_bulk_read(info->i2c, PM8607_RTC_COUNTER1, 4, buf);
4709 +- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4710 ++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4711 ++ (buf[1] << 8) | buf[0];
4712 + base = ticks - data;
4713 + dev_dbg(info->dev, "set base:0x%lx, RO count:0x%lx, ticks:0x%lx\n",
4714 + base, data, ticks);
4715 +@@ -170,10 +173,12 @@ static int pm860x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
4716 + pm860x_page_bulk_read(info->i2c, REG0_ADDR, 8, buf);
4717 + dev_dbg(info->dev, "%x-%x-%x-%x-%x-%x-%x-%x\n", buf[0], buf[1],
4718 + buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
4719 +- base = (buf[1] << 24) | (buf[3] << 16) | (buf[5] << 8) | buf[7];
4720 ++ base = ((unsigned long)buf[1] << 24) | (buf[3] << 16) |
4721 ++ (buf[5] << 8) | buf[7];
4722 +
4723 + pm860x_bulk_read(info->i2c, PM8607_RTC_EXPIRE1, 4, buf);
4724 +- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4725 ++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4726 ++ (buf[1] << 8) | buf[0];
4727 + ticks = base + data;
4728 + dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n",
4729 + base, data, ticks);
4730 +@@ -198,11 +203,13 @@ static int pm860x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
4731 + pm860x_page_bulk_read(info->i2c, REG0_ADDR, 8, buf);
4732 + dev_dbg(info->dev, "%x-%x-%x-%x-%x-%x-%x-%x\n", buf[0], buf[1],
4733 + buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
4734 +- base = (buf[1] << 24) | (buf[3] << 16) | (buf[5] << 8) | buf[7];
4735 ++ base = ((unsigned long)buf[1] << 24) | (buf[3] << 16) |
4736 ++ (buf[5] << 8) | buf[7];
4737 +
4738 + /* load 32-bit read-only counter */
4739 + pm860x_bulk_read(info->i2c, PM8607_RTC_COUNTER1, 4, buf);
4740 +- data = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4741 ++ data = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4742 ++ (buf[1] << 8) | buf[0];
4743 + ticks = base + data;
4744 + dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n",
4745 + base, data, ticks);
4746 +diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c
4747 +index 5c18ac7394c4..c911f2db0af5 100644
4748 +--- a/drivers/rtc/rtc-ds1672.c
4749 ++++ b/drivers/rtc/rtc-ds1672.c
4750 +@@ -58,7 +58,8 @@ static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm)
4751 + "%s: raw read data - counters=%02x,%02x,%02x,%02x\n",
4752 + __func__, buf[0], buf[1], buf[2], buf[3]);
4753 +
4754 +- time = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
4755 ++ time = ((unsigned long)buf[3] << 24) | (buf[2] << 16) |
4756 ++ (buf[1] << 8) | buf[0];
4757 +
4758 + rtc_time_to_tm(time, tm);
4759 +
4760 +diff --git a/drivers/rtc/rtc-mc146818-lib.c b/drivers/rtc/rtc-mc146818-lib.c
4761 +index 2f1772a358ca..18a6f15e313d 100644
4762 +--- a/drivers/rtc/rtc-mc146818-lib.c
4763 ++++ b/drivers/rtc/rtc-mc146818-lib.c
4764 +@@ -82,7 +82,7 @@ unsigned int mc146818_get_time(struct rtc_time *time)
4765 + time->tm_year += real_year - 72;
4766 + #endif
4767 +
4768 +- if (century)
4769 ++ if (century > 20)
4770 + time->tm_year += (century - 19) * 100;
4771 +
4772 + /*
4773 +diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
4774 +index a4b8b603c807..533fb7027f0c 100644
4775 +--- a/drivers/rtc/rtc-pcf8563.c
4776 ++++ b/drivers/rtc/rtc-pcf8563.c
4777 +@@ -563,7 +563,6 @@ static int pcf8563_probe(struct i2c_client *client,
4778 + struct pcf8563 *pcf8563;
4779 + int err;
4780 + unsigned char buf;
4781 +- unsigned char alm_pending;
4782 +
4783 + dev_dbg(&client->dev, "%s\n", __func__);
4784 +
4785 +@@ -587,13 +586,13 @@ static int pcf8563_probe(struct i2c_client *client,
4786 + return err;
4787 + }
4788 +
4789 +- err = pcf8563_get_alarm_mode(client, NULL, &alm_pending);
4790 +- if (err) {
4791 +- dev_err(&client->dev, "%s: read error\n", __func__);
4792 ++ /* Clear flags and disable interrupts */
4793 ++ buf = 0;
4794 ++ err = pcf8563_write_block_data(client, PCF8563_REG_ST2, 1, &buf);
4795 ++ if (err < 0) {
4796 ++ dev_err(&client->dev, "%s: write error\n", __func__);
4797 + return err;
4798 + }
4799 +- if (alm_pending)
4800 +- pcf8563_set_alarm_mode(client, 0);
4801 +
4802 + pcf8563->rtc = devm_rtc_device_register(&client->dev,
4803 + pcf8563_driver.driver.name,
4804 +diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
4805 +index fac835530671..a1b4b0ed1f19 100644
4806 +--- a/drivers/rtc/rtc-pm8xxx.c
4807 ++++ b/drivers/rtc/rtc-pm8xxx.c
4808 +@@ -186,7 +186,8 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)
4809 + }
4810 + }
4811 +
4812 +- secs = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24);
4813 ++ secs = value[0] | (value[1] << 8) | (value[2] << 16) |
4814 ++ ((unsigned long)value[3] << 24);
4815 +
4816 + rtc_time_to_tm(secs, tm);
4817 +
4818 +@@ -267,7 +268,8 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
4819 + return rc;
4820 + }
4821 +
4822 +- secs = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24);
4823 ++ secs = value[0] | (value[1] << 8) | (value[2] << 16) |
4824 ++ ((unsigned long)value[3] << 24);
4825 +
4826 + rtc_time_to_tm(secs, &alarm->time);
4827 +
4828 +diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
4829 +index 16ca31ad5ec0..d0a86ef80652 100644
4830 +--- a/drivers/scsi/libfc/fc_exch.c
4831 ++++ b/drivers/scsi/libfc/fc_exch.c
4832 +@@ -2506,7 +2506,7 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp)
4833 +
4834 + /* lport lock ? */
4835 + if (!lport || lport->state == LPORT_ST_DISABLED) {
4836 +- FC_LPORT_DBG(lport, "Receiving frames for an lport that "
4837 ++ FC_LIBFC_DBG("Receiving frames for an lport that "
4838 + "has not been initialized correctly\n");
4839 + fc_frame_free(fp);
4840 + return;
4841 +diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
4842 +index c5cc002dfdd5..10ae624dd266 100644
4843 +--- a/drivers/scsi/megaraid/megaraid_sas_base.c
4844 ++++ b/drivers/scsi/megaraid/megaraid_sas_base.c
4845 +@@ -3694,12 +3694,12 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
4846 + /*
4847 + * The cur_state should not last for more than max_wait secs
4848 + */
4849 +- for (i = 0; i < max_wait; i++) {
4850 ++ for (i = 0; i < max_wait * 50; i++) {
4851 + curr_abs_state = instance->instancet->
4852 + read_fw_status_reg(instance->reg_set);
4853 +
4854 + if (abs_state == curr_abs_state) {
4855 +- msleep(1000);
4856 ++ msleep(20);
4857 + } else
4858 + break;
4859 + }
4860 +diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
4861 +index 3bae56b202f8..e730aabc26d0 100644
4862 +--- a/drivers/scsi/qla2xxx/qla_os.c
4863 ++++ b/drivers/scsi/qla2xxx/qla_os.c
4864 +@@ -6055,8 +6055,7 @@ qla2x00_module_init(void)
4865 + /* Initialize target kmem_cache and mem_pools */
4866 + ret = qlt_init();
4867 + if (ret < 0) {
4868 +- kmem_cache_destroy(srb_cachep);
4869 +- return ret;
4870 ++ goto destroy_cache;
4871 + } else if (ret > 0) {
4872 + /*
4873 + * If initiator mode is explictly disabled by qlt_init(),
4874 +@@ -6075,11 +6074,10 @@ qla2x00_module_init(void)
4875 + qla2xxx_transport_template =
4876 + fc_attach_transport(&qla2xxx_transport_functions);
4877 + if (!qla2xxx_transport_template) {
4878 +- kmem_cache_destroy(srb_cachep);
4879 + ql_log(ql_log_fatal, NULL, 0x0002,
4880 + "fc_attach_transport failed...Failing load!.\n");
4881 +- qlt_exit();
4882 +- return -ENODEV;
4883 ++ ret = -ENODEV;
4884 ++ goto qlt_exit;
4885 + }
4886 +
4887 + apidev_major = register_chrdev(0, QLA2XXX_APIDEV, &apidev_fops);
4888 +@@ -6091,27 +6089,37 @@ qla2x00_module_init(void)
4889 + qla2xxx_transport_vport_template =
4890 + fc_attach_transport(&qla2xxx_transport_vport_functions);
4891 + if (!qla2xxx_transport_vport_template) {
4892 +- kmem_cache_destroy(srb_cachep);
4893 +- qlt_exit();
4894 +- fc_release_transport(qla2xxx_transport_template);
4895 + ql_log(ql_log_fatal, NULL, 0x0004,
4896 + "fc_attach_transport vport failed...Failing load!.\n");
4897 +- return -ENODEV;
4898 ++ ret = -ENODEV;
4899 ++ goto unreg_chrdev;
4900 + }
4901 + ql_log(ql_log_info, NULL, 0x0005,
4902 + "QLogic Fibre Channel HBA Driver: %s.\n",
4903 + qla2x00_version_str);
4904 + ret = pci_register_driver(&qla2xxx_pci_driver);
4905 + if (ret) {
4906 +- kmem_cache_destroy(srb_cachep);
4907 +- qlt_exit();
4908 +- fc_release_transport(qla2xxx_transport_template);
4909 +- fc_release_transport(qla2xxx_transport_vport_template);
4910 + ql_log(ql_log_fatal, NULL, 0x0006,
4911 + "pci_register_driver failed...ret=%d Failing load!.\n",
4912 + ret);
4913 ++ goto release_vport_transport;
4914 + }
4915 + return ret;
4916 ++
4917 ++release_vport_transport:
4918 ++ fc_release_transport(qla2xxx_transport_vport_template);
4919 ++
4920 ++unreg_chrdev:
4921 ++ if (apidev_major >= 0)
4922 ++ unregister_chrdev(apidev_major, QLA2XXX_APIDEV);
4923 ++ fc_release_transport(qla2xxx_transport_template);
4924 ++
4925 ++qlt_exit:
4926 ++ qlt_exit();
4927 ++
4928 ++destroy_cache:
4929 ++ kmem_cache_destroy(srb_cachep);
4930 ++ return ret;
4931 + }
4932 +
4933 + /**
4934 +diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
4935 +index c39551b32e94..ab7bc4e63425 100644
4936 +--- a/drivers/scsi/scsi_transport_iscsi.c
4937 ++++ b/drivers/scsi/scsi_transport_iscsi.c
4938 +@@ -37,6 +37,8 @@
4939 +
4940 + #define ISCSI_TRANSPORT_VERSION "2.0-870"
4941 +
4942 ++#define ISCSI_SEND_MAX_ALLOWED 10
4943 ++
4944 + static int dbg_session;
4945 + module_param_named(debug_session, dbg_session, int,
4946 + S_IRUGO | S_IWUSR);
4947 +@@ -3694,6 +3696,7 @@ iscsi_if_rx(struct sk_buff *skb)
4948 + struct nlmsghdr *nlh;
4949 + struct iscsi_uevent *ev;
4950 + uint32_t group;
4951 ++ int retries = ISCSI_SEND_MAX_ALLOWED;
4952 +
4953 + nlh = nlmsg_hdr(skb);
4954 + if (nlh->nlmsg_len < sizeof(*nlh) + sizeof(*ev) ||
4955 +@@ -3724,6 +3727,10 @@ iscsi_if_rx(struct sk_buff *skb)
4956 + break;
4957 + err = iscsi_if_send_reply(group, nlh->nlmsg_seq,
4958 + nlh->nlmsg_type, 0, 0, ev, sizeof(*ev));
4959 ++ if (err == -EAGAIN && --retries < 0) {
4960 ++ printk(KERN_WARNING "Send reply failed, error %d\n", err);
4961 ++ break;
4962 ++ }
4963 + } while (err < 0 && err != -ECONNREFUSED && err != -ESRCH);
4964 + skb_pull(skb, rlen);
4965 + }
4966 +diff --git a/drivers/soc/fsl/qe/gpio.c b/drivers/soc/fsl/qe/gpio.c
4967 +index 0aaf429f31d5..b5a7107a9c0a 100644
4968 +--- a/drivers/soc/fsl/qe/gpio.c
4969 ++++ b/drivers/soc/fsl/qe/gpio.c
4970 +@@ -152,8 +152,10 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
4971 + if (err < 0)
4972 + goto err0;
4973 + gc = gpio_to_chip(err);
4974 +- if (WARN_ON(!gc))
4975 ++ if (WARN_ON(!gc)) {
4976 ++ err = -ENODEV;
4977 + goto err0;
4978 ++ }
4979 +
4980 + if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) {
4981 + pr_debug("%s: tried to get a non-qe pin\n", __func__);
4982 +diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c
4983 +index 5c89bbb05441..e075712c501e 100644
4984 +--- a/drivers/spi/spi-bcm2835aux.c
4985 ++++ b/drivers/spi/spi-bcm2835aux.c
4986 +@@ -416,7 +416,18 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
4987 + platform_set_drvdata(pdev, master);
4988 + master->mode_bits = (SPI_CPOL | SPI_CS_HIGH | SPI_NO_CS);
4989 + master->bits_per_word_mask = SPI_BPW_MASK(8);
4990 +- master->num_chipselect = -1;
4991 ++ /* even though the driver never officially supported native CS
4992 ++ * allow a single native CS for legacy DT support purposes when
4993 ++ * no cs-gpio is configured.
4994 ++ * Known limitations for native cs are:
4995 ++ * * multiple chip-selects: cs0-cs2 are all simultaniously asserted
4996 ++ * whenever there is a transfer - this even includes SPI_NO_CS
4997 ++ * * SPI_CS_HIGH: is ignores - cs are always asserted low
4998 ++ * * cs_change: cs is deasserted after each spi_transfer
4999 ++ * * cs_delay_usec: cs is always deasserted one SCK cycle after
5000 ++ * a spi_transfer
5001 ++ */
5002 ++ master->num_chipselect = 1;
5003 + master->transfer_one = bcm2835aux_spi_transfer_one;
5004 + master->handle_err = bcm2835aux_spi_handle_err;
5005 + master->prepare_message = bcm2835aux_spi_prepare_message;
5006 +diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
5007 +index 8b290d9d7935..5419de19859a 100644
5008 +--- a/drivers/spi/spi-fsl-spi.c
5009 ++++ b/drivers/spi/spi-fsl-spi.c
5010 +@@ -408,7 +408,6 @@ static int fsl_spi_do_one_msg(struct spi_master *master,
5011 + }
5012 +
5013 + m->status = status;
5014 +- spi_finalize_current_message(master);
5015 +
5016 + if (status || !cs_change) {
5017 + ndelay(nsecs);
5018 +@@ -416,6 +415,7 @@ static int fsl_spi_do_one_msg(struct spi_master *master,
5019 + }
5020 +
5021 + fsl_spi_setup_transfer(spi, NULL);
5022 ++ spi_finalize_current_message(master);
5023 + return 0;
5024 + }
5025 +
5026 +diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
5027 +index 705f515863d4..e37712bed0b2 100644
5028 +--- a/drivers/spi/spi-tegra114.c
5029 ++++ b/drivers/spi/spi-tegra114.c
5030 +@@ -307,10 +307,16 @@ static unsigned tegra_spi_fill_tx_fifo_from_client_txbuf(
5031 + x |= (u32)(*tx_buf++) << (i * 8);
5032 + tegra_spi_writel(tspi, x, SPI_TX_FIFO);
5033 + }
5034 ++
5035 ++ tspi->cur_tx_pos += written_words * tspi->bytes_per_word;
5036 + } else {
5037 ++ unsigned int write_bytes;
5038 + max_n_32bit = min(tspi->curr_dma_words, tx_empty_count);
5039 + written_words = max_n_32bit;
5040 + nbytes = written_words * tspi->bytes_per_word;
5041 ++ if (nbytes > t->len - tspi->cur_pos)
5042 ++ nbytes = t->len - tspi->cur_pos;
5043 ++ write_bytes = nbytes;
5044 + for (count = 0; count < max_n_32bit; count++) {
5045 + u32 x = 0;
5046 +
5047 +@@ -319,8 +325,10 @@ static unsigned tegra_spi_fill_tx_fifo_from_client_txbuf(
5048 + x |= (u32)(*tx_buf++) << (i * 8);
5049 + tegra_spi_writel(tspi, x, SPI_TX_FIFO);
5050 + }
5051 ++
5052 ++ tspi->cur_tx_pos += write_bytes;
5053 + }
5054 +- tspi->cur_tx_pos += written_words * tspi->bytes_per_word;
5055 ++
5056 + return written_words;
5057 + }
5058 +
5059 +@@ -344,20 +352,27 @@ static unsigned int tegra_spi_read_rx_fifo_to_client_rxbuf(
5060 + for (i = 0; len && (i < 4); i++, len--)
5061 + *rx_buf++ = (x >> i*8) & 0xFF;
5062 + }
5063 +- tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word;
5064 + read_words += tspi->curr_dma_words;
5065 ++ tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word;
5066 + } else {
5067 + u32 rx_mask = ((u32)1 << t->bits_per_word) - 1;
5068 ++ u8 bytes_per_word = tspi->bytes_per_word;
5069 ++ unsigned int read_bytes;
5070 +
5071 ++ len = rx_full_count * bytes_per_word;
5072 ++ if (len > t->len - tspi->cur_pos)
5073 ++ len = t->len - tspi->cur_pos;
5074 ++ read_bytes = len;
5075 + for (count = 0; count < rx_full_count; count++) {
5076 + u32 x = tegra_spi_readl(tspi, SPI_RX_FIFO) & rx_mask;
5077 +
5078 +- for (i = 0; (i < tspi->bytes_per_word); i++)
5079 ++ for (i = 0; len && (i < bytes_per_word); i++, len--)
5080 + *rx_buf++ = (x >> (i*8)) & 0xFF;
5081 + }
5082 +- tspi->cur_rx_pos += rx_full_count * tspi->bytes_per_word;
5083 + read_words += rx_full_count;
5084 ++ tspi->cur_rx_pos += read_bytes;
5085 + }
5086 ++
5087 + return read_words;
5088 + }
5089 +
5090 +@@ -372,12 +387,17 @@ static void tegra_spi_copy_client_txbuf_to_spi_txbuf(
5091 + unsigned len = tspi->curr_dma_words * tspi->bytes_per_word;
5092 +
5093 + memcpy(tspi->tx_dma_buf, t->tx_buf + tspi->cur_pos, len);
5094 ++ tspi->cur_tx_pos += tspi->curr_dma_words * tspi->bytes_per_word;
5095 + } else {
5096 + unsigned int i;
5097 + unsigned int count;
5098 + u8 *tx_buf = (u8 *)t->tx_buf + tspi->cur_tx_pos;
5099 + unsigned consume = tspi->curr_dma_words * tspi->bytes_per_word;
5100 ++ unsigned int write_bytes;
5101 +
5102 ++ if (consume > t->len - tspi->cur_pos)
5103 ++ consume = t->len - tspi->cur_pos;
5104 ++ write_bytes = consume;
5105 + for (count = 0; count < tspi->curr_dma_words; count++) {
5106 + u32 x = 0;
5107 +
5108 +@@ -386,8 +406,9 @@ static void tegra_spi_copy_client_txbuf_to_spi_txbuf(
5109 + x |= (u32)(*tx_buf++) << (i * 8);
5110 + tspi->tx_dma_buf[count] = x;
5111 + }
5112 ++
5113 ++ tspi->cur_tx_pos += write_bytes;
5114 + }
5115 +- tspi->cur_tx_pos += tspi->curr_dma_words * tspi->bytes_per_word;
5116 +
5117 + /* Make the dma buffer to read by dma */
5118 + dma_sync_single_for_device(tspi->dev, tspi->tx_dma_phys,
5119 +@@ -405,20 +426,28 @@ static void tegra_spi_copy_spi_rxbuf_to_client_rxbuf(
5120 + unsigned len = tspi->curr_dma_words * tspi->bytes_per_word;
5121 +
5122 + memcpy(t->rx_buf + tspi->cur_rx_pos, tspi->rx_dma_buf, len);
5123 ++ tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word;
5124 + } else {
5125 + unsigned int i;
5126 + unsigned int count;
5127 + unsigned char *rx_buf = t->rx_buf + tspi->cur_rx_pos;
5128 + u32 rx_mask = ((u32)1 << t->bits_per_word) - 1;
5129 ++ unsigned consume = tspi->curr_dma_words * tspi->bytes_per_word;
5130 ++ unsigned int read_bytes;
5131 +
5132 ++ if (consume > t->len - tspi->cur_pos)
5133 ++ consume = t->len - tspi->cur_pos;
5134 ++ read_bytes = consume;
5135 + for (count = 0; count < tspi->curr_dma_words; count++) {
5136 + u32 x = tspi->rx_dma_buf[count] & rx_mask;
5137 +
5138 +- for (i = 0; (i < tspi->bytes_per_word); i++)
5139 ++ for (i = 0; consume && (i < tspi->bytes_per_word);
5140 ++ i++, consume--)
5141 + *rx_buf++ = (x >> (i*8)) & 0xFF;
5142 + }
5143 ++
5144 ++ tspi->cur_rx_pos += read_bytes;
5145 + }
5146 +- tspi->cur_rx_pos += tspi->curr_dma_words * tspi->bytes_per_word;
5147 +
5148 + /* Make the dma buffer to read by dma */
5149 + dma_sync_single_for_device(tspi->dev, tspi->rx_dma_phys,
5150 +@@ -730,6 +759,8 @@ static int tegra_spi_start_transfer_one(struct spi_device *spi,
5151 +
5152 + if (tspi->is_packed)
5153 + command1 |= SPI_PACKED;
5154 ++ else
5155 ++ command1 &= ~SPI_PACKED;
5156 +
5157 + command1 &= ~(SPI_CS_SEL_MASK | SPI_TX_EN | SPI_RX_EN);
5158 + tspi->cur_direction = 0;
5159 +diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
5160 +index fe03a41dc5cf..12056eb3cbe8 100644
5161 +--- a/drivers/staging/comedi/drivers/ni_mio_common.c
5162 ++++ b/drivers/staging/comedi/drivers/ni_mio_common.c
5163 +@@ -4945,7 +4945,10 @@ static int ni_valid_rtsi_output_source(struct comedi_device *dev,
5164 + case NI_RTSI_OUTPUT_G_SRC0:
5165 + case NI_RTSI_OUTPUT_G_GATE0:
5166 + case NI_RTSI_OUTPUT_RGOUT0:
5167 +- case NI_RTSI_OUTPUT_RTSI_BRD_0:
5168 ++ case NI_RTSI_OUTPUT_RTSI_BRD(0):
5169 ++ case NI_RTSI_OUTPUT_RTSI_BRD(1):
5170 ++ case NI_RTSI_OUTPUT_RTSI_BRD(2):
5171 ++ case NI_RTSI_OUTPUT_RTSI_BRD(3):
5172 + return 1;
5173 + case NI_RTSI_OUTPUT_RTSI_OSC:
5174 + return (devpriv->is_m_series) ? 1 : 0;
5175 +@@ -4966,11 +4969,18 @@ static int ni_set_rtsi_routing(struct comedi_device *dev,
5176 + devpriv->rtsi_trig_a_output_reg |= NISTC_RTSI_TRIG(chan, src);
5177 + ni_stc_writew(dev, devpriv->rtsi_trig_a_output_reg,
5178 + NISTC_RTSI_TRIGA_OUT_REG);
5179 +- } else if (chan < 8) {
5180 ++ } else if (chan < NISTC_RTSI_TRIG_NUM_CHAN(devpriv->is_m_series)) {
5181 + devpriv->rtsi_trig_b_output_reg &= ~NISTC_RTSI_TRIG_MASK(chan);
5182 + devpriv->rtsi_trig_b_output_reg |= NISTC_RTSI_TRIG(chan, src);
5183 + ni_stc_writew(dev, devpriv->rtsi_trig_b_output_reg,
5184 + NISTC_RTSI_TRIGB_OUT_REG);
5185 ++ } else if (chan != NISTC_RTSI_TRIG_OLD_CLK_CHAN) {
5186 ++ /* probably should never reach this, since the
5187 ++ * ni_valid_rtsi_output_source above errors out if chan is too
5188 ++ * high
5189 ++ */
5190 ++ dev_err(dev->class_dev, "%s: unknown rtsi channel\n", __func__);
5191 ++ return -EINVAL;
5192 + }
5193 + return 2;
5194 + }
5195 +@@ -4986,12 +4996,12 @@ static unsigned int ni_get_rtsi_routing(struct comedi_device *dev,
5196 + } else if (chan < NISTC_RTSI_TRIG_NUM_CHAN(devpriv->is_m_series)) {
5197 + return NISTC_RTSI_TRIG_TO_SRC(chan,
5198 + devpriv->rtsi_trig_b_output_reg);
5199 +- } else {
5200 +- if (chan == NISTC_RTSI_TRIG_OLD_CLK_CHAN)
5201 +- return NI_RTSI_OUTPUT_RTSI_OSC;
5202 +- dev_err(dev->class_dev, "bug! should never get here?\n");
5203 +- return 0;
5204 ++ } else if (chan == NISTC_RTSI_TRIG_OLD_CLK_CHAN) {
5205 ++ return NI_RTSI_OUTPUT_RTSI_OSC;
5206 + }
5207 ++
5208 ++ dev_err(dev->class_dev, "%s: unknown rtsi channel\n", __func__);
5209 ++ return -EINVAL;
5210 + }
5211 +
5212 + static int ni_rtsi_insn_config(struct comedi_device *dev,
5213 +diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
5214 +index 9f01427f35f9..1cb82cc28aa7 100644
5215 +--- a/drivers/staging/greybus/light.c
5216 ++++ b/drivers/staging/greybus/light.c
5217 +@@ -1102,21 +1102,21 @@ static void gb_lights_channel_release(struct gb_channel *channel)
5218 + static void gb_lights_light_release(struct gb_light *light)
5219 + {
5220 + int i;
5221 +- int count;
5222 +
5223 + light->ready = false;
5224 +
5225 +- count = light->channels_count;
5226 +-
5227 + if (light->has_flash)
5228 + gb_lights_light_v4l2_unregister(light);
5229 ++ light->has_flash = false;
5230 +
5231 +- for (i = 0; i < count; i++) {
5232 ++ for (i = 0; i < light->channels_count; i++)
5233 + gb_lights_channel_release(&light->channels[i]);
5234 +- light->channels_count--;
5235 +- }
5236 ++ light->channels_count = 0;
5237 ++
5238 + kfree(light->channels);
5239 ++ light->channels = NULL;
5240 + kfree(light->name);
5241 ++ light->name = NULL;
5242 + }
5243 +
5244 + static void gb_lights_release(struct gb_lights *glights)
5245 +diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
5246 +index 7f51024dc5eb..e87b9ed4f37d 100644
5247 +--- a/drivers/staging/most/aim-cdev/cdev.c
5248 ++++ b/drivers/staging/most/aim-cdev/cdev.c
5249 +@@ -451,7 +451,9 @@ static int aim_probe(struct most_interface *iface, int channel_id,
5250 + c->devno = MKDEV(major, current_minor);
5251 + cdev_init(&c->cdev, &channel_fops);
5252 + c->cdev.owner = THIS_MODULE;
5253 +- cdev_add(&c->cdev, c->devno, 1);
5254 ++ retval = cdev_add(&c->cdev, c->devno, 1);
5255 ++ if (retval < 0)
5256 ++ goto err_free_c;
5257 + c->iface = iface;
5258 + c->cfg = cfg;
5259 + c->channel_id = channel_id;
5260 +@@ -487,6 +489,7 @@ error_create_device:
5261 + list_del(&c->list);
5262 + error_alloc_kfifo:
5263 + cdev_del(&c->cdev);
5264 ++err_free_c:
5265 + kfree(c);
5266 + error_alloc_channel:
5267 + ida_simple_remove(&minor_id, current_minor);
5268 +diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
5269 +index e5674e5857bf..9636d8744347 100644
5270 +--- a/drivers/target/iscsi/iscsi_target.c
5271 ++++ b/drivers/target/iscsi/iscsi_target.c
5272 +@@ -4162,9 +4162,6 @@ int iscsit_close_connection(
5273 + iscsit_stop_nopin_response_timer(conn);
5274 + iscsit_stop_nopin_timer(conn);
5275 +
5276 +- if (conn->conn_transport->iscsit_wait_conn)
5277 +- conn->conn_transport->iscsit_wait_conn(conn);
5278 +-
5279 + /*
5280 + * During Connection recovery drop unacknowledged out of order
5281 + * commands for this connection, and prepare the other commands
5282 +@@ -4250,6 +4247,9 @@ int iscsit_close_connection(
5283 + target_sess_cmd_list_set_waiting(sess->se_sess);
5284 + target_wait_for_sess_cmds(sess->se_sess);
5285 +
5286 ++ if (conn->conn_transport->iscsit_wait_conn)
5287 ++ conn->conn_transport->iscsit_wait_conn(conn);
5288 ++
5289 + ahash_request_free(conn->conn_tx_hash);
5290 + if (conn->conn_rx_hash) {
5291 + struct crypto_ahash *tfm;
5292 +diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
5293 +index f49d2989d000..984e5f514140 100644
5294 +--- a/drivers/thermal/cpu_cooling.c
5295 ++++ b/drivers/thermal/cpu_cooling.c
5296 +@@ -607,7 +607,7 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
5297 + load = 0;
5298 +
5299 + total_load += load;
5300 +- if (trace_thermal_power_cpu_limit_enabled() && load_cpu)
5301 ++ if (load_cpu)
5302 + load_cpu[i] = load;
5303 +
5304 + i++;
5305 +diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
5306 +index 34169c32d495..ea9558679634 100644
5307 +--- a/drivers/thermal/mtk_thermal.c
5308 ++++ b/drivers/thermal/mtk_thermal.c
5309 +@@ -348,7 +348,8 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
5310 + u32 raw;
5311 +
5312 + for (i = 0; i < conf->bank_data[bank->id].num_sensors; i++) {
5313 +- raw = readl(mt->thermal_base + conf->msr[i]);
5314 ++ raw = readl(mt->thermal_base +
5315 ++ conf->msr[conf->bank_data[bank->id].sensors[i]]);
5316 +
5317 + temp = raw_to_mcelsius(mt,
5318 + conf->bank_data[bank->id].sensors[i],
5319 +@@ -485,7 +486,8 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num,
5320 +
5321 + for (i = 0; i < conf->bank_data[num].num_sensors; i++)
5322 + writel(conf->sensor_mux_values[conf->bank_data[num].sensors[i]],
5323 +- mt->thermal_base + conf->adcpnp[i]);
5324 ++ mt->thermal_base +
5325 ++ conf->adcpnp[conf->bank_data[num].sensors[i]]);
5326 +
5327 + writel((1 << conf->bank_data[num].num_sensors) - 1,
5328 + mt->thermal_base + TEMP_MONCTL0);
5329 +diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
5330 +index df0204b6148f..4417f7568422 100644
5331 +--- a/drivers/tty/ipwireless/hardware.c
5332 ++++ b/drivers/tty/ipwireless/hardware.c
5333 +@@ -1515,6 +1515,8 @@ static void ipw_send_setup_packet(struct ipw_hardware *hw)
5334 + sizeof(struct ipw_setup_get_version_query_packet),
5335 + ADDR_SETUP_PROT, TL_PROTOCOLID_SETUP,
5336 + TL_SETUP_SIGNO_GET_VERSION_QRY);
5337 ++ if (!ver_packet)
5338 ++ return;
5339 + ver_packet->header.length = sizeof(struct tl_setup_get_version_qry);
5340 +
5341 + /*
5342 +diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
5343 +index 033856287ca2..ea8b591dd46f 100644
5344 +--- a/drivers/tty/serial/stm32-usart.c
5345 ++++ b/drivers/tty/serial/stm32-usart.c
5346 +@@ -293,13 +293,8 @@ static void stm32_transmit_chars(struct uart_port *port)
5347 + return;
5348 + }
5349 +
5350 +- if (uart_tx_stopped(port)) {
5351 +- stm32_stop_tx(port);
5352 +- return;
5353 +- }
5354 +-
5355 +- if (uart_circ_empty(xmit)) {
5356 +- stm32_stop_tx(port);
5357 ++ if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
5358 ++ stm32_clr_bits(port, ofs->cr1, USART_CR1_TXEIE);
5359 + return;
5360 + }
5361 +
5362 +@@ -312,7 +307,7 @@ static void stm32_transmit_chars(struct uart_port *port)
5363 + uart_write_wakeup(port);
5364 +
5365 + if (uart_circ_empty(xmit))
5366 +- stm32_stop_tx(port);
5367 ++ stm32_clr_bits(port, ofs->cr1, USART_CR1_TXEIE);
5368 + }
5369 +
5370 + static irqreturn_t stm32_interrupt(int irq, void *ptr)
5371 +diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
5372 +index 217a479165e0..09337a973335 100644
5373 +--- a/drivers/usb/class/cdc-wdm.c
5374 ++++ b/drivers/usb/class/cdc-wdm.c
5375 +@@ -1098,7 +1098,7 @@ static int wdm_post_reset(struct usb_interface *intf)
5376 + rv = recover_from_urb_loss(desc);
5377 + mutex_unlock(&desc->wlock);
5378 + mutex_unlock(&desc->rlock);
5379 +- return 0;
5380 ++ return rv;
5381 + }
5382 +
5383 + static struct usb_driver wdm_driver = {
5384 +diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
5385 +index 5cf5f3d9c1e5..04d36fa60734 100644
5386 +--- a/drivers/usb/host/xhci-hub.c
5387 ++++ b/drivers/usb/host/xhci-hub.c
5388 +@@ -989,7 +989,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
5389 + }
5390 + port_li = readl(port_array[wIndex] + PORTLI);
5391 + status = xhci_get_ext_port_status(temp, port_li);
5392 +- put_unaligned_le32(cpu_to_le32(status), &buf[4]);
5393 ++ put_unaligned_le32(status, &buf[4]);
5394 + }
5395 + break;
5396 + case SetPortFeature:
5397 +diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
5398 +index 19ce615455c1..de70e70d02be 100644
5399 +--- a/drivers/usb/phy/Kconfig
5400 ++++ b/drivers/usb/phy/Kconfig
5401 +@@ -19,7 +19,7 @@ config AB8500_USB
5402 + in host mode, low speed.
5403 +
5404 + config FSL_USB2_OTG
5405 +- bool "Freescale USB OTG Transceiver Driver"
5406 ++ tristate "Freescale USB OTG Transceiver Driver"
5407 + depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM=y && PM
5408 + depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
5409 + select USB_PHY
5410 +diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c
5411 +index a72e8d670adc..cf0b67433ac9 100644
5412 +--- a/drivers/usb/phy/phy-twl6030-usb.c
5413 ++++ b/drivers/usb/phy/phy-twl6030-usb.c
5414 +@@ -422,7 +422,7 @@ static int twl6030_usb_remove(struct platform_device *pdev)
5415 + {
5416 + struct twl6030_usb *twl = platform_get_drvdata(pdev);
5417 +
5418 +- cancel_delayed_work(&twl->get_status_work);
5419 ++ cancel_delayed_work_sync(&twl->get_status_work);
5420 + twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
5421 + REG_INT_MSK_LINE_C);
5422 + twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
5423 +diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
5424 +index da3f0ed18c76..c94167d87178 100644
5425 +--- a/drivers/vfio/pci/vfio_pci.c
5426 ++++ b/drivers/vfio/pci/vfio_pci.c
5427 +@@ -729,6 +729,7 @@ static long vfio_pci_ioctl(void *device_data,
5428 + {
5429 + void __iomem *io;
5430 + size_t size;
5431 ++ u16 orig_cmd;
5432 +
5433 + info.offset = VFIO_PCI_INDEX_TO_OFFSET(info.index);
5434 + info.flags = 0;
5435 +@@ -744,15 +745,23 @@ static long vfio_pci_ioctl(void *device_data,
5436 + break;
5437 + }
5438 +
5439 +- /* Is it really there? */
5440 ++ /*
5441 ++ * Is it really there? Enable memory decode for
5442 ++ * implicit access in pci_map_rom().
5443 ++ */
5444 ++ pci_read_config_word(pdev, PCI_COMMAND, &orig_cmd);
5445 ++ pci_write_config_word(pdev, PCI_COMMAND,
5446 ++ orig_cmd | PCI_COMMAND_MEMORY);
5447 ++
5448 + io = pci_map_rom(pdev, &size);
5449 +- if (!io || !size) {
5450 ++ if (io) {
5451 ++ info.flags = VFIO_REGION_INFO_FLAG_READ;
5452 ++ pci_unmap_rom(pdev, io);
5453 ++ } else {
5454 + info.size = 0;
5455 +- break;
5456 + }
5457 +- pci_unmap_rom(pdev, io);
5458 +
5459 +- info.flags = VFIO_REGION_INFO_FLAG_READ;
5460 ++ pci_write_config_word(pdev, PCI_COMMAND, orig_cmd);
5461 + break;
5462 + }
5463 + case VFIO_PCI_VGA_REGION_INDEX:
5464 +diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
5465 +index 60d6c2ac87aa..1771220b2437 100644
5466 +--- a/drivers/video/backlight/lm3630a_bl.c
5467 ++++ b/drivers/video/backlight/lm3630a_bl.c
5468 +@@ -200,7 +200,7 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)
5469 + LM3630A_LEDA_ENABLE, LM3630A_LEDA_ENABLE);
5470 + if (ret < 0)
5471 + goto out_i2c_err;
5472 +- return bl->props.brightness;
5473 ++ return 0;
5474 +
5475 + out_i2c_err:
5476 + dev_err(pchip->dev, "i2c failed to access\n");
5477 +@@ -277,7 +277,7 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
5478 + LM3630A_LEDB_ENABLE, LM3630A_LEDB_ENABLE);
5479 + if (ret < 0)
5480 + goto out_i2c_err;
5481 +- return bl->props.brightness;
5482 ++ return 0;
5483 +
5484 + out_i2c_err:
5485 + dev_err(pchip->dev, "i2c failed to access REG_CTRL\n");
5486 +diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c
5487 +index 59abdc6a97f6..314b7eceb81c 100644
5488 +--- a/drivers/video/fbdev/chipsfb.c
5489 ++++ b/drivers/video/fbdev/chipsfb.c
5490 +@@ -350,7 +350,7 @@ static void init_chips(struct fb_info *p, unsigned long addr)
5491 + static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
5492 + {
5493 + struct fb_info *p;
5494 +- unsigned long addr, size;
5495 ++ unsigned long addr;
5496 + unsigned short cmd;
5497 + int rc = -ENODEV;
5498 +
5499 +@@ -362,7 +362,6 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
5500 + if ((dp->resource[0].flags & IORESOURCE_MEM) == 0)
5501 + goto err_disable;
5502 + addr = pci_resource_start(dp, 0);
5503 +- size = pci_resource_len(dp, 0);
5504 + if (addr == 0)
5505 + goto err_disable;
5506 +
5507 +diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c
5508 +index f4e59c445964..17054d695411 100644
5509 +--- a/drivers/xen/cpu_hotplug.c
5510 ++++ b/drivers/xen/cpu_hotplug.c
5511 +@@ -53,7 +53,7 @@ static int vcpu_online(unsigned int cpu)
5512 + }
5513 + static void vcpu_hotplug(unsigned int cpu)
5514 + {
5515 +- if (!cpu_possible(cpu))
5516 ++ if (cpu >= nr_cpu_ids || !cpu_possible(cpu))
5517 + return;
5518 +
5519 + switch (vcpu_online(cpu)) {
5520 +diff --git a/fs/afs/super.c b/fs/afs/super.c
5521 +index fbdb022b75a2..65389394e202 100644
5522 +--- a/fs/afs/super.c
5523 ++++ b/fs/afs/super.c
5524 +@@ -317,6 +317,7 @@ static int afs_fill_super(struct super_block *sb,
5525 + /* fill in the superblock */
5526 + sb->s_blocksize = PAGE_SIZE;
5527 + sb->s_blocksize_bits = PAGE_SHIFT;
5528 ++ sb->s_maxbytes = MAX_LFS_FILESIZE;
5529 + sb->s_magic = AFS_FS_MAGIC;
5530 + sb->s_op = &afs_super_ops;
5531 + sb->s_bdi = &as->volume->bdi;
5532 +diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
5533 +index d27014b8bf72..075b59516c8c 100644
5534 +--- a/fs/btrfs/inode-map.c
5535 ++++ b/fs/btrfs/inode-map.c
5536 +@@ -159,6 +159,7 @@ static void start_caching(struct btrfs_root *root)
5537 + spin_lock(&root->ino_cache_lock);
5538 + root->ino_cache_state = BTRFS_CACHE_FINISHED;
5539 + spin_unlock(&root->ino_cache_lock);
5540 ++ wake_up(&root->ino_cache_wait);
5541 + return;
5542 + }
5543 +
5544 +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
5545 +index e43ba6db2bdd..751bdde6515d 100644
5546 +--- a/fs/cifs/connect.c
5547 ++++ b/fs/cifs/connect.c
5548 +@@ -885,6 +885,7 @@ cifs_demultiplex_thread(void *p)
5549 + mempool_resize(cifs_req_poolp, length + cifs_min_rcv);
5550 +
5551 + set_freezable();
5552 ++ allow_kernel_signal(SIGKILL);
5553 + while (server->tcpStatus != CifsExiting) {
5554 + if (try_to_freeze())
5555 + continue;
5556 +@@ -2221,7 +2222,7 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect)
5557 +
5558 + task = xchg(&server->tsk, NULL);
5559 + if (task)
5560 +- force_sig(SIGKILL, task);
5561 ++ send_sig(SIGKILL, task, 1);
5562 + }
5563 +
5564 + static struct TCP_Server_Info *
5565 +diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
5566 +index 3706939e5dd5..1730122b10e0 100644
5567 +--- a/fs/exportfs/expfs.c
5568 ++++ b/fs/exportfs/expfs.c
5569 +@@ -146,6 +146,7 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
5570 + tmp = lookup_one_len_unlocked(nbuf, parent, strlen(nbuf));
5571 + if (IS_ERR(tmp)) {
5572 + dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp));
5573 ++ err = PTR_ERR(tmp);
5574 + goto out_err;
5575 + }
5576 + if (tmp != dentry) {
5577 +diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
5578 +index 9a13f86fed62..4df4d31057b3 100644
5579 +--- a/fs/ext4/inline.c
5580 ++++ b/fs/ext4/inline.c
5581 +@@ -1417,7 +1417,7 @@ int htree_inlinedir_to_tree(struct file *dir_file,
5582 + err = ext4_htree_store_dirent(dir_file, hinfo->hash,
5583 + hinfo->minor_hash, de, &tmp_str);
5584 + if (err) {
5585 +- count = err;
5586 ++ ret = err;
5587 + goto out;
5588 + }
5589 + count++;
5590 +diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
5591 +index 4d973524c887..224ef034004b 100644
5592 +--- a/fs/jfs/jfs_txnmgr.c
5593 ++++ b/fs/jfs/jfs_txnmgr.c
5594 +@@ -1928,8 +1928,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
5595 + * header ?
5596 + */
5597 + if (tlck->type & tlckTRUNCATE) {
5598 +- /* This odd declaration suppresses a bogus gcc warning */
5599 +- pxd_t pxd = pxd; /* truncated extent of xad */
5600 ++ pxd_t pxd; /* truncated extent of xad */
5601 + int twm;
5602 +
5603 + /*
5604 +diff --git a/fs/namei.c b/fs/namei.c
5605 +index eb4626bad88a..7150c4d0bd7b 100644
5606 +--- a/fs/namei.c
5607 ++++ b/fs/namei.c
5608 +@@ -1011,7 +1011,8 @@ static int may_linkat(struct path *link)
5609 + * may_create_in_sticky - Check whether an O_CREAT open in a sticky directory
5610 + * should be allowed, or not, on files that already
5611 + * exist.
5612 +- * @dir: the sticky parent directory
5613 ++ * @dir_mode: mode bits of directory
5614 ++ * @dir_uid: owner of directory
5615 + * @inode: the inode of the file to open
5616 + *
5617 + * Block an O_CREAT open of a FIFO (or a regular file) when:
5618 +@@ -1027,18 +1028,18 @@ static int may_linkat(struct path *link)
5619 + *
5620 + * Returns 0 if the open is allowed, -ve on error.
5621 + */
5622 +-static int may_create_in_sticky(struct dentry * const dir,
5623 ++static int may_create_in_sticky(umode_t dir_mode, kuid_t dir_uid,
5624 + struct inode * const inode)
5625 + {
5626 + if ((!sysctl_protected_fifos && S_ISFIFO(inode->i_mode)) ||
5627 + (!sysctl_protected_regular && S_ISREG(inode->i_mode)) ||
5628 +- likely(!(dir->d_inode->i_mode & S_ISVTX)) ||
5629 +- uid_eq(inode->i_uid, dir->d_inode->i_uid) ||
5630 ++ likely(!(dir_mode & S_ISVTX)) ||
5631 ++ uid_eq(inode->i_uid, dir_uid) ||
5632 + uid_eq(current_fsuid(), inode->i_uid))
5633 + return 0;
5634 +
5635 +- if (likely(dir->d_inode->i_mode & 0002) ||
5636 +- (dir->d_inode->i_mode & 0020 &&
5637 ++ if (likely(dir_mode & 0002) ||
5638 ++ (dir_mode & 0020 &&
5639 + ((sysctl_protected_fifos >= 2 && S_ISFIFO(inode->i_mode)) ||
5640 + (sysctl_protected_regular >= 2 && S_ISREG(inode->i_mode))))) {
5641 + return -EACCES;
5642 +@@ -3259,6 +3260,8 @@ static int do_last(struct nameidata *nd,
5643 + int *opened)
5644 + {
5645 + struct dentry *dir = nd->path.dentry;
5646 ++ kuid_t dir_uid = dir->d_inode->i_uid;
5647 ++ umode_t dir_mode = dir->d_inode->i_mode;
5648 + int open_flag = op->open_flag;
5649 + bool will_truncate = (open_flag & O_TRUNC) != 0;
5650 + bool got_write = false;
5651 +@@ -3401,7 +3404,7 @@ finish_open:
5652 + error = -EISDIR;
5653 + if (d_is_dir(nd->path.dentry))
5654 + goto out;
5655 +- error = may_create_in_sticky(dir,
5656 ++ error = may_create_in_sticky(dir_mode, dir_uid,
5657 + d_backing_inode(nd->path.dentry));
5658 + if (unlikely(error))
5659 + goto out;
5660 +diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
5661 +index 9a8830a0f31f..014039618cff 100644
5662 +--- a/fs/nfs/delegation.c
5663 ++++ b/fs/nfs/delegation.c
5664 +@@ -234,6 +234,8 @@ static struct inode *nfs_delegation_grab_inode(struct nfs_delegation *delegation
5665 + spin_lock(&delegation->lock);
5666 + if (delegation->inode != NULL)
5667 + inode = igrab(delegation->inode);
5668 ++ if (!inode)
5669 ++ set_bit(NFS_DELEGATION_INODE_FREEING, &delegation->flags);
5670 + spin_unlock(&delegation->lock);
5671 + return inode;
5672 + }
5673 +@@ -867,10 +869,11 @@ restart:
5674 + list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
5675 + list_for_each_entry_rcu(delegation, &server->delegations,
5676 + super_list) {
5677 +- if (test_bit(NFS_DELEGATION_RETURNING,
5678 +- &delegation->flags))
5679 +- continue;
5680 +- if (test_bit(NFS_DELEGATION_NEED_RECLAIM,
5681 ++ if (test_bit(NFS_DELEGATION_INODE_FREEING,
5682 ++ &delegation->flags) ||
5683 ++ test_bit(NFS_DELEGATION_RETURNING,
5684 ++ &delegation->flags) ||
5685 ++ test_bit(NFS_DELEGATION_NEED_RECLAIM,
5686 + &delegation->flags) == 0)
5687 + continue;
5688 + if (!nfs_sb_active(server->super))
5689 +@@ -975,10 +978,11 @@ restart:
5690 + list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
5691 + list_for_each_entry_rcu(delegation, &server->delegations,
5692 + super_list) {
5693 +- if (test_bit(NFS_DELEGATION_RETURNING,
5694 +- &delegation->flags))
5695 +- continue;
5696 +- if (test_bit(NFS_DELEGATION_TEST_EXPIRED,
5697 ++ if (test_bit(NFS_DELEGATION_INODE_FREEING,
5698 ++ &delegation->flags) ||
5699 ++ test_bit(NFS_DELEGATION_RETURNING,
5700 ++ &delegation->flags) ||
5701 ++ test_bit(NFS_DELEGATION_TEST_EXPIRED,
5702 + &delegation->flags) == 0)
5703 + continue;
5704 + if (!nfs_sb_active(server->super))
5705 +diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h
5706 +index 2c6cb7fb7d5e..f72095bf9e10 100644
5707 +--- a/fs/nfs/delegation.h
5708 ++++ b/fs/nfs/delegation.h
5709 +@@ -33,6 +33,7 @@ enum {
5710 + NFS_DELEGATION_RETURNING,
5711 + NFS_DELEGATION_REVOKED,
5712 + NFS_DELEGATION_TEST_EXPIRED,
5713 ++ NFS_DELEGATION_INODE_FREEING,
5714 + };
5715 +
5716 + int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res);
5717 +diff --git a/fs/nfs/super.c b/fs/nfs/super.c
5718 +index 42c31587a936..4c21e572f2d9 100644
5719 +--- a/fs/nfs/super.c
5720 ++++ b/fs/nfs/super.c
5721 +@@ -1928,7 +1928,7 @@ static int nfs_parse_devname(const char *dev_name,
5722 + /* kill possible hostname list: not supported */
5723 + comma = strchr(dev_name, ',');
5724 + if (comma != NULL && comma < end)
5725 +- *comma = 0;
5726 ++ len = comma - dev_name;
5727 + }
5728 +
5729 + if (len > maxnamlen)
5730 +diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c
5731 +index f82d79a8c694..a7c3da09b72f 100644
5732 +--- a/fs/xfs/xfs_quotaops.c
5733 ++++ b/fs/xfs/xfs_quotaops.c
5734 +@@ -214,6 +214,9 @@ xfs_fs_rm_xquota(
5735 + if (XFS_IS_QUOTA_ON(mp))
5736 + return -EINVAL;
5737 +
5738 ++ if (uflags & ~(FS_USER_QUOTA | FS_GROUP_QUOTA | FS_PROJ_QUOTA))
5739 ++ return -EINVAL;
5740 ++
5741 + if (uflags & FS_USER_QUOTA)
5742 + flags |= XFS_DQ_USER;
5743 + if (uflags & FS_GROUP_QUOTA)
5744 +diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
5745 +index dec03c0dbc21..26347cc717e8 100644
5746 +--- a/include/linux/bitmap.h
5747 ++++ b/include/linux/bitmap.h
5748 +@@ -85,6 +85,14 @@
5749 + * contain all bit positions from 0 to 'bits' - 1.
5750 + */
5751 +
5752 ++/*
5753 ++ * Allocation and deallocation of bitmap.
5754 ++ * Provided in lib/bitmap.c to avoid circular dependency.
5755 ++ */
5756 ++extern unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags);
5757 ++extern unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags);
5758 ++extern void bitmap_free(const unsigned long *bitmap);
5759 ++
5760 + /*
5761 + * lib/bitmap.c provides these functions:
5762 + */
5763 +diff --git a/include/linux/device.h b/include/linux/device.h
5764 +index 8d732965fab7..eb865b461acc 100644
5765 +--- a/include/linux/device.h
5766 ++++ b/include/linux/device.h
5767 +@@ -682,7 +682,8 @@ extern unsigned long devm_get_free_pages(struct device *dev,
5768 + gfp_t gfp_mask, unsigned int order);
5769 + extern void devm_free_pages(struct device *dev, unsigned long addr);
5770 +
5771 +-void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
5772 ++void __iomem *devm_ioremap_resource(struct device *dev,
5773 ++ const struct resource *res);
5774 +
5775 + /* allows to add/remove a custom action to devres stack */
5776 + int devm_add_action(struct device *dev, void (*action)(void *), void *data);
5777 +diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
5778 +index 20ee90c47cd5..6dd276227217 100644
5779 +--- a/include/linux/mlx5/mlx5_ifc.h
5780 ++++ b/include/linux/mlx5/mlx5_ifc.h
5781 +@@ -7909,8 +7909,6 @@ struct mlx5_ifc_query_lag_out_bits {
5782 +
5783 + u8 syndrome[0x20];
5784 +
5785 +- u8 reserved_at_40[0x40];
5786 +-
5787 + struct mlx5_ifc_lagc_bits ctx;
5788 + };
5789 +
5790 +diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
5791 +index 83b9a2e0d8d4..e3a91b24a31c 100644
5792 +--- a/include/linux/netfilter/ipset/ip_set.h
5793 ++++ b/include/linux/netfilter/ipset/ip_set.h
5794 +@@ -537,13 +537,6 @@ ip6addrptr(const struct sk_buff *skb, bool src, struct in6_addr *addr)
5795 + sizeof(*addr));
5796 + }
5797 +
5798 +-/* Calculate the bytes required to store the inclusive range of a-b */
5799 +-static inline int
5800 +-bitmap_bytes(u32 a, u32 b)
5801 +-{
5802 +- return 4 * ((((b - a + 8) / 8) + 3) / 4);
5803 +-}
5804 +-
5805 + #include <linux/netfilter/ipset/ip_set_timeout.h>
5806 + #include <linux/netfilter/ipset/ip_set_comment.h>
5807 +
5808 +diff --git a/include/linux/platform_data/dma-imx-sdma.h b/include/linux/platform_data/dma-imx-sdma.h
5809 +index 2d08816720f6..5bb0a119f39a 100644
5810 +--- a/include/linux/platform_data/dma-imx-sdma.h
5811 ++++ b/include/linux/platform_data/dma-imx-sdma.h
5812 +@@ -50,7 +50,10 @@ struct sdma_script_start_addrs {
5813 + /* End of v2 array */
5814 + s32 zcanfd_2_mcu_addr;
5815 + s32 zqspi_2_mcu_addr;
5816 ++ s32 mcu_2_ecspi_addr;
5817 + /* End of v3 array */
5818 ++ s32 mcu_2_zqspi_addr;
5819 ++ /* End of v4 array */
5820 + };
5821 +
5822 + /**
5823 +diff --git a/include/linux/signal.h b/include/linux/signal.h
5824 +index 5308304993be..ffa58ff53e22 100644
5825 +--- a/include/linux/signal.h
5826 ++++ b/include/linux/signal.h
5827 +@@ -313,6 +313,9 @@ extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
5828 + extern void exit_signals(struct task_struct *tsk);
5829 + extern void kernel_sigaction(int, __sighandler_t);
5830 +
5831 ++#define SIG_KTHREAD ((__force __sighandler_t)2)
5832 ++#define SIG_KTHREAD_KERNEL ((__force __sighandler_t)3)
5833 ++
5834 + static inline void allow_signal(int sig)
5835 + {
5836 + /*
5837 +@@ -320,7 +323,17 @@ static inline void allow_signal(int sig)
5838 + * know it'll be handled, so that they don't get converted to
5839 + * SIGKILL or just silently dropped.
5840 + */
5841 +- kernel_sigaction(sig, (__force __sighandler_t)2);
5842 ++ kernel_sigaction(sig, SIG_KTHREAD);
5843 ++}
5844 ++
5845 ++static inline void allow_kernel_signal(int sig)
5846 ++{
5847 ++ /*
5848 ++ * Kernel threads handle their own signals. Let the signal code
5849 ++ * know signals sent by the kernel will be handled, so that they
5850 ++ * don't get silently dropped.
5851 ++ */
5852 ++ kernel_sigaction(sig, SIG_KTHREAD_KERNEL);
5853 + }
5854 +
5855 + static inline void disallow_signal(int sig)
5856 +diff --git a/include/media/davinci/vpbe.h b/include/media/davinci/vpbe.h
5857 +index 4376beeb28c2..5d8ceeddc797 100644
5858 +--- a/include/media/davinci/vpbe.h
5859 ++++ b/include/media/davinci/vpbe.h
5860 +@@ -96,7 +96,7 @@ struct vpbe_config {
5861 + struct encoder_config_info *ext_encoders;
5862 + /* amplifier information goes here */
5863 + struct amp_config_info *amp;
5864 +- int num_outputs;
5865 ++ unsigned int num_outputs;
5866 + /* Order is venc outputs followed by LCD and then external encoders */
5867 + struct vpbe_output *outputs;
5868 + };
5869 +diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h
5870 +index d6be935caa50..ecd1a0f7bd3e 100644
5871 +--- a/include/trace/events/xen.h
5872 ++++ b/include/trace/events/xen.h
5873 +@@ -63,7 +63,11 @@ TRACE_EVENT(xen_mc_callback,
5874 + TP_PROTO(xen_mc_callback_fn_t fn, void *data),
5875 + TP_ARGS(fn, data),
5876 + TP_STRUCT__entry(
5877 +- __field(xen_mc_callback_fn_t, fn)
5878 ++ /*
5879 ++ * Use field_struct to avoid is_signed_type()
5880 ++ * comparison of a function pointer.
5881 ++ */
5882 ++ __field_struct(xen_mc_callback_fn_t, fn)
5883 + __field(void *, data)
5884 + ),
5885 + TP_fast_assign(
5886 +diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
5887 +index 8c5335bde212..5dd3332ebc66 100644
5888 +--- a/include/uapi/linux/ethtool.h
5889 ++++ b/include/uapi/linux/ethtool.h
5890 +@@ -1687,6 +1687,8 @@ enum ethtool_reset_flags {
5891 + * %ethtool_link_mode_bit_indices for the link modes, and other
5892 + * link features that the link partner advertised through
5893 + * autonegotiation; 0 if unknown or not applicable. Read-only.
5894 ++ * @transceiver: Used to distinguish different possible PHY types,
5895 ++ * reported consistently by PHYLIB. Read-only.
5896 + *
5897 + * If autonegotiation is disabled, the speed and @duplex represent the
5898 + * fixed link mode and are writable if the driver supports multiple
5899 +@@ -1738,7 +1740,9 @@ struct ethtool_link_settings {
5900 + __u8 eth_tp_mdix;
5901 + __u8 eth_tp_mdix_ctrl;
5902 + __s8 link_mode_masks_nwords;
5903 +- __u32 reserved[8];
5904 ++ __u8 transceiver;
5905 ++ __u8 reserved1[3];
5906 ++ __u32 reserved[7];
5907 + __u32 link_mode_masks[0];
5908 + /* layout of link_mode_masks fields:
5909 + * __u32 map_supported[link_mode_masks_nwords];
5910 +diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
5911 +index 5a58421d7e2d..a52a6da8c3d0 100644
5912 +--- a/kernel/debug/kdb/kdb_main.c
5913 ++++ b/kernel/debug/kdb/kdb_main.c
5914 +@@ -2632,7 +2632,7 @@ static int kdb_per_cpu(int argc, const char **argv)
5915 + diag = kdbgetularg(argv[3], &whichcpu);
5916 + if (diag)
5917 + return diag;
5918 +- if (!cpu_online(whichcpu)) {
5919 ++ if (whichcpu >= nr_cpu_ids || !cpu_online(whichcpu)) {
5920 + kdb_printf("cpu %ld is not online\n", whichcpu);
5921 + return KDB_BADCPUNUM;
5922 + }
5923 +diff --git a/kernel/events/core.c b/kernel/events/core.c
5924 +index 5bbf7537a612..64ace5e9af2a 100644
5925 +--- a/kernel/events/core.c
5926 ++++ b/kernel/events/core.c
5927 +@@ -4624,6 +4624,9 @@ static int perf_event_period(struct perf_event *event, u64 __user *arg)
5928 + if (perf_event_check_period(event, value))
5929 + return -EINVAL;
5930 +
5931 ++ if (!event->attr.freq && (value & (1ULL << 63)))
5932 ++ return -EINVAL;
5933 ++
5934 + event_function_call(event, __perf_event_period, &value);
5935 +
5936 + return 0;
5937 +diff --git a/kernel/signal.c b/kernel/signal.c
5938 +index 30914b3c76b2..57fadbe69c2e 100644
5939 +--- a/kernel/signal.c
5940 ++++ b/kernel/signal.c
5941 +@@ -79,6 +79,11 @@ static int sig_task_ignored(struct task_struct *t, int sig, bool force)
5942 + handler == SIG_DFL && !(force && sig_kernel_only(sig)))
5943 + return 1;
5944 +
5945 ++ /* Only allow kernel generated signals to this kthread */
5946 ++ if (unlikely((t->flags & PF_KTHREAD) &&
5947 ++ (handler == SIG_KTHREAD_KERNEL) && !force))
5948 ++ return true;
5949 ++
5950 + return sig_handler_ignored(handler, sig);
5951 + }
5952 +
5953 +diff --git a/lib/bitmap.c b/lib/bitmap.c
5954 +index 0b66f0e5eb6b..a44b20a829dd 100644
5955 +--- a/lib/bitmap.c
5956 ++++ b/lib/bitmap.c
5957 +@@ -13,6 +13,7 @@
5958 + #include <linux/bitops.h>
5959 + #include <linux/bug.h>
5960 + #include <linux/kernel.h>
5961 ++#include <linux/slab.h>
5962 + #include <linux/string.h>
5963 + #include <linux/uaccess.h>
5964 +
5965 +@@ -1212,3 +1213,22 @@ void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int n
5966 + }
5967 + EXPORT_SYMBOL(bitmap_copy_le);
5968 + #endif
5969 ++
5970 ++unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags)
5971 ++{
5972 ++ return kmalloc_array(BITS_TO_LONGS(nbits), sizeof(unsigned long),
5973 ++ flags);
5974 ++}
5975 ++EXPORT_SYMBOL(bitmap_alloc);
5976 ++
5977 ++unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags)
5978 ++{
5979 ++ return bitmap_alloc(nbits, flags | __GFP_ZERO);
5980 ++}
5981 ++EXPORT_SYMBOL(bitmap_zalloc);
5982 ++
5983 ++void bitmap_free(const unsigned long *bitmap)
5984 ++{
5985 ++ kfree(bitmap);
5986 ++}
5987 ++EXPORT_SYMBOL(bitmap_free);
5988 +diff --git a/lib/devres.c b/lib/devres.c
5989 +index cb1464c411a2..38912892053c 100644
5990 +--- a/lib/devres.c
5991 ++++ b/lib/devres.c
5992 +@@ -131,7 +131,8 @@ EXPORT_SYMBOL(devm_iounmap);
5993 + * if (IS_ERR(base))
5994 + * return PTR_ERR(base);
5995 + */
5996 +-void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res)
5997 ++void __iomem *devm_ioremap_resource(struct device *dev,
5998 ++ const struct resource *res)
5999 + {
6000 + resource_size_t size;
6001 + const char *name;
6002 +diff --git a/lib/kfifo.c b/lib/kfifo.c
6003 +index 90ba1eb1df06..a94227c55551 100644
6004 +--- a/lib/kfifo.c
6005 ++++ b/lib/kfifo.c
6006 +@@ -82,7 +82,8 @@ int __kfifo_init(struct __kfifo *fifo, void *buffer,
6007 + {
6008 + size /= esize;
6009 +
6010 +- size = roundup_pow_of_two(size);
6011 ++ if (!is_power_of_2(size))
6012 ++ size = rounddown_pow_of_two(size);
6013 +
6014 + fifo->in = 0;
6015 + fifo->out = 0;
6016 +diff --git a/net/6lowpan/nhc.c b/net/6lowpan/nhc.c
6017 +index 7008d53e455c..e61679bf0908 100644
6018 +--- a/net/6lowpan/nhc.c
6019 ++++ b/net/6lowpan/nhc.c
6020 +@@ -18,7 +18,7 @@
6021 + #include "nhc.h"
6022 +
6023 + static struct rb_root rb_root = RB_ROOT;
6024 +-static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX];
6025 ++static struct lowpan_nhc *lowpan_nexthdr_nhcs[NEXTHDR_MAX + 1];
6026 + static DEFINE_SPINLOCK(lowpan_nhc_lock);
6027 +
6028 + static int lowpan_nhc_insert(struct lowpan_nhc *nhc)
6029 +diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
6030 +index 56b7197f0373..1d850edecd72 100644
6031 +--- a/net/bridge/netfilter/ebtables.c
6032 ++++ b/net/bridge/netfilter/ebtables.c
6033 +@@ -2182,7 +2182,9 @@ static int compat_copy_entries(unsigned char *data, unsigned int size_user,
6034 + if (ret < 0)
6035 + return ret;
6036 +
6037 +- WARN_ON(size_remaining);
6038 ++ if (size_remaining)
6039 ++ return -EINVAL;
6040 ++
6041 + return state->buf_kern_offset;
6042 + }
6043 +
6044 +diff --git a/net/core/ethtool.c b/net/core/ethtool.c
6045 +index 476665f917a2..47d2d6e2b780 100644
6046 +--- a/net/core/ethtool.c
6047 ++++ b/net/core/ethtool.c
6048 +@@ -514,6 +514,8 @@ convert_link_ksettings_to_legacy_settings(
6049 + = link_ksettings->base.eth_tp_mdix;
6050 + legacy_settings->eth_tp_mdix_ctrl
6051 + = link_ksettings->base.eth_tp_mdix_ctrl;
6052 ++ legacy_settings->transceiver
6053 ++ = link_ksettings->base.transceiver;
6054 + return retval;
6055 + }
6056 +
6057 +diff --git a/net/core/neighbour.c b/net/core/neighbour.c
6058 +index cd85cee14bd0..6578d1f8e6c4 100644
6059 +--- a/net/core/neighbour.c
6060 ++++ b/net/core/neighbour.c
6061 +@@ -1834,8 +1834,8 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl,
6062 + goto nla_put_failure;
6063 + {
6064 + unsigned long now = jiffies;
6065 +- unsigned int flush_delta = now - tbl->last_flush;
6066 +- unsigned int rand_delta = now - tbl->last_rand;
6067 ++ long flush_delta = now - tbl->last_flush;
6068 ++ long rand_delta = now - tbl->last_rand;
6069 + struct neigh_hash_table *nht;
6070 + struct ndt_config ndc = {
6071 + .ndtc_key_len = tbl->key_len,
6072 +diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c
6073 +index c01df341b5f6..5936bfafb1c4 100644
6074 +--- a/net/ieee802154/6lowpan/reassembly.c
6075 ++++ b/net/ieee802154/6lowpan/reassembly.c
6076 +@@ -633,7 +633,7 @@ err_sysctl:
6077 +
6078 + void lowpan_net_frag_exit(void)
6079 + {
6080 +- inet_frags_fini(&lowpan_frags);
6081 + lowpan_frags_sysctl_unregister();
6082 + unregister_pernet_subsys(&lowpan_frags_ops);
6083 ++ inet_frags_fini(&lowpan_frags);
6084 + }
6085 +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
6086 +index a4db2d79b913..65c47b1f0da4 100644
6087 +--- a/net/ipv4/ip_tunnel.c
6088 ++++ b/net/ipv4/ip_tunnel.c
6089 +@@ -1184,10 +1184,8 @@ int ip_tunnel_init(struct net_device *dev)
6090 + iph->version = 4;
6091 + iph->ihl = 5;
6092 +
6093 +- if (tunnel->collect_md) {
6094 +- dev->features |= NETIF_F_NETNS_LOCAL;
6095 ++ if (tunnel->collect_md)
6096 + netif_keep_dst(dev);
6097 +- }
6098 + return 0;
6099 + }
6100 + EXPORT_SYMBOL_GPL(ip_tunnel_init);
6101 +diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c
6102 +index 7e44d23b0328..3bfab2d41574 100644
6103 +--- a/net/ipv4/tcp_bbr.c
6104 ++++ b/net/ipv4/tcp_bbr.c
6105 +@@ -649,8 +649,7 @@ static void bbr_update_bw(struct sock *sk, const struct rate_sample *rs)
6106 + * bandwidth sample. Delivered is in packets and interval_us in uS and
6107 + * ratio will be <<1 for most connections. So delivered is first scaled.
6108 + */
6109 +- bw = (u64)rs->delivered * BW_UNIT;
6110 +- do_div(bw, rs->interval_us);
6111 ++ bw = div64_long((u64)rs->delivered * BW_UNIT, rs->interval_us);
6112 +
6113 + /* If this sample is application-limited, it is likely to have a very
6114 + * low delivered count that represents application behavior rather than
6115 +diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
6116 +index cc28b8646986..ed795d50a8d2 100644
6117 +--- a/net/ipv6/ip6_tunnel.c
6118 ++++ b/net/ipv6/ip6_tunnel.c
6119 +@@ -1861,10 +1861,8 @@ static int ip6_tnl_dev_init(struct net_device *dev)
6120 + if (err)
6121 + return err;
6122 + ip6_tnl_link_config(t);
6123 +- if (t->parms.collect_md) {
6124 +- dev->features |= NETIF_F_NETNS_LOCAL;
6125 ++ if (t->parms.collect_md)
6126 + netif_keep_dst(dev);
6127 +- }
6128 + return 0;
6129 + }
6130 +
6131 +diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
6132 +index 4aed9c45a91a..3f488555999e 100644
6133 +--- a/net/ipv6/reassembly.c
6134 ++++ b/net/ipv6/reassembly.c
6135 +@@ -592,8 +592,8 @@ err_protocol:
6136 +
6137 + void ipv6_frag_exit(void)
6138 + {
6139 +- inet_frags_fini(&ip6_frags);
6140 + ip6_frags_sysctl_unregister();
6141 + unregister_pernet_subsys(&ip6_frags_ops);
6142 + inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT);
6143 ++ inet_frags_fini(&ip6_frags);
6144 + }
6145 +diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
6146 +index c2dfc32eb9f2..02e10deef5b4 100644
6147 +--- a/net/iucv/af_iucv.c
6148 ++++ b/net/iucv/af_iucv.c
6149 +@@ -2431,6 +2431,13 @@ out:
6150 + return err;
6151 + }
6152 +
6153 ++static void afiucv_iucv_exit(void)
6154 ++{
6155 ++ device_unregister(af_iucv_dev);
6156 ++ driver_unregister(&af_iucv_driver);
6157 ++ pr_iucv->iucv_unregister(&af_iucv_handler, 0);
6158 ++}
6159 ++
6160 + static int __init afiucv_init(void)
6161 + {
6162 + int err;
6163 +@@ -2464,11 +2471,18 @@ static int __init afiucv_init(void)
6164 + err = afiucv_iucv_init();
6165 + if (err)
6166 + goto out_sock;
6167 +- } else
6168 +- register_netdevice_notifier(&afiucv_netdev_notifier);
6169 ++ }
6170 ++
6171 ++ err = register_netdevice_notifier(&afiucv_netdev_notifier);
6172 ++ if (err)
6173 ++ goto out_notifier;
6174 ++
6175 + dev_add_pack(&iucv_packet_type);
6176 + return 0;
6177 +
6178 ++out_notifier:
6179 ++ if (pr_iucv)
6180 ++ afiucv_iucv_exit();
6181 + out_sock:
6182 + sock_unregister(PF_IUCV);
6183 + out_proto:
6184 +@@ -2482,12 +2496,11 @@ out:
6185 + static void __exit afiucv_exit(void)
6186 + {
6187 + if (pr_iucv) {
6188 +- device_unregister(af_iucv_dev);
6189 +- driver_unregister(&af_iucv_driver);
6190 +- pr_iucv->iucv_unregister(&af_iucv_handler, 0);
6191 ++ afiucv_iucv_exit();
6192 + symbol_put(iucv_if);
6193 +- } else
6194 +- unregister_netdevice_notifier(&afiucv_netdev_notifier);
6195 ++ }
6196 ++
6197 ++ unregister_netdevice_notifier(&afiucv_netdev_notifier);
6198 + dev_remove_pack(&iucv_packet_type);
6199 + sock_unregister(PF_IUCV);
6200 + proto_unregister(&iucv_proto);
6201 +diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
6202 +index 4ae758bcb2cf..394a1ddb0782 100644
6203 +--- a/net/l2tp/l2tp_core.c
6204 ++++ b/net/l2tp/l2tp_core.c
6205 +@@ -1947,7 +1947,8 @@ static __net_exit void l2tp_exit_net(struct net *net)
6206 + }
6207 + rcu_read_unlock_bh();
6208 +
6209 +- flush_workqueue(l2tp_wq);
6210 ++ if (l2tp_wq)
6211 ++ flush_workqueue(l2tp_wq);
6212 + rcu_barrier();
6213 + }
6214 +
6215 +diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
6216 +index 789e66b0187a..2a859f967c8a 100644
6217 +--- a/net/llc/af_llc.c
6218 ++++ b/net/llc/af_llc.c
6219 +@@ -111,22 +111,26 @@ static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr)
6220 + *
6221 + * Send data via reliable llc2 connection.
6222 + * Returns 0 upon success, non-zero if action did not succeed.
6223 ++ *
6224 ++ * This function always consumes a reference to the skb.
6225 + */
6226 + static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock)
6227 + {
6228 + struct llc_sock* llc = llc_sk(sk);
6229 +- int rc = 0;
6230 +
6231 + if (unlikely(llc_data_accept_state(llc->state) ||
6232 + llc->remote_busy_flag ||
6233 + llc->p_flag)) {
6234 + long timeout = sock_sndtimeo(sk, noblock);
6235 ++ int rc;
6236 +
6237 + rc = llc_ui_wait_for_busy_core(sk, timeout);
6238 ++ if (rc) {
6239 ++ kfree_skb(skb);
6240 ++ return rc;
6241 ++ }
6242 + }
6243 +- if (unlikely(!rc))
6244 +- rc = llc_build_and_send_pkt(sk, skb);
6245 +- return rc;
6246 ++ return llc_build_and_send_pkt(sk, skb);
6247 + }
6248 +
6249 + static void llc_ui_sk_init(struct socket *sock, struct sock *sk)
6250 +@@ -896,7 +900,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
6251 + DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name);
6252 + int flags = msg->msg_flags;
6253 + int noblock = flags & MSG_DONTWAIT;
6254 +- struct sk_buff *skb;
6255 ++ struct sk_buff *skb = NULL;
6256 + size_t size = 0;
6257 + int rc = -EINVAL, copied = 0, hdrlen;
6258 +
6259 +@@ -905,10 +909,10 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
6260 + lock_sock(sk);
6261 + if (addr) {
6262 + if (msg->msg_namelen < sizeof(*addr))
6263 +- goto release;
6264 ++ goto out;
6265 + } else {
6266 + if (llc_ui_addr_null(&llc->addr))
6267 +- goto release;
6268 ++ goto out;
6269 + addr = &llc->addr;
6270 + }
6271 + /* must bind connection to sap if user hasn't done it. */
6272 +@@ -916,7 +920,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
6273 + /* bind to sap with null dev, exclusive. */
6274 + rc = llc_ui_autobind(sock, addr);
6275 + if (rc)
6276 +- goto release;
6277 ++ goto out;
6278 + }
6279 + hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr);
6280 + size = hdrlen + len;
6281 +@@ -925,12 +929,12 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
6282 + copied = size - hdrlen;
6283 + rc = -EINVAL;
6284 + if (copied < 0)
6285 +- goto release;
6286 ++ goto out;
6287 + release_sock(sk);
6288 + skb = sock_alloc_send_skb(sk, size, noblock, &rc);
6289 + lock_sock(sk);
6290 + if (!skb)
6291 +- goto release;
6292 ++ goto out;
6293 + skb->dev = llc->dev;
6294 + skb->protocol = llc_proto_type(addr->sllc_arphrd);
6295 + skb_reserve(skb, hdrlen);
6296 +@@ -940,29 +944,31 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
6297 + if (sk->sk_type == SOCK_DGRAM || addr->sllc_ua) {
6298 + llc_build_and_send_ui_pkt(llc->sap, skb, addr->sllc_mac,
6299 + addr->sllc_sap);
6300 ++ skb = NULL;
6301 + goto out;
6302 + }
6303 + if (addr->sllc_test) {
6304 + llc_build_and_send_test_pkt(llc->sap, skb, addr->sllc_mac,
6305 + addr->sllc_sap);
6306 ++ skb = NULL;
6307 + goto out;
6308 + }
6309 + if (addr->sllc_xid) {
6310 + llc_build_and_send_xid_pkt(llc->sap, skb, addr->sllc_mac,
6311 + addr->sllc_sap);
6312 ++ skb = NULL;
6313 + goto out;
6314 + }
6315 + rc = -ENOPROTOOPT;
6316 + if (!(sk->sk_type == SOCK_STREAM && !addr->sllc_ua))
6317 + goto out;
6318 + rc = llc_ui_send_data(sk, skb, noblock);
6319 ++ skb = NULL;
6320 + out:
6321 +- if (rc) {
6322 +- kfree_skb(skb);
6323 +-release:
6324 ++ kfree_skb(skb);
6325 ++ if (rc)
6326 + dprintk("%s: failed sending from %02X to %02X: %d\n",
6327 + __func__, llc->laddr.lsap, llc->daddr.lsap, rc);
6328 +- }
6329 + release_sock(sk);
6330 + return rc ? : copied;
6331 + }
6332 +diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
6333 +index 94c78cc49d3e..1bdbd134bd7a 100644
6334 +--- a/net/llc/llc_conn.c
6335 ++++ b/net/llc/llc_conn.c
6336 +@@ -55,6 +55,8 @@ int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ;
6337 + * (executing it's actions and changing state), upper layer will be
6338 + * indicated or confirmed, if needed. Returns 0 for success, 1 for
6339 + * failure. The socket lock has to be held before calling this function.
6340 ++ *
6341 ++ * This function always consumes a reference to the skb.
6342 + */
6343 + int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
6344 + {
6345 +@@ -62,12 +64,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
6346 + struct llc_sock *llc = llc_sk(skb->sk);
6347 + struct llc_conn_state_ev *ev = llc_conn_ev(skb);
6348 +
6349 +- /*
6350 +- * We have to hold the skb, because llc_conn_service will kfree it in
6351 +- * the sending path and we need to look at the skb->cb, where we encode
6352 +- * llc_conn_state_ev.
6353 +- */
6354 +- skb_get(skb);
6355 + ev->ind_prim = ev->cfm_prim = 0;
6356 + /*
6357 + * Send event to state machine
6358 +@@ -75,21 +71,12 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
6359 + rc = llc_conn_service(skb->sk, skb);
6360 + if (unlikely(rc != 0)) {
6361 + printk(KERN_ERR "%s: llc_conn_service failed\n", __func__);
6362 +- goto out_kfree_skb;
6363 +- }
6364 +-
6365 +- if (unlikely(!ev->ind_prim && !ev->cfm_prim)) {
6366 +- /* indicate or confirm not required */
6367 +- if (!skb->next)
6368 +- goto out_kfree_skb;
6369 + goto out_skb_put;
6370 + }
6371 +
6372 +- if (unlikely(ev->ind_prim && ev->cfm_prim)) /* Paranoia */
6373 +- skb_get(skb);
6374 +-
6375 + switch (ev->ind_prim) {
6376 + case LLC_DATA_PRIM:
6377 ++ skb_get(skb);
6378 + llc_save_primitive(sk, skb, LLC_DATA_PRIM);
6379 + if (unlikely(sock_queue_rcv_skb(sk, skb))) {
6380 + /*
6381 +@@ -106,6 +93,7 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
6382 + * skb->sk pointing to the newly created struct sock in
6383 + * llc_conn_handler. -acme
6384 + */
6385 ++ skb_get(skb);
6386 + skb_queue_tail(&sk->sk_receive_queue, skb);
6387 + sk->sk_state_change(sk);
6388 + break;
6389 +@@ -121,7 +109,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
6390 + sk->sk_state_change(sk);
6391 + }
6392 + }
6393 +- kfree_skb(skb);
6394 + sock_put(sk);
6395 + break;
6396 + case LLC_RESET_PRIM:
6397 +@@ -130,14 +117,11 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
6398 + * RESET is not being notified to upper layers for now
6399 + */
6400 + printk(KERN_INFO "%s: received a reset ind!\n", __func__);
6401 +- kfree_skb(skb);
6402 + break;
6403 + default:
6404 +- if (ev->ind_prim) {
6405 ++ if (ev->ind_prim)
6406 + printk(KERN_INFO "%s: received unknown %d prim!\n",
6407 + __func__, ev->ind_prim);
6408 +- kfree_skb(skb);
6409 +- }
6410 + /* No indication */
6411 + break;
6412 + }
6413 +@@ -179,15 +163,12 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
6414 + printk(KERN_INFO "%s: received a reset conf!\n", __func__);
6415 + break;
6416 + default:
6417 +- if (ev->cfm_prim) {
6418 ++ if (ev->cfm_prim)
6419 + printk(KERN_INFO "%s: received unknown %d prim!\n",
6420 + __func__, ev->cfm_prim);
6421 +- break;
6422 +- }
6423 +- goto out_skb_put; /* No confirmation */
6424 ++ /* No confirmation */
6425 ++ break;
6426 + }
6427 +-out_kfree_skb:
6428 +- kfree_skb(skb);
6429 + out_skb_put:
6430 + kfree_skb(skb);
6431 + return rc;
6432 +diff --git a/net/llc/llc_if.c b/net/llc/llc_if.c
6433 +index 6daf391b3e84..fc4d2bd8816f 100644
6434 +--- a/net/llc/llc_if.c
6435 ++++ b/net/llc/llc_if.c
6436 +@@ -38,6 +38,8 @@
6437 + * closed and -EBUSY when sending data is not permitted in this state or
6438 + * LLC has send an I pdu with p bit set to 1 and is waiting for it's
6439 + * response.
6440 ++ *
6441 ++ * This function always consumes a reference to the skb.
6442 + */
6443 + int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb)
6444 + {
6445 +@@ -46,20 +48,22 @@ int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb)
6446 + struct llc_sock *llc = llc_sk(sk);
6447 +
6448 + if (unlikely(llc->state == LLC_CONN_STATE_ADM))
6449 +- goto out;
6450 ++ goto out_free;
6451 + rc = -EBUSY;
6452 + if (unlikely(llc_data_accept_state(llc->state) || /* data_conn_refuse */
6453 + llc->p_flag)) {
6454 + llc->failed_data_req = 1;
6455 +- goto out;
6456 ++ goto out_free;
6457 + }
6458 + ev = llc_conn_ev(skb);
6459 + ev->type = LLC_CONN_EV_TYPE_PRIM;
6460 + ev->prim = LLC_DATA_PRIM;
6461 + ev->prim_type = LLC_PRIM_TYPE_REQ;
6462 + skb->dev = llc->dev;
6463 +- rc = llc_conn_state_process(sk, skb);
6464 +-out:
6465 ++ return llc_conn_state_process(sk, skb);
6466 ++
6467 ++out_free:
6468 ++ kfree_skb(skb);
6469 + return rc;
6470 + }
6471 +
6472 +diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
6473 +index 593184d14b3e..e1b0e26c1f17 100644
6474 +--- a/net/mac80211/rc80211_minstrel_ht.c
6475 ++++ b/net/mac80211/rc80211_minstrel_ht.c
6476 +@@ -547,7 +547,7 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
6477 +
6478 + /* (re)Initialize group rate indexes */
6479 + for(j = 0; j < MAX_THR_RATES; j++)
6480 +- tmp_group_tp_rate[j] = group;
6481 ++ tmp_group_tp_rate[j] = MCS_GROUP_RATES * group;
6482 +
6483 + for (i = 0; i < MCS_GROUP_RATES; i++) {
6484 + if (!(mg->supported & BIT(i)))
6485 +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
6486 +index 3b423c50ec8f..74652eb2f90f 100644
6487 +--- a/net/mac80211/rx.c
6488 ++++ b/net/mac80211/rx.c
6489 +@@ -3205,9 +3205,18 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
6490 + case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
6491 + /* process for all: mesh, mlme, ibss */
6492 + break;
6493 ++ case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
6494 ++ if (is_multicast_ether_addr(mgmt->da) &&
6495 ++ !is_broadcast_ether_addr(mgmt->da))
6496 ++ return RX_DROP_MONITOR;
6497 ++
6498 ++ /* process only for station/IBSS */
6499 ++ if (sdata->vif.type != NL80211_IFTYPE_STATION &&
6500 ++ sdata->vif.type != NL80211_IFTYPE_ADHOC)
6501 ++ return RX_DROP_MONITOR;
6502 ++ break;
6503 + case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
6504 + case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
6505 +- case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
6506 + case cpu_to_le16(IEEE80211_STYPE_DISASSOC):
6507 + if (is_multicast_ether_addr(mgmt->da) &&
6508 + !is_broadcast_ether_addr(mgmt->da))
6509 +diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h
6510 +index 9b32059dee2d..7536cdd2da28 100644
6511 +--- a/net/netfilter/ipset/ip_set_bitmap_gen.h
6512 ++++ b/net/netfilter/ipset/ip_set_bitmap_gen.h
6513 +@@ -81,7 +81,7 @@ mtype_flush(struct ip_set *set)
6514 +
6515 + if (set->extensions & IPSET_EXT_DESTROY)
6516 + mtype_ext_cleanup(set);
6517 +- memset(map->members, 0, map->memsize);
6518 ++ bitmap_zero(map->members, map->elements);
6519 + }
6520 +
6521 + static int
6522 +diff --git a/net/netfilter/ipset/ip_set_bitmap_ip.c b/net/netfilter/ipset/ip_set_bitmap_ip.c
6523 +index 4783efff0bde..a4c104a4977f 100644
6524 +--- a/net/netfilter/ipset/ip_set_bitmap_ip.c
6525 ++++ b/net/netfilter/ipset/ip_set_bitmap_ip.c
6526 +@@ -40,7 +40,7 @@ MODULE_ALIAS("ip_set_bitmap:ip");
6527 +
6528 + /* Type structure */
6529 + struct bitmap_ip {
6530 +- void *members; /* the set members */
6531 ++ unsigned long *members; /* the set members */
6532 + u32 first_ip; /* host byte order, included in range */
6533 + u32 last_ip; /* host byte order, included in range */
6534 + u32 elements; /* number of max elements in the set */
6535 +@@ -222,7 +222,7 @@ init_map_ip(struct ip_set *set, struct bitmap_ip *map,
6536 + u32 first_ip, u32 last_ip,
6537 + u32 elements, u32 hosts, u8 netmask)
6538 + {
6539 +- map->members = ip_set_alloc(map->memsize);
6540 ++ map->members = bitmap_zalloc(elements, GFP_KERNEL | __GFP_NOWARN);
6541 + if (!map->members)
6542 + return false;
6543 + map->first_ip = first_ip;
6544 +@@ -315,7 +315,7 @@ bitmap_ip_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
6545 + if (!map)
6546 + return -ENOMEM;
6547 +
6548 +- map->memsize = bitmap_bytes(0, elements - 1);
6549 ++ map->memsize = BITS_TO_LONGS(elements) * sizeof(unsigned long);
6550 + set->variant = &bitmap_ip;
6551 + if (!init_map_ip(set, map, first_ip, last_ip,
6552 + elements, hosts, netmask)) {
6553 +diff --git a/net/netfilter/ipset/ip_set_bitmap_ipmac.c b/net/netfilter/ipset/ip_set_bitmap_ipmac.c
6554 +index 9a065f672d3a..8e58e7e34981 100644
6555 +--- a/net/netfilter/ipset/ip_set_bitmap_ipmac.c
6556 ++++ b/net/netfilter/ipset/ip_set_bitmap_ipmac.c
6557 +@@ -46,7 +46,7 @@ enum {
6558 +
6559 + /* Type structure */
6560 + struct bitmap_ipmac {
6561 +- void *members; /* the set members */
6562 ++ unsigned long *members; /* the set members */
6563 + u32 first_ip; /* host byte order, included in range */
6564 + u32 last_ip; /* host byte order, included in range */
6565 + u32 elements; /* number of max elements in the set */
6566 +@@ -299,7 +299,7 @@ static bool
6567 + init_map_ipmac(struct ip_set *set, struct bitmap_ipmac *map,
6568 + u32 first_ip, u32 last_ip, u32 elements)
6569 + {
6570 +- map->members = ip_set_alloc(map->memsize);
6571 ++ map->members = bitmap_zalloc(elements, GFP_KERNEL | __GFP_NOWARN);
6572 + if (!map->members)
6573 + return false;
6574 + map->first_ip = first_ip;
6575 +@@ -363,7 +363,7 @@ bitmap_ipmac_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
6576 + if (!map)
6577 + return -ENOMEM;
6578 +
6579 +- map->memsize = bitmap_bytes(0, elements - 1);
6580 ++ map->memsize = BITS_TO_LONGS(elements) * sizeof(unsigned long);
6581 + set->variant = &bitmap_ipmac;
6582 + if (!init_map_ipmac(set, map, first_ip, last_ip, elements)) {
6583 + kfree(map);
6584 +diff --git a/net/netfilter/ipset/ip_set_bitmap_port.c b/net/netfilter/ipset/ip_set_bitmap_port.c
6585 +index 7f0c733358a4..6771b362a123 100644
6586 +--- a/net/netfilter/ipset/ip_set_bitmap_port.c
6587 ++++ b/net/netfilter/ipset/ip_set_bitmap_port.c
6588 +@@ -34,7 +34,7 @@ MODULE_ALIAS("ip_set_bitmap:port");
6589 +
6590 + /* Type structure */
6591 + struct bitmap_port {
6592 +- void *members; /* the set members */
6593 ++ unsigned long *members; /* the set members */
6594 + u16 first_port; /* host byte order, included in range */
6595 + u16 last_port; /* host byte order, included in range */
6596 + u32 elements; /* number of max elements in the set */
6597 +@@ -207,7 +207,7 @@ static bool
6598 + init_map_port(struct ip_set *set, struct bitmap_port *map,
6599 + u16 first_port, u16 last_port)
6600 + {
6601 +- map->members = ip_set_alloc(map->memsize);
6602 ++ map->members = bitmap_zalloc(map->elements, GFP_KERNEL | __GFP_NOWARN);
6603 + if (!map->members)
6604 + return false;
6605 + map->first_port = first_port;
6606 +@@ -250,7 +250,7 @@ bitmap_port_create(struct net *net, struct ip_set *set, struct nlattr *tb[],
6607 + return -ENOMEM;
6608 +
6609 + map->elements = elements;
6610 +- map->memsize = bitmap_bytes(0, map->elements);
6611 ++ map->memsize = BITS_TO_LONGS(elements) * sizeof(unsigned long);
6612 + set->variant = &bitmap_port;
6613 + if (!init_map_port(set, map, first_port, last_port)) {
6614 + kfree(map);
6615 +diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
6616 +index 40cade140222..fb643945e424 100644
6617 +--- a/net/packet/af_packet.c
6618 ++++ b/net/packet/af_packet.c
6619 +@@ -1332,15 +1332,21 @@ static void packet_sock_destruct(struct sock *sk)
6620 +
6621 + static bool fanout_flow_is_huge(struct packet_sock *po, struct sk_buff *skb)
6622 + {
6623 +- u32 rxhash;
6624 ++ u32 *history = po->rollover->history;
6625 ++ u32 victim, rxhash;
6626 + int i, count = 0;
6627 +
6628 + rxhash = skb_get_hash(skb);
6629 + for (i = 0; i < ROLLOVER_HLEN; i++)
6630 +- if (po->rollover->history[i] == rxhash)
6631 ++ if (READ_ONCE(history[i]) == rxhash)
6632 + count++;
6633 +
6634 +- po->rollover->history[prandom_u32() % ROLLOVER_HLEN] = rxhash;
6635 ++ victim = prandom_u32() % ROLLOVER_HLEN;
6636 ++
6637 ++ /* Avoid dirtying the cache line if possible */
6638 ++ if (READ_ONCE(history[victim]) != rxhash)
6639 ++ WRITE_ONCE(history[victim], rxhash);
6640 ++
6641 + return count > (ROLLOVER_HLEN >> 1);
6642 + }
6643 +
6644 +@@ -3404,20 +3410,29 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
6645 + sock_recv_ts_and_drops(msg, sk, skb);
6646 +
6647 + if (msg->msg_name) {
6648 ++ int copy_len;
6649 ++
6650 + /* If the address length field is there to be filled
6651 + * in, we fill it in now.
6652 + */
6653 + if (sock->type == SOCK_PACKET) {
6654 + __sockaddr_check_size(sizeof(struct sockaddr_pkt));
6655 + msg->msg_namelen = sizeof(struct sockaddr_pkt);
6656 ++ copy_len = msg->msg_namelen;
6657 + } else {
6658 + struct sockaddr_ll *sll = &PACKET_SKB_CB(skb)->sa.ll;
6659 +
6660 + msg->msg_namelen = sll->sll_halen +
6661 + offsetof(struct sockaddr_ll, sll_addr);
6662 ++ copy_len = msg->msg_namelen;
6663 ++ if (msg->msg_namelen < sizeof(struct sockaddr_ll)) {
6664 ++ memset(msg->msg_name +
6665 ++ offsetof(struct sockaddr_ll, sll_addr),
6666 ++ 0, sizeof(sll->sll_addr));
6667 ++ msg->msg_namelen = sizeof(struct sockaddr_ll);
6668 ++ }
6669 + }
6670 +- memcpy(msg->msg_name, &PACKET_SKB_CB(skb)->sa,
6671 +- msg->msg_namelen);
6672 ++ memcpy(msg->msg_name, &PACKET_SKB_CB(skb)->sa, copy_len);
6673 + }
6674 +
6675 + if (pkt_sk(sk)->auxdata) {
6676 +diff --git a/net/rds/ib_stats.c b/net/rds/ib_stats.c
6677 +index 7e78dca1f252..aaf4b3d10203 100644
6678 +--- a/net/rds/ib_stats.c
6679 ++++ b/net/rds/ib_stats.c
6680 +@@ -42,7 +42,7 @@ DEFINE_PER_CPU_SHARED_ALIGNED(struct rds_ib_statistics, rds_ib_stats);
6681 + static const char *const rds_ib_stat_names[] = {
6682 + "ib_connect_raced",
6683 + "ib_listen_closed_stale",
6684 +- "s_ib_evt_handler_call",
6685 ++ "ib_evt_handler_call",
6686 + "ib_tasklet_call",
6687 + "ib_tx_cq_event",
6688 + "ib_tx_ring_full",
6689 +diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
6690 +index 59d328603312..64389f493bb2 100644
6691 +--- a/net/rxrpc/output.c
6692 ++++ b/net/rxrpc/output.c
6693 +@@ -400,6 +400,9 @@ send_fragmentable:
6694 + }
6695 + break;
6696 + #endif
6697 ++
6698 ++ default:
6699 ++ BUG();
6700 + }
6701 +
6702 + up_write(&conn->params.local->defrag_sem);
6703 +diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
6704 +index fc3650b06192..9b4c7c42c932 100644
6705 +--- a/net/sched/act_mirred.c
6706 ++++ b/net/sched/act_mirred.c
6707 +@@ -332,7 +332,11 @@ static int __init mirred_init_module(void)
6708 + return err;
6709 +
6710 + pr_info("Mirror/redirect action on\n");
6711 +- return tcf_register_action(&act_mirred_ops, &mirred_net_ops);
6712 ++ err = tcf_register_action(&act_mirred_ops, &mirred_net_ops);
6713 ++ if (err)
6714 ++ unregister_netdevice_notifier(&mirred_device_notifier);
6715 ++
6716 ++ return err;
6717 + }
6718 +
6719 + static void __exit mirred_cleanup_module(void)
6720 +diff --git a/net/sched/ematch.c b/net/sched/ematch.c
6721 +index fbb7ebfc58c6..b0b04b3c0896 100644
6722 +--- a/net/sched/ematch.c
6723 ++++ b/net/sched/ematch.c
6724 +@@ -267,12 +267,12 @@ static int tcf_em_validate(struct tcf_proto *tp,
6725 + }
6726 + em->data = (unsigned long) v;
6727 + }
6728 ++ em->datalen = data_len;
6729 + }
6730 + }
6731 +
6732 + em->matchid = em_hdr->matchid;
6733 + em->flags = em_hdr->flags;
6734 +- em->datalen = data_len;
6735 + em->net = net;
6736 +
6737 + err = 0;
6738 +diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
6739 +index 95002e56fa48..e06491314d59 100644
6740 +--- a/net/sched/sch_netem.c
6741 ++++ b/net/sched/sch_netem.c
6742 +@@ -437,8 +437,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
6743 + struct netem_skb_cb *cb;
6744 + struct sk_buff *skb2;
6745 + struct sk_buff *segs = NULL;
6746 +- unsigned int len = 0, last_len, prev_len = qdisc_pkt_len(skb);
6747 +- int nb = 0;
6748 ++ unsigned int prev_len = qdisc_pkt_len(skb);
6749 + int count = 1;
6750 + int rc = NET_XMIT_SUCCESS;
6751 + int rc_drop = NET_XMIT_DROP;
6752 +@@ -495,6 +494,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
6753 + segs = netem_segment(skb, sch, to_free);
6754 + if (!segs)
6755 + return rc_drop;
6756 ++ qdisc_skb_cb(segs)->pkt_len = segs->len;
6757 + } else {
6758 + segs = skb;
6759 + }
6760 +@@ -510,6 +510,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
6761 + if (skb->ip_summed == CHECKSUM_PARTIAL &&
6762 + skb_checksum_help(skb)) {
6763 + qdisc_drop(skb, sch, to_free);
6764 ++ skb = NULL;
6765 + goto finish_segs;
6766 + }
6767 +
6768 +@@ -585,6 +586,12 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
6769 +
6770 + finish_segs:
6771 + if (segs) {
6772 ++ unsigned int len, last_len;
6773 ++ int nb;
6774 ++
6775 ++ len = skb ? skb->len : 0;
6776 ++ nb = skb ? 1 : 0;
6777 ++
6778 + while (segs) {
6779 + skb2 = segs->next;
6780 + segs->next = NULL;
6781 +@@ -600,9 +607,10 @@ finish_segs:
6782 + }
6783 + segs = skb2;
6784 + }
6785 +- sch->q.qlen += nb;
6786 +- if (nb > 1)
6787 +- qdisc_tree_reduce_backlog(sch, 1 - nb, prev_len - len);
6788 ++ /* Parent qdiscs accounted for 1 skb of size @prev_len */
6789 ++ qdisc_tree_reduce_backlog(sch, -(nb - 1), -(len - prev_len));
6790 ++ } else if (!skb) {
6791 ++ return NET_XMIT_DROP;
6792 + }
6793 + return NET_XMIT_SUCCESS;
6794 + }
6795 +diff --git a/net/tipc/node.c b/net/tipc/node.c
6796 +index db8fbc076e1a..fe7b0ad1d6f3 100644
6797 +--- a/net/tipc/node.c
6798 ++++ b/net/tipc/node.c
6799 +@@ -688,10 +688,10 @@ static void __tipc_node_link_down(struct tipc_node *n, int *bearer_id,
6800 + static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete)
6801 + {
6802 + struct tipc_link_entry *le = &n->links[bearer_id];
6803 ++ struct tipc_media_addr *maddr = NULL;
6804 + struct tipc_link *l = le->link;
6805 +- struct tipc_media_addr *maddr;
6806 +- struct sk_buff_head xmitq;
6807 + int old_bearer_id = bearer_id;
6808 ++ struct sk_buff_head xmitq;
6809 +
6810 + if (!l)
6811 + return;
6812 +@@ -713,7 +713,8 @@ static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete)
6813 + tipc_node_write_unlock(n);
6814 + if (delete)
6815 + tipc_mon_remove_peer(n->net, n->addr, old_bearer_id);
6816 +- tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr);
6817 ++ if (!skb_queue_empty(&xmitq))
6818 ++ tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr);
6819 + tipc_sk_rcv(n->net, &le->inputq);
6820 + }
6821 +
6822 +diff --git a/net/tipc/sysctl.c b/net/tipc/sysctl.c
6823 +index 1a779b1e8510..40f6d82083d7 100644
6824 +--- a/net/tipc/sysctl.c
6825 ++++ b/net/tipc/sysctl.c
6826 +@@ -37,6 +37,8 @@
6827 +
6828 + #include <linux/sysctl.h>
6829 +
6830 ++static int zero;
6831 ++static int one = 1;
6832 + static struct ctl_table_header *tipc_ctl_hdr;
6833 +
6834 + static struct ctl_table tipc_table[] = {
6835 +@@ -45,14 +47,16 @@ static struct ctl_table tipc_table[] = {
6836 + .data = &sysctl_tipc_rmem,
6837 + .maxlen = sizeof(sysctl_tipc_rmem),
6838 + .mode = 0644,
6839 +- .proc_handler = proc_dointvec,
6840 ++ .proc_handler = proc_dointvec_minmax,
6841 ++ .extra1 = &one,
6842 + },
6843 + {
6844 + .procname = "named_timeout",
6845 + .data = &sysctl_tipc_named_timeout,
6846 + .maxlen = sizeof(sysctl_tipc_named_timeout),
6847 + .mode = 0644,
6848 +- .proc_handler = proc_dointvec,
6849 ++ .proc_handler = proc_dointvec_minmax,
6850 ++ .extra1 = &zero,
6851 + },
6852 + {}
6853 + };
6854 +diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
6855 +index 6c2560f3f95b..a8ca79810dcc 100644
6856 +--- a/net/x25/af_x25.c
6857 ++++ b/net/x25/af_x25.c
6858 +@@ -764,6 +764,10 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr,
6859 + if (sk->sk_state == TCP_ESTABLISHED)
6860 + goto out;
6861 +
6862 ++ rc = -EALREADY; /* Do nothing if call is already in progress */
6863 ++ if (sk->sk_state == TCP_SYN_SENT)
6864 ++ goto out;
6865 ++
6866 + sk->sk_state = TCP_CLOSE;
6867 + sock->state = SS_UNCONNECTED;
6868 +
6869 +@@ -810,7 +814,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr,
6870 + /* Now the loop */
6871 + rc = -EINPROGRESS;
6872 + if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK))
6873 +- goto out_put_neigh;
6874 ++ goto out;
6875 +
6876 + rc = x25_wait_for_connection_establishment(sk);
6877 + if (rc)
6878 +diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
6879 +index 5423a58d1b06..9972141f11aa 100644
6880 +--- a/scripts/recordmcount.c
6881 ++++ b/scripts/recordmcount.c
6882 +@@ -53,6 +53,10 @@
6883 + #define R_AARCH64_ABS64 257
6884 + #endif
6885 +
6886 ++#define R_ARM_PC24 1
6887 ++#define R_ARM_THM_CALL 10
6888 ++#define R_ARM_CALL 28
6889 ++
6890 + static int fd_map; /* File descriptor for file being modified. */
6891 + static int mmap_failed; /* Boolean flag. */
6892 + static char gpfx; /* prefix for global symbol name (sometimes '_') */
6893 +@@ -374,6 +378,18 @@ is_mcounted_section_name(char const *const txtname)
6894 + #define RECORD_MCOUNT_64
6895 + #include "recordmcount.h"
6896 +
6897 ++static int arm_is_fake_mcount(Elf32_Rel const *rp)
6898 ++{
6899 ++ switch (ELF32_R_TYPE(w(rp->r_info))) {
6900 ++ case R_ARM_THM_CALL:
6901 ++ case R_ARM_CALL:
6902 ++ case R_ARM_PC24:
6903 ++ return 0;
6904 ++ }
6905 ++
6906 ++ return 1;
6907 ++}
6908 ++
6909 + /* 64-bit EM_MIPS has weird ELF64_Rela.r_info.
6910 + * http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf
6911 + * We interpret Table 29 Relocation Operation (Elf64_Rel, Elf64_Rela) [p.40]
6912 +@@ -463,6 +479,7 @@ do_file(char const *const fname)
6913 + break;
6914 + case EM_ARM: reltype = R_ARM_ABS32;
6915 + altmcount = "__gnu_mcount_nc";
6916 ++ is_fake_mcount32 = arm_is_fake_mcount;
6917 + break;
6918 + case EM_AARCH64:
6919 + reltype = R_AARCH64_ABS64;
6920 +diff --git a/security/keys/key.c b/security/keys/key.c
6921 +index 7276d1a009d4..280b4feccdc0 100644
6922 +--- a/security/keys/key.c
6923 ++++ b/security/keys/key.c
6924 +@@ -296,6 +296,7 @@ struct key *key_alloc(struct key_type *type, const char *desc,
6925 + key->gid = gid;
6926 + key->perm = perm;
6927 + key->restrict_link = restrict_link;
6928 ++ key->last_used_at = ktime_get_real_seconds();
6929 +
6930 + if (!(flags & KEY_ALLOC_NOT_IN_QUOTA))
6931 + key->flags |= 1 << KEY_FLAG_IN_QUOTA;
6932 +diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c
6933 +index a04edff8b729..ae50d59fb810 100644
6934 +--- a/sound/aoa/codecs/onyx.c
6935 ++++ b/sound/aoa/codecs/onyx.c
6936 +@@ -74,8 +74,10 @@ static int onyx_read_register(struct onyx *onyx, u8 reg, u8 *value)
6937 + return 0;
6938 + }
6939 + v = i2c_smbus_read_byte_data(onyx->i2c, reg);
6940 +- if (v < 0)
6941 ++ if (v < 0) {
6942 ++ *value = 0;
6943 + return -1;
6944 ++ }
6945 + *value = (u8)v;
6946 + onyx->cache[ONYX_REG_CONTROL-FIRSTREGISTER] = *value;
6947 + return 0;
6948 +diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
6949 +index b83feecf1e40..8f9386998270 100644
6950 +--- a/sound/pci/hda/hda_controller.h
6951 ++++ b/sound/pci/hda/hda_controller.h
6952 +@@ -171,11 +171,10 @@ struct azx {
6953 + #define azx_bus(chip) (&(chip)->bus.core)
6954 + #define bus_to_azx(_bus) container_of(_bus, struct azx, bus.core)
6955 +
6956 +-#ifdef CONFIG_X86
6957 +-#define azx_snoop(chip) ((chip)->snoop)
6958 +-#else
6959 +-#define azx_snoop(chip) true
6960 +-#endif
6961 ++static inline bool azx_snoop(struct azx *chip)
6962 ++{
6963 ++ return !IS_ENABLED(CONFIG_X86) || chip->snoop;
6964 ++}
6965 +
6966 + /*
6967 + * macros for easy use
6968 +diff --git a/sound/soc/codecs/cs4349.c b/sound/soc/codecs/cs4349.c
6969 +index 231ca935cdf3..c232c42ccead 100644
6970 +--- a/sound/soc/codecs/cs4349.c
6971 ++++ b/sound/soc/codecs/cs4349.c
6972 +@@ -380,6 +380,7 @@ static struct i2c_driver cs4349_i2c_driver = {
6973 + .driver = {
6974 + .name = "cs4349",
6975 + .of_match_table = cs4349_of_match,
6976 ++ .pm = &cs4349_runtime_pm,
6977 + },
6978 + .id_table = cs4349_i2c_id,
6979 + .probe = cs4349_i2c_probe,
6980 +diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c
6981 +index 37722194b107..6b22700842e2 100644
6982 +--- a/sound/soc/codecs/es8328.c
6983 ++++ b/sound/soc/codecs/es8328.c
6984 +@@ -234,7 +234,7 @@ static const struct soc_enum es8328_rline_enum =
6985 + ARRAY_SIZE(es8328_line_texts),
6986 + es8328_line_texts);
6987 + static const struct snd_kcontrol_new es8328_right_line_controls =
6988 +- SOC_DAPM_ENUM("Route", es8328_lline_enum);
6989 ++ SOC_DAPM_ENUM("Route", es8328_rline_enum);
6990 +
6991 + /* Left Mixer */
6992 + static const struct snd_kcontrol_new es8328_left_mixer_controls[] = {
6993 +diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c
6994 +index f0cb1c4afe3c..c5a8d758f58b 100644
6995 +--- a/sound/soc/codecs/wm8737.c
6996 ++++ b/sound/soc/codecs/wm8737.c
6997 +@@ -170,7 +170,7 @@ SOC_DOUBLE("Polarity Invert Switch", WM8737_ADC_CONTROL, 5, 6, 1, 0),
6998 + SOC_SINGLE("3D Switch", WM8737_3D_ENHANCE, 0, 1, 0),
6999 + SOC_SINGLE("3D Depth", WM8737_3D_ENHANCE, 1, 15, 0),
7000 + SOC_ENUM("3D Low Cut-off", low_3d),
7001 +-SOC_ENUM("3D High Cut-off", low_3d),
7002 ++SOC_ENUM("3D High Cut-off", high_3d),
7003 + SOC_SINGLE_TLV("3D ADC Volume", WM8737_3D_ENHANCE, 7, 1, 1, adc_tlv),
7004 +
7005 + SOC_SINGLE("Noise Gate Switch", WM8737_NOISE_GATE, 0, 1, 0),
7006 +diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
7007 +index 624c209c9498..d1935c5c3602 100644
7008 +--- a/sound/soc/davinci/davinci-mcasp.c
7009 ++++ b/sound/soc/davinci/davinci-mcasp.c
7010 +@@ -882,14 +882,13 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
7011 + active_slots = hweight32(mcasp->tdm_mask[stream]);
7012 + active_serializers = (channels + active_slots - 1) /
7013 + active_slots;
7014 +- if (active_serializers == 1) {
7015 ++ if (active_serializers == 1)
7016 + active_slots = channels;
7017 +- for (i = 0; i < total_slots; i++) {
7018 +- if ((1 << i) & mcasp->tdm_mask[stream]) {
7019 +- mask |= (1 << i);
7020 +- if (--active_slots <= 0)
7021 +- break;
7022 +- }
7023 ++ for (i = 0; i < total_slots; i++) {
7024 ++ if ((1 << i) & mcasp->tdm_mask[stream]) {
7025 ++ mask |= (1 << i);
7026 ++ if (--active_slots <= 0)
7027 ++ break;
7028 + }
7029 + }
7030 + } else {
7031 +diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
7032 +index 8e525f7ac08d..3d99a8579c99 100644
7033 +--- a/sound/soc/fsl/imx-sgtl5000.c
7034 ++++ b/sound/soc/fsl/imx-sgtl5000.c
7035 +@@ -119,7 +119,8 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
7036 + codec_dev = of_find_i2c_device_by_node(codec_np);
7037 + if (!codec_dev) {
7038 + dev_err(&pdev->dev, "failed to find codec platform device\n");
7039 +- return -EPROBE_DEFER;
7040 ++ ret = -EPROBE_DEFER;
7041 ++ goto fail;
7042 + }
7043 +
7044 + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
7045 +diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c
7046 +index 07f91e918b23..754742018515 100644
7047 +--- a/sound/soc/qcom/apq8016_sbc.c
7048 ++++ b/sound/soc/qcom/apq8016_sbc.c
7049 +@@ -114,13 +114,15 @@ static struct apq8016_sbc_data *apq8016_sbc_parse_of(struct snd_soc_card *card)
7050 +
7051 + if (!cpu || !codec) {
7052 + dev_err(dev, "Can't find cpu/codec DT node\n");
7053 +- return ERR_PTR(-EINVAL);
7054 ++ ret = -EINVAL;
7055 ++ goto error;
7056 + }
7057 +
7058 + link->cpu_of_node = of_parse_phandle(cpu, "sound-dai", 0);
7059 + if (!link->cpu_of_node) {
7060 + dev_err(card->dev, "error getting cpu phandle\n");
7061 +- return ERR_PTR(-EINVAL);
7062 ++ ret = -EINVAL;
7063 ++ goto error;
7064 + }
7065 +
7066 + link->codec_of_node = of_parse_phandle(codec, "sound-dai", 0);
7067 +@@ -132,28 +134,37 @@ static struct apq8016_sbc_data *apq8016_sbc_parse_of(struct snd_soc_card *card)
7068 + ret = snd_soc_of_get_dai_name(cpu, &link->cpu_dai_name);
7069 + if (ret) {
7070 + dev_err(card->dev, "error getting cpu dai name\n");
7071 +- return ERR_PTR(ret);
7072 ++ goto error;
7073 + }
7074 +
7075 + ret = snd_soc_of_get_dai_name(codec, &link->codec_dai_name);
7076 + if (ret) {
7077 + dev_err(card->dev, "error getting codec dai name\n");
7078 +- return ERR_PTR(ret);
7079 ++ goto error;
7080 + }
7081 +
7082 + link->platform_of_node = link->cpu_of_node;
7083 + ret = of_property_read_string(np, "link-name", &link->name);
7084 + if (ret) {
7085 + dev_err(card->dev, "error getting codec dai_link name\n");
7086 +- return ERR_PTR(ret);
7087 ++ goto error;
7088 + }
7089 +
7090 + link->stream_name = link->name;
7091 + link->init = apq8016_sbc_dai_init;
7092 + link++;
7093 ++
7094 ++ of_node_put(cpu);
7095 ++ of_node_put(codec);
7096 + }
7097 +
7098 + return data;
7099 ++
7100 ++ error:
7101 ++ of_node_put(np);
7102 ++ of_node_put(cpu);
7103 ++ of_node_put(codec);
7104 ++ return ERR_PTR(ret);
7105 + }
7106 +
7107 + static const struct snd_soc_dapm_widget apq8016_sbc_dapm_widgets[] = {
7108 +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
7109 +index d69559e45872..635b22fa1101 100644
7110 +--- a/sound/soc/soc-pcm.c
7111 ++++ b/sound/soc/soc-pcm.c
7112 +@@ -48,8 +48,8 @@ static bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream)
7113 + else
7114 + codec_stream = &dai->driver->capture;
7115 +
7116 +- /* If the codec specifies any rate at all, it supports the stream. */
7117 +- return codec_stream->rates;
7118 ++ /* If the codec specifies any channels at all, it supports the stream */
7119 ++ return codec_stream->channels_min;
7120 + }
7121 +
7122 + /**
7123 +diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c
7124 +index 15c92400cea4..02c373c65e19 100644
7125 +--- a/sound/soc/sunxi/sun4i-i2s.c
7126 ++++ b/sound/soc/sunxi/sun4i-i2s.c
7127 +@@ -78,8 +78,8 @@
7128 + #define SUN4I_I2S_CLK_DIV_MCLK_MASK GENMASK(3, 0)
7129 + #define SUN4I_I2S_CLK_DIV_MCLK(mclk) ((mclk) << 0)
7130 +
7131 +-#define SUN4I_I2S_RX_CNT_REG 0x28
7132 +-#define SUN4I_I2S_TX_CNT_REG 0x2c
7133 ++#define SUN4I_I2S_TX_CNT_REG 0x28
7134 ++#define SUN4I_I2S_RX_CNT_REG 0x2c
7135 +
7136 + #define SUN4I_I2S_TX_CHAN_SEL_REG 0x30
7137 + #define SUN4I_I2S_TX_CHAN_SEL(num_chan) (((num_chan) - 1) << 0)
7138 +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
7139 +index 64fa1bbf0acb..54011f8543a7 100644
7140 +--- a/sound/usb/mixer.c
7141 ++++ b/sound/usb/mixer.c
7142 +@@ -2626,7 +2626,9 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
7143 + (err = snd_usb_mixer_status_create(mixer)) < 0)
7144 + goto _error;
7145 +
7146 +- snd_usb_mixer_apply_create_quirk(mixer);
7147 ++ err = snd_usb_mixer_apply_create_quirk(mixer);
7148 ++ if (err < 0)
7149 ++ goto _error;
7150 +
7151 + err = snd_device_new(chip->card, SNDRV_DEV_CODEC, mixer, &dev_ops);
7152 + if (err < 0)
7153 +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
7154 +index d32727c74a16..c892b4d1e733 100644
7155 +--- a/sound/usb/quirks-table.h
7156 ++++ b/sound/usb/quirks-table.h
7157 +@@ -3293,19 +3293,14 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
7158 + .ifnum = 0,
7159 + .type = QUIRK_AUDIO_STANDARD_MIXER,
7160 + },
7161 +- /* Capture */
7162 +- {
7163 +- .ifnum = 1,
7164 +- .type = QUIRK_IGNORE_INTERFACE,
7165 +- },
7166 + /* Playback */
7167 + {
7168 +- .ifnum = 2,
7169 ++ .ifnum = 1,
7170 + .type = QUIRK_AUDIO_FIXED_ENDPOINT,
7171 + .data = &(const struct audioformat) {
7172 + .formats = SNDRV_PCM_FMTBIT_S16_LE,
7173 + .channels = 2,
7174 +- .iface = 2,
7175 ++ .iface = 1,
7176 + .altsetting = 1,
7177 + .altset_idx = 1,
7178 + .attributes = UAC_EP_CS_ATTR_FILL_MAX |