Magellan Linux

Annotation of /trunk/kernel-alx-legacy/patches-4.9/0153-4.9.54-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3608 - (hide annotations) (download)
Fri Aug 14 07:34:29 2020 UTC (3 years, 8 months ago) by niro
File size: 146731 byte(s)
-added kerenl-alx-legacy pkg
1 niro 3608 diff --git a/Documentation/devicetree/bindings/display/bridge/ti,ths8135.txt b/Documentation/devicetree/bindings/display/bridge/ti,ths8135.txt
2     new file mode 100644
3     index 000000000000..6ec1a880ac18
4     --- /dev/null
5     +++ b/Documentation/devicetree/bindings/display/bridge/ti,ths8135.txt
6     @@ -0,0 +1,46 @@
7     +THS8135 Video DAC
8     +-----------------
9     +
10     +This is the binding for Texas Instruments THS8135 Video DAC bridge.
11     +
12     +Required properties:
13     +
14     +- compatible: Must be "ti,ths8135"
15     +
16     +Required nodes:
17     +
18     +This device has two video ports. Their connections are modelled using the OF
19     +graph bindings specified in Documentation/devicetree/bindings/graph.txt.
20     +
21     +- Video port 0 for RGB input
22     +- Video port 1 for VGA output
23     +
24     +Example
25     +-------
26     +
27     +vga-bridge {
28     + compatible = "ti,ths8135";
29     + #address-cells = <1>;
30     + #size-cells = <0>;
31     +
32     + ports {
33     + #address-cells = <1>;
34     + #size-cells = <0>;
35     +
36     + port@0 {
37     + reg = <0>;
38     +
39     + vga_bridge_in: endpoint {
40     + remote-endpoint = <&lcdc_out_vga>;
41     + };
42     + };
43     +
44     + port@1 {
45     + reg = <1>;
46     +
47     + vga_bridge_out: endpoint {
48     + remote-endpoint = <&vga_con_in>;
49     + };
50     + };
51     + };
52     +};
53     diff --git a/Documentation/devicetree/bindings/iio/adc/avia-hx711.txt b/Documentation/devicetree/bindings/iio/adc/avia-hx711.txt
54     new file mode 100644
55     index 000000000000..b3629405f568
56     --- /dev/null
57     +++ b/Documentation/devicetree/bindings/iio/adc/avia-hx711.txt
58     @@ -0,0 +1,18 @@
59     +* AVIA HX711 ADC chip for weight cells
60     + Bit-banging driver
61     +
62     +Required properties:
63     + - compatible: Should be "avia,hx711"
64     + - sck-gpios: Definition of the GPIO for the clock
65     + - dout-gpios: Definition of the GPIO for data-out
66     + See Documentation/devicetree/bindings/gpio/gpio.txt
67     + - avdd-supply: Definition of the regulator used as analog supply
68     +
69     +Example:
70     +weight@0 {
71     + compatible = "avia,hx711";
72     + sck-gpios = <&gpio3 10 GPIO_ACTIVE_HIGH>;
73     + dout-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
74     + avdd-suppy = <&avdd>;
75     +};
76     +
77     diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
78     index f0a48ea78659..bceffffb7502 100644
79     --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
80     +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
81     @@ -38,6 +38,7 @@ atmel Atmel Corporation
82     auo AU Optronics Corporation
83     auvidea Auvidea GmbH
84     avago Avago Technologies
85     +avia avia semiconductor
86     avic Shanghai AVIC Optoelectronics Co., Ltd.
87     axis Axis Communications AB
88     boe BOE Technology Group Co., Ltd.
89     diff --git a/Makefile b/Makefile
90     index 98e3be659b21..8370937bbb22 100644
91     --- a/Makefile
92     +++ b/Makefile
93     @@ -1,6 +1,6 @@
94     VERSION = 4
95     PATCHLEVEL = 9
96     -SUBLEVEL = 53
97     +SUBLEVEL = 54
98     EXTRAVERSION =
99     NAME = Roaring Lionus
100    
101     diff --git a/arch/arm/Kconfig-nommu b/arch/arm/Kconfig-nommu
102     index aed66d5df7f1..b7576349528c 100644
103     --- a/arch/arm/Kconfig-nommu
104     +++ b/arch/arm/Kconfig-nommu
105     @@ -34,8 +34,7 @@ config PROCESSOR_ID
106     used instead of the auto-probing which utilizes the register.
107    
108     config REMAP_VECTORS_TO_RAM
109     - bool 'Install vectors to the beginning of RAM' if DRAM_BASE
110     - depends on DRAM_BASE
111     + bool 'Install vectors to the beginning of RAM'
112     help
113     The kernel needs to change the hardware exception vectors.
114     In nommu mode, the hardware exception vectors are normally
115     diff --git a/arch/arm/boot/dts/am335x-chilisom.dtsi b/arch/arm/boot/dts/am335x-chilisom.dtsi
116     index f9ee5859c154..1b43ebd08b38 100644
117     --- a/arch/arm/boot/dts/am335x-chilisom.dtsi
118     +++ b/arch/arm/boot/dts/am335x-chilisom.dtsi
119     @@ -124,6 +124,14 @@
120    
121     &rtc {
122     system-power-controller;
123     +
124     + pinctrl-0 = <&ext_wakeup>;
125     + pinctrl-names = "default";
126     +
127     + ext_wakeup: ext-wakeup {
128     + pins = "ext_wakeup0";
129     + input-enable;
130     + };
131     };
132    
133     /* NAND Flash */
134     diff --git a/arch/arm/boot/dts/bcm953012k.dts b/arch/arm/boot/dts/bcm953012k.dts
135     index 05a985a20378..6208e85acd9d 100644
136     --- a/arch/arm/boot/dts/bcm953012k.dts
137     +++ b/arch/arm/boot/dts/bcm953012k.dts
138     @@ -48,7 +48,7 @@
139     };
140    
141     memory {
142     - reg = <0x00000000 0x10000000>;
143     + reg = <0x80000000 0x10000000>;
144     };
145     };
146    
147     diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
148     index 8aa19ba14436..5282d69e55bd 100644
149     --- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
150     +++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
151     @@ -97,11 +97,11 @@
152     thermal-zones {
153     cpu_thermal: cpu-thermal {
154     cooling-maps {
155     - map0 {
156     + cooling_map0: map0 {
157     /* Corresponds to 800MHz at freq_table */
158     cooling-device = <&cpu0 7 7>;
159     };
160     - map1 {
161     + cooling_map1: map1 {
162     /* Corresponds to 200MHz at freq_table */
163     cooling-device = <&cpu0 13 13>;
164     };
165     diff --git a/arch/arm/boot/dts/exynos4412-odroidu3.dts b/arch/arm/boot/dts/exynos4412-odroidu3.dts
166     index 99634c54dca9..7504a5aa538e 100644
167     --- a/arch/arm/boot/dts/exynos4412-odroidu3.dts
168     +++ b/arch/arm/boot/dts/exynos4412-odroidu3.dts
169     @@ -13,6 +13,7 @@
170    
171     /dts-v1/;
172     #include "exynos4412-odroid-common.dtsi"
173     +#include "exynos4412-prime.dtsi"
174    
175     / {
176     model = "Hardkernel ODROID-U3 board based on Exynos4412";
177     @@ -47,11 +48,11 @@
178     cooling-maps {
179     map0 {
180     trip = <&cpu_alert1>;
181     - cooling-device = <&cpu0 7 7>;
182     + cooling-device = <&cpu0 9 9>;
183     };
184     map1 {
185     trip = <&cpu_alert2>;
186     - cooling-device = <&cpu0 13 13>;
187     + cooling-device = <&cpu0 15 15>;
188     };
189     map2 {
190     trip = <&cpu_alert0>;
191     diff --git a/arch/arm/boot/dts/exynos4412-odroidx2.dts b/arch/arm/boot/dts/exynos4412-odroidx2.dts
192     index 4d228858f172..d6e92ebc3874 100644
193     --- a/arch/arm/boot/dts/exynos4412-odroidx2.dts
194     +++ b/arch/arm/boot/dts/exynos4412-odroidx2.dts
195     @@ -12,6 +12,7 @@
196     */
197    
198     #include "exynos4412-odroidx.dts"
199     +#include "exynos4412-prime.dtsi"
200    
201     / {
202     model = "Hardkernel ODROID-X2 board based on Exynos4412";
203     diff --git a/arch/arm/boot/dts/exynos4412-prime.dtsi b/arch/arm/boot/dts/exynos4412-prime.dtsi
204     new file mode 100644
205     index 000000000000..e75bc170c89c
206     --- /dev/null
207     +++ b/arch/arm/boot/dts/exynos4412-prime.dtsi
208     @@ -0,0 +1,41 @@
209     +/*
210     + * Samsung's Exynos4412 Prime SoC device tree source
211     + *
212     + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
213     + * http://www.samsung.com
214     + *
215     + * This program is free software; you can redistribute it and/or modify
216     + * it under the terms of the GNU General Public License version 2 as
217     + * published by the Free Software Foundation.
218     + */
219     +
220     +/*
221     + * Exynos4412 Prime SoC revision supports higher CPU frequencies than
222     + * non-Prime version. Therefore we need to update OPPs table and
223     + * thermal maps accordingly.
224     + */
225     +
226     +&cpu0_opp_1500 {
227     + /delete-property/turbo-mode;
228     +};
229     +
230     +&cpu0_opp_table {
231     + opp@1600000000 {
232     + opp-hz = /bits/ 64 <1600000000>;
233     + opp-microvolt = <1350000>;
234     + clock-latency-ns = <200000>;
235     + };
236     + opp@1704000000 {
237     + opp-hz = /bits/ 64 <1704000000>;
238     + opp-microvolt = <1350000>;
239     + clock-latency-ns = <200000>;
240     + };
241     +};
242     +
243     +&cooling_map0 {
244     + cooling-device = <&cpu0 9 9>;
245     +};
246     +
247     +&cooling_map1 {
248     + cooling-device = <&cpu0 15 15>;
249     +};
250     diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi
251     index 40beede46e55..3ebdf01d814c 100644
252     --- a/arch/arm/boot/dts/exynos4412.dtsi
253     +++ b/arch/arm/boot/dts/exynos4412.dtsi
254     @@ -130,7 +130,7 @@
255     opp-microvolt = <1287500>;
256     clock-latency-ns = <200000>;
257     };
258     - opp@1500000000 {
259     + cpu0_opp_1500: opp@1500000000 {
260     opp-hz = /bits/ 64 <1500000000>;
261     opp-microvolt = <1350000>;
262     clock-latency-ns = <200000>;
263     diff --git a/arch/arm/boot/dts/mt2701.dtsi b/arch/arm/boot/dts/mt2701.dtsi
264     index 18596a2c58a1..77c6b931dc24 100644
265     --- a/arch/arm/boot/dts/mt2701.dtsi
266     +++ b/arch/arm/boot/dts/mt2701.dtsi
267     @@ -174,4 +174,40 @@
268     clocks = <&uart_clk>;
269     status = "disabled";
270     };
271     +
272     + mmsys: syscon@14000000 {
273     + compatible = "mediatek,mt2701-mmsys", "syscon";
274     + reg = <0 0x14000000 0 0x1000>;
275     + #clock-cells = <1>;
276     + };
277     +
278     + imgsys: syscon@15000000 {
279     + compatible = "mediatek,mt2701-imgsys", "syscon";
280     + reg = <0 0x15000000 0 0x1000>;
281     + #clock-cells = <1>;
282     + };
283     +
284     + vdecsys: syscon@16000000 {
285     + compatible = "mediatek,mt2701-vdecsys", "syscon";
286     + reg = <0 0x16000000 0 0x1000>;
287     + #clock-cells = <1>;
288     + };
289     +
290     + hifsys: syscon@1a000000 {
291     + compatible = "mediatek,mt2701-hifsys", "syscon";
292     + reg = <0 0x1a000000 0 0x1000>;
293     + #clock-cells = <1>;
294     + };
295     +
296     + ethsys: syscon@1b000000 {
297     + compatible = "mediatek,mt2701-ethsys", "syscon";
298     + reg = <0 0x1b000000 0 0x1000>;
299     + #clock-cells = <1>;
300     + };
301     +
302     + bdpsys: syscon@1c000000 {
303     + compatible = "mediatek,mt2701-bdpsys", "syscon";
304     + reg = <0 0x1c000000 0 0x1000>;
305     + #clock-cells = <1>;
306     + };
307     };
308     diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
309     index 351fcc2f87df..b6c6410ca384 100644
310     --- a/arch/arm/boot/dts/r8a7790.dtsi
311     +++ b/arch/arm/boot/dts/r8a7790.dtsi
312     @@ -1493,7 +1493,8 @@
313     };
314    
315     msiof0: spi@e6e20000 {
316     - compatible = "renesas,msiof-r8a7790";
317     + compatible = "renesas,msiof-r8a7790",
318     + "renesas,rcar-gen2-msiof";
319     reg = <0 0xe6e20000 0 0x0064>;
320     interrupts = <GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>;
321     clocks = <&mstp0_clks R8A7790_CLK_MSIOF0>;
322     @@ -1507,7 +1508,8 @@
323     };
324    
325     msiof1: spi@e6e10000 {
326     - compatible = "renesas,msiof-r8a7790";
327     + compatible = "renesas,msiof-r8a7790",
328     + "renesas,rcar-gen2-msiof";
329     reg = <0 0xe6e10000 0 0x0064>;
330     interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>;
331     clocks = <&mstp2_clks R8A7790_CLK_MSIOF1>;
332     @@ -1521,7 +1523,8 @@
333     };
334    
335     msiof2: spi@e6e00000 {
336     - compatible = "renesas,msiof-r8a7790";
337     + compatible = "renesas,msiof-r8a7790",
338     + "renesas,rcar-gen2-msiof";
339     reg = <0 0xe6e00000 0 0x0064>;
340     interrupts = <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>;
341     clocks = <&mstp2_clks R8A7790_CLK_MSIOF2>;
342     @@ -1535,7 +1538,8 @@
343     };
344    
345     msiof3: spi@e6c90000 {
346     - compatible = "renesas,msiof-r8a7790";
347     + compatible = "renesas,msiof-r8a7790",
348     + "renesas,rcar-gen2-msiof";
349     reg = <0 0xe6c90000 0 0x0064>;
350     interrupts = <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH>;
351     clocks = <&mstp2_clks R8A7790_CLK_MSIOF3>;
352     diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
353     index 31dde8b6f2ea..8ba0e2e5ad97 100644
354     --- a/arch/arm/mach-at91/pm.c
355     +++ b/arch/arm/mach-at91/pm.c
356     @@ -335,7 +335,7 @@ static void at91sam9_sdram_standby(void)
357     at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1);
358     }
359    
360     -static const struct of_device_id const ramc_ids[] __initconst = {
361     +static const struct of_device_id ramc_ids[] __initconst = {
362     { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
363     { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
364     { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby },
365     diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c
366     index cf3f8658f0e5..a55a7ecf146a 100644
367     --- a/arch/arm/mach-bcm/bcm_kona_smc.c
368     +++ b/arch/arm/mach-bcm/bcm_kona_smc.c
369     @@ -33,7 +33,7 @@ struct bcm_kona_smc_data {
370     unsigned result;
371     };
372    
373     -static const struct of_device_id const bcm_kona_smc_ids[] __initconst = {
374     +static const struct of_device_id bcm_kona_smc_ids[] __initconst = {
375     {.compatible = "brcm,kona-smc"},
376     {.compatible = "bcm,kona-smc"}, /* deprecated name */
377     {},
378     diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c
379     index 03da3813f1ab..7d5a44a06648 100644
380     --- a/arch/arm/mach-cns3xxx/core.c
381     +++ b/arch/arm/mach-cns3xxx/core.c
382     @@ -346,7 +346,7 @@ static struct usb_ohci_pdata cns3xxx_usb_ohci_pdata = {
383     .power_off = csn3xxx_usb_power_off,
384     };
385    
386     -static const struct of_dev_auxdata const cns3xxx_auxdata[] __initconst = {
387     +static const struct of_dev_auxdata cns3xxx_auxdata[] __initconst = {
388     { "intel,usb-ehci", CNS3XXX_USB_BASE, "ehci-platform", &cns3xxx_usb_ehci_pdata },
389     { "intel,usb-ohci", CNS3XXX_USB_OHCI_BASE, "ohci-platform", &cns3xxx_usb_ohci_pdata },
390     { "cavium,cns3420-ahci", CNS3XXX_SATA2_BASE, "ahci", NULL },
391     diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
392     index 5b2f5138d938..f1ca9479491b 100644
393     --- a/arch/arm/mach-omap2/prm_common.c
394     +++ b/arch/arm/mach-omap2/prm_common.c
395     @@ -713,7 +713,7 @@ static struct omap_prcm_init_data scrm_data __initdata = {
396     };
397     #endif
398    
399     -static const struct of_device_id const omap_prcm_dt_match_table[] __initconst = {
400     +static const struct of_device_id omap_prcm_dt_match_table[] __initconst = {
401     #ifdef CONFIG_SOC_AM33XX
402     { .compatible = "ti,am3-prcm", .data = &am3_prm_data },
403     #endif
404     diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
405     index 2028167fff31..d76b1e5eb8ba 100644
406     --- a/arch/arm/mach-omap2/vc.c
407     +++ b/arch/arm/mach-omap2/vc.c
408     @@ -559,7 +559,7 @@ struct i2c_init_data {
409     u8 hsscll_12;
410     };
411    
412     -static const struct i2c_init_data const omap4_i2c_timing_data[] __initconst = {
413     +static const struct i2c_init_data omap4_i2c_timing_data[] __initconst = {
414     {
415     .load = 50,
416     .loadbits = 0x3,
417     diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c
418     index 9ccffc1d0f28..aaaa6781b9fe 100644
419     --- a/arch/arm/mach-spear/time.c
420     +++ b/arch/arm/mach-spear/time.c
421     @@ -204,7 +204,7 @@ static void __init spear_clockevent_init(int irq)
422     setup_irq(irq, &spear_timer_irq);
423     }
424    
425     -static const struct of_device_id const timer_of_match[] __initconst = {
426     +static const struct of_device_id timer_of_match[] __initconst = {
427     { .compatible = "st,spear-timer", },
428     { },
429     };
430     diff --git a/arch/mips/ath79/clock.c b/arch/mips/ath79/clock.c
431     index cc3a1e33a600..7e2bb12b64ea 100644
432     --- a/arch/mips/ath79/clock.c
433     +++ b/arch/mips/ath79/clock.c
434     @@ -508,16 +508,19 @@ static void __init ath79_clocks_init_dt_ng(struct device_node *np)
435     ar9330_clk_init(ref_clk, pll_base);
436     else {
437     pr_err("%s: could not find any appropriate clk_init()\n", dnfn);
438     - goto err_clk;
439     + goto err_iounmap;
440     }
441    
442     if (of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data)) {
443     pr_err("%s: could not register clk provider\n", dnfn);
444     - goto err_clk;
445     + goto err_iounmap;
446     }
447    
448     return;
449    
450     +err_iounmap:
451     + iounmap(pll_base);
452     +
453     err_clk:
454     clk_put(ref_clk);
455    
456     diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h
457     index 956db6e201d1..ddd1c918103b 100644
458     --- a/arch/mips/include/asm/irq.h
459     +++ b/arch/mips/include/asm/irq.h
460     @@ -18,9 +18,24 @@
461     #include <irq.h>
462    
463     #define IRQ_STACK_SIZE THREAD_SIZE
464     +#define IRQ_STACK_START (IRQ_STACK_SIZE - sizeof(unsigned long))
465    
466     extern void *irq_stack[NR_CPUS];
467    
468     +/*
469     + * The highest address on the IRQ stack contains a dummy frame put down in
470     + * genex.S (handle_int & except_vec_vi_handler) which is structured as follows:
471     + *
472     + * top ------------
473     + * | task sp | <- irq_stack[cpu] + IRQ_STACK_START
474     + * ------------
475     + * | | <- First frame of IRQ context
476     + * ------------
477     + *
478     + * task sp holds a copy of the task stack pointer where the struct pt_regs
479     + * from exception entry can be found.
480     + */
481     +
482     static inline bool on_irq_stack(int cpu, unsigned long sp)
483     {
484     unsigned long low = (unsigned long)irq_stack[cpu];
485     diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
486     index 4be2763f835d..bfff6ea45d51 100644
487     --- a/arch/mips/kernel/asm-offsets.c
488     +++ b/arch/mips/kernel/asm-offsets.c
489     @@ -103,6 +103,7 @@ void output_thread_info_defines(void)
490     DEFINE(_THREAD_SIZE, THREAD_SIZE);
491     DEFINE(_THREAD_MASK, THREAD_MASK);
492     DEFINE(_IRQ_STACK_SIZE, IRQ_STACK_SIZE);
493     + DEFINE(_IRQ_STACK_START, IRQ_STACK_START);
494     BLANK();
495     }
496    
497     diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
498     index 59476a607add..a00e87b0256d 100644
499     --- a/arch/mips/kernel/cps-vec.S
500     +++ b/arch/mips/kernel/cps-vec.S
501     @@ -361,7 +361,7 @@ LEAF(mips_cps_get_bootcfg)
502     END(mips_cps_get_bootcfg)
503    
504     LEAF(mips_cps_boot_vpes)
505     - PTR_L ta2, COREBOOTCFG_VPEMASK(a0)
506     + lw ta2, COREBOOTCFG_VPEMASK(a0)
507     PTR_L ta3, COREBOOTCFG_VPECONFIG(a0)
508    
509     #if defined(CONFIG_CPU_MIPSR6)
510     diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
511     index 2ac6c2625c13..ae810da4d499 100644
512     --- a/arch/mips/kernel/genex.S
513     +++ b/arch/mips/kernel/genex.S
514     @@ -215,9 +215,11 @@ NESTED(handle_int, PT_SIZE, sp)
515     beq t0, t1, 2f
516    
517     /* Switch to IRQ stack */
518     - li t1, _IRQ_STACK_SIZE
519     + li t1, _IRQ_STACK_START
520     PTR_ADD sp, t0, t1
521    
522     + /* Save task's sp on IRQ stack so that unwinding can follow it */
523     + LONG_S s1, 0(sp)
524     2:
525     jal plat_irq_dispatch
526    
527     @@ -325,9 +327,11 @@ NESTED(except_vec_vi_handler, 0, sp)
528     beq t0, t1, 2f
529    
530     /* Switch to IRQ stack */
531     - li t1, _IRQ_STACK_SIZE
532     + li t1, _IRQ_STACK_START
533     PTR_ADD sp, t0, t1
534    
535     + /* Save task's sp on IRQ stack so that unwinding can follow it */
536     + LONG_S s1, 0(sp)
537     2:
538     jalr v0
539    
540     diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
541     index fbbf5fcc695a..1b50958a1373 100644
542     --- a/arch/mips/kernel/process.c
543     +++ b/arch/mips/kernel/process.c
544     @@ -487,31 +487,52 @@ unsigned long notrace unwind_stack_by_address(unsigned long stack_page,
545     unsigned long pc,
546     unsigned long *ra)
547     {
548     + unsigned long low, high, irq_stack_high;
549     struct mips_frame_info info;
550     unsigned long size, ofs;
551     + struct pt_regs *regs;
552     int leaf;
553     - extern void ret_from_irq(void);
554     - extern void ret_from_exception(void);
555    
556     if (!stack_page)
557     return 0;
558    
559     /*
560     - * If we reached the bottom of interrupt context,
561     - * return saved pc in pt_regs.
562     + * IRQ stacks start at IRQ_STACK_START
563     + * task stacks at THREAD_SIZE - 32
564     */
565     - if (pc == (unsigned long)ret_from_irq ||
566     - pc == (unsigned long)ret_from_exception) {
567     - struct pt_regs *regs;
568     - if (*sp >= stack_page &&
569     - *sp + sizeof(*regs) <= stack_page + THREAD_SIZE - 32) {
570     - regs = (struct pt_regs *)*sp;
571     - pc = regs->cp0_epc;
572     - if (!user_mode(regs) && __kernel_text_address(pc)) {
573     - *sp = regs->regs[29];
574     - *ra = regs->regs[31];
575     - return pc;
576     - }
577     + low = stack_page;
578     + if (!preemptible() && on_irq_stack(raw_smp_processor_id(), *sp)) {
579     + high = stack_page + IRQ_STACK_START;
580     + irq_stack_high = high;
581     + } else {
582     + high = stack_page + THREAD_SIZE - 32;
583     + irq_stack_high = 0;
584     + }
585     +
586     + /*
587     + * If we reached the top of the interrupt stack, start unwinding
588     + * the interrupted task stack.
589     + */
590     + if (unlikely(*sp == irq_stack_high)) {
591     + unsigned long task_sp = *(unsigned long *)*sp;
592     +
593     + /*
594     + * Check that the pointer saved in the IRQ stack head points to
595     + * something within the stack of the current task
596     + */
597     + if (!object_is_on_stack((void *)task_sp))
598     + return 0;
599     +
600     + /*
601     + * Follow pointer to tasks kernel stack frame where interrupted
602     + * state was saved.
603     + */
604     + regs = (struct pt_regs *)task_sp;
605     + pc = regs->cp0_epc;
606     + if (!user_mode(regs) && __kernel_text_address(pc)) {
607     + *sp = regs->regs[29];
608     + *ra = regs->regs[31];
609     + return pc;
610     }
611     return 0;
612     }
613     @@ -532,8 +553,7 @@ unsigned long notrace unwind_stack_by_address(unsigned long stack_page,
614     if (leaf < 0)
615     return 0;
616    
617     - if (*sp < stack_page ||
618     - *sp + info.frame_size > stack_page + THREAD_SIZE - 32)
619     + if (*sp < low || *sp + info.frame_size > high)
620     return 0;
621    
622     if (leaf)
623     diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
624     index d5de67591735..f0a0e6d62be3 100644
625     --- a/arch/mips/kernel/vmlinux.lds.S
626     +++ b/arch/mips/kernel/vmlinux.lds.S
627     @@ -182,7 +182,7 @@ SECTIONS
628     * Force .bss to 64K alignment so that .bss..swapper_pg_dir
629     * gets that alignment. .sbss should be empty, so there will be
630     * no holes after __init_end. */
631     - BSS_SECTION(0, 0x10000, 0)
632     + BSS_SECTION(0, 0x10000, 8)
633    
634     _end = . ;
635    
636     diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
637     index 90565477dfbd..95bec460b651 100644
638     --- a/arch/mips/lantiq/xway/sysctrl.c
639     +++ b/arch/mips/lantiq/xway/sysctrl.c
640     @@ -469,8 +469,8 @@ void __init ltq_soc_init(void)
641     panic("Failed to load xbar nodes from devicetree");
642     if (of_address_to_resource(np_xbar, 0, &res_xbar))
643     panic("Failed to get xbar resources");
644     - if (request_mem_region(res_xbar.start, resource_size(&res_xbar),
645     - res_xbar.name) < 0)
646     + if (!request_mem_region(res_xbar.start, resource_size(&res_xbar),
647     + res_xbar.name))
648     panic("Failed to get xbar resources");
649    
650     ltq_xbar_membase = ioremap_nocache(res_xbar.start,
651     diff --git a/arch/mips/ralink/mt7620.c b/arch/mips/ralink/mt7620.c
652     index 3c7c9bf57bf3..6f892c1f3ad7 100644
653     --- a/arch/mips/ralink/mt7620.c
654     +++ b/arch/mips/ralink/mt7620.c
655     @@ -176,7 +176,7 @@ static struct rt2880_pmx_func spi_cs1_grp_mt7628[] = {
656    
657     static struct rt2880_pmx_func spis_grp_mt7628[] = {
658     FUNC("pwm_uart2", 3, 14, 4),
659     - FUNC("util", 2, 14, 4),
660     + FUNC("utif", 2, 14, 4),
661     FUNC("gpio", 1, 14, 4),
662     FUNC("spis", 0, 14, 4),
663     };
664     @@ -190,28 +190,28 @@ static struct rt2880_pmx_func gpio_grp_mt7628[] = {
665    
666     static struct rt2880_pmx_func p4led_kn_grp_mt7628[] = {
667     FUNC("jtag", 3, 30, 1),
668     - FUNC("util", 2, 30, 1),
669     + FUNC("utif", 2, 30, 1),
670     FUNC("gpio", 1, 30, 1),
671     FUNC("p4led_kn", 0, 30, 1),
672     };
673    
674     static struct rt2880_pmx_func p3led_kn_grp_mt7628[] = {
675     FUNC("jtag", 3, 31, 1),
676     - FUNC("util", 2, 31, 1),
677     + FUNC("utif", 2, 31, 1),
678     FUNC("gpio", 1, 31, 1),
679     FUNC("p3led_kn", 0, 31, 1),
680     };
681    
682     static struct rt2880_pmx_func p2led_kn_grp_mt7628[] = {
683     FUNC("jtag", 3, 32, 1),
684     - FUNC("util", 2, 32, 1),
685     + FUNC("utif", 2, 32, 1),
686     FUNC("gpio", 1, 32, 1),
687     FUNC("p2led_kn", 0, 32, 1),
688     };
689    
690     static struct rt2880_pmx_func p1led_kn_grp_mt7628[] = {
691     FUNC("jtag", 3, 33, 1),
692     - FUNC("util", 2, 33, 1),
693     + FUNC("utif", 2, 33, 1),
694     FUNC("gpio", 1, 33, 1),
695     FUNC("p1led_kn", 0, 33, 1),
696     };
697     @@ -232,28 +232,28 @@ static struct rt2880_pmx_func wled_kn_grp_mt7628[] = {
698    
699     static struct rt2880_pmx_func p4led_an_grp_mt7628[] = {
700     FUNC("jtag", 3, 39, 1),
701     - FUNC("util", 2, 39, 1),
702     + FUNC("utif", 2, 39, 1),
703     FUNC("gpio", 1, 39, 1),
704     FUNC("p4led_an", 0, 39, 1),
705     };
706    
707     static struct rt2880_pmx_func p3led_an_grp_mt7628[] = {
708     FUNC("jtag", 3, 40, 1),
709     - FUNC("util", 2, 40, 1),
710     + FUNC("utif", 2, 40, 1),
711     FUNC("gpio", 1, 40, 1),
712     FUNC("p3led_an", 0, 40, 1),
713     };
714    
715     static struct rt2880_pmx_func p2led_an_grp_mt7628[] = {
716     FUNC("jtag", 3, 41, 1),
717     - FUNC("util", 2, 41, 1),
718     + FUNC("utif", 2, 41, 1),
719     FUNC("gpio", 1, 41, 1),
720     FUNC("p2led_an", 0, 41, 1),
721     };
722    
723     static struct rt2880_pmx_func p1led_an_grp_mt7628[] = {
724     FUNC("jtag", 3, 42, 1),
725     - FUNC("util", 2, 42, 1),
726     + FUNC("utif", 2, 42, 1),
727     FUNC("gpio", 1, 42, 1),
728     FUNC("p1led_an", 0, 42, 1),
729     };
730     diff --git a/arch/mips/ralink/rt3883.c b/arch/mips/ralink/rt3883.c
731     index 9e4631acfcb5..3e68e35daf21 100644
732     --- a/arch/mips/ralink/rt3883.c
733     +++ b/arch/mips/ralink/rt3883.c
734     @@ -145,5 +145,5 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
735    
736     rt2880_pinmux_data = rt3883_pinmux_data;
737    
738     - ralink_soc == RT3883_SOC;
739     + ralink_soc = RT3883_SOC;
740     }
741     diff --git a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c
742     index 518f4f5f1f43..d63d42533133 100644
743     --- a/arch/parisc/kernel/perf.c
744     +++ b/arch/parisc/kernel/perf.c
745     @@ -39,7 +39,7 @@
746     * the PDC INTRIGUE calls. This is done to eliminate bugs introduced
747     * in various PDC revisions. The code is much more maintainable
748     * and reliable this way vs having to debug on every version of PDC
749     - * on every box.
750     + * on every box.
751     */
752    
753     #include <linux/capability.h>
754     @@ -195,8 +195,8 @@ static int perf_config(uint32_t *image_ptr);
755     static int perf_release(struct inode *inode, struct file *file);
756     static int perf_open(struct inode *inode, struct file *file);
757     static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t *ppos);
758     -static ssize_t perf_write(struct file *file, const char __user *buf, size_t count,
759     - loff_t *ppos);
760     +static ssize_t perf_write(struct file *file, const char __user *buf,
761     + size_t count, loff_t *ppos);
762     static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
763     static void perf_start_counters(void);
764     static int perf_stop_counters(uint32_t *raddr);
765     @@ -222,7 +222,7 @@ extern void perf_intrigue_disable_perf_counters (void);
766     /*
767     * configure:
768     *
769     - * Configure the cpu with a given data image. First turn off the counters,
770     + * Configure the cpu with a given data image. First turn off the counters,
771     * then download the image, then turn the counters back on.
772     */
773     static int perf_config(uint32_t *image_ptr)
774     @@ -234,7 +234,7 @@ static int perf_config(uint32_t *image_ptr)
775     error = perf_stop_counters(raddr);
776     if (error != 0) {
777     printk("perf_config: perf_stop_counters = %ld\n", error);
778     - return -EINVAL;
779     + return -EINVAL;
780     }
781    
782     printk("Preparing to write image\n");
783     @@ -242,7 +242,7 @@ printk("Preparing to write image\n");
784     error = perf_write_image((uint64_t *)image_ptr);
785     if (error != 0) {
786     printk("perf_config: DOWNLOAD = %ld\n", error);
787     - return -EINVAL;
788     + return -EINVAL;
789     }
790    
791     printk("Preparing to start counters\n");
792     @@ -254,7 +254,7 @@ printk("Preparing to start counters\n");
793     }
794    
795     /*
796     - * Open the device and initialize all of its memory. The device is only
797     + * Open the device and initialize all of its memory. The device is only
798     * opened once, but can be "queried" by multiple processes that know its
799     * file descriptor.
800     */
801     @@ -298,8 +298,8 @@ static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t
802     * called on the processor that the download should happen
803     * on.
804     */
805     -static ssize_t perf_write(struct file *file, const char __user *buf, size_t count,
806     - loff_t *ppos)
807     +static ssize_t perf_write(struct file *file, const char __user *buf,
808     + size_t count, loff_t *ppos)
809     {
810     int err;
811     size_t image_size;
812     @@ -307,11 +307,11 @@ static ssize_t perf_write(struct file *file, const char __user *buf, size_t coun
813     uint32_t interface_type;
814     uint32_t test;
815    
816     - if (perf_processor_interface == ONYX_INTF)
817     + if (perf_processor_interface == ONYX_INTF)
818     image_size = PCXU_IMAGE_SIZE;
819     - else if (perf_processor_interface == CUDA_INTF)
820     + else if (perf_processor_interface == CUDA_INTF)
821     image_size = PCXW_IMAGE_SIZE;
822     - else
823     + else
824     return -EFAULT;
825    
826     if (!capable(CAP_SYS_ADMIN))
827     @@ -331,22 +331,22 @@ static ssize_t perf_write(struct file *file, const char __user *buf, size_t coun
828    
829     /* First check the machine type is correct for
830     the requested image */
831     - if (((perf_processor_interface == CUDA_INTF) &&
832     - (interface_type != CUDA_INTF)) ||
833     - ((perf_processor_interface == ONYX_INTF) &&
834     - (interface_type != ONYX_INTF)))
835     + if (((perf_processor_interface == CUDA_INTF) &&
836     + (interface_type != CUDA_INTF)) ||
837     + ((perf_processor_interface == ONYX_INTF) &&
838     + (interface_type != ONYX_INTF)))
839     return -EINVAL;
840    
841     /* Next check to make sure the requested image
842     is valid */
843     - if (((interface_type == CUDA_INTF) &&
844     + if (((interface_type == CUDA_INTF) &&
845     (test >= MAX_CUDA_IMAGES)) ||
846     - ((interface_type == ONYX_INTF) &&
847     - (test >= MAX_ONYX_IMAGES)))
848     + ((interface_type == ONYX_INTF) &&
849     + (test >= MAX_ONYX_IMAGES)))
850     return -EINVAL;
851    
852     /* Copy the image into the processor */
853     - if (interface_type == CUDA_INTF)
854     + if (interface_type == CUDA_INTF)
855     return perf_config(cuda_images[test]);
856     else
857     return perf_config(onyx_images[test]);
858     @@ -360,7 +360,7 @@ static ssize_t perf_write(struct file *file, const char __user *buf, size_t coun
859     static void perf_patch_images(void)
860     {
861     #if 0 /* FIXME!! */
862     -/*
863     +/*
864     * NOTE: this routine is VERY specific to the current TLB image.
865     * If the image is changed, this routine might also need to be changed.
866     */
867     @@ -368,9 +368,9 @@ static void perf_patch_images(void)
868     extern void $i_dtlb_miss_2_0();
869     extern void PA2_0_iva();
870    
871     - /*
872     + /*
873     * We can only use the lower 32-bits, the upper 32-bits should be 0
874     - * anyway given this is in the kernel
875     + * anyway given this is in the kernel
876     */
877     uint32_t itlb_addr = (uint32_t)&($i_itlb_miss_2_0);
878     uint32_t dtlb_addr = (uint32_t)&($i_dtlb_miss_2_0);
879     @@ -378,21 +378,21 @@ static void perf_patch_images(void)
880    
881     if (perf_processor_interface == ONYX_INTF) {
882     /* clear last 2 bytes */
883     - onyx_images[TLBMISS][15] &= 0xffffff00;
884     + onyx_images[TLBMISS][15] &= 0xffffff00;
885     /* set 2 bytes */
886     onyx_images[TLBMISS][15] |= (0x000000ff&((dtlb_addr) >> 24));
887     onyx_images[TLBMISS][16] = (dtlb_addr << 8)&0xffffff00;
888     onyx_images[TLBMISS][17] = itlb_addr;
889    
890     /* clear last 2 bytes */
891     - onyx_images[TLBHANDMISS][15] &= 0xffffff00;
892     + onyx_images[TLBHANDMISS][15] &= 0xffffff00;
893     /* set 2 bytes */
894     onyx_images[TLBHANDMISS][15] |= (0x000000ff&((dtlb_addr) >> 24));
895     onyx_images[TLBHANDMISS][16] = (dtlb_addr << 8)&0xffffff00;
896     onyx_images[TLBHANDMISS][17] = itlb_addr;
897    
898     /* clear last 2 bytes */
899     - onyx_images[BIG_CPI][15] &= 0xffffff00;
900     + onyx_images[BIG_CPI][15] &= 0xffffff00;
901     /* set 2 bytes */
902     onyx_images[BIG_CPI][15] |= (0x000000ff&((dtlb_addr) >> 24));
903     onyx_images[BIG_CPI][16] = (dtlb_addr << 8)&0xffffff00;
904     @@ -405,24 +405,24 @@ static void perf_patch_images(void)
905    
906     } else if (perf_processor_interface == CUDA_INTF) {
907     /* Cuda interface */
908     - cuda_images[TLBMISS][16] =
909     + cuda_images[TLBMISS][16] =
910     (cuda_images[TLBMISS][16]&0xffff0000) |
911     ((dtlb_addr >> 8)&0x0000ffff);
912     - cuda_images[TLBMISS][17] =
913     + cuda_images[TLBMISS][17] =
914     ((dtlb_addr << 24)&0xff000000) | ((itlb_addr >> 16)&0x000000ff);
915     cuda_images[TLBMISS][18] = (itlb_addr << 16)&0xffff0000;
916    
917     - cuda_images[TLBHANDMISS][16] =
918     + cuda_images[TLBHANDMISS][16] =
919     (cuda_images[TLBHANDMISS][16]&0xffff0000) |
920     ((dtlb_addr >> 8)&0x0000ffff);
921     - cuda_images[TLBHANDMISS][17] =
922     + cuda_images[TLBHANDMISS][17] =
923     ((dtlb_addr << 24)&0xff000000) | ((itlb_addr >> 16)&0x000000ff);
924     cuda_images[TLBHANDMISS][18] = (itlb_addr << 16)&0xffff0000;
925    
926     - cuda_images[BIG_CPI][16] =
927     + cuda_images[BIG_CPI][16] =
928     (cuda_images[BIG_CPI][16]&0xffff0000) |
929     ((dtlb_addr >> 8)&0x0000ffff);
930     - cuda_images[BIG_CPI][17] =
931     + cuda_images[BIG_CPI][17] =
932     ((dtlb_addr << 24)&0xff000000) | ((itlb_addr >> 16)&0x000000ff);
933     cuda_images[BIG_CPI][18] = (itlb_addr << 16)&0xffff0000;
934     } else {
935     @@ -434,7 +434,7 @@ static void perf_patch_images(void)
936    
937     /*
938     * ioctl routine
939     - * All routines effect the processor that they are executed on. Thus you
940     + * All routines effect the processor that they are executed on. Thus you
941     * must be running on the processor that you wish to change.
942     */
943    
944     @@ -460,7 +460,7 @@ static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
945     }
946    
947     /* copy out the Counters */
948     - if (copy_to_user((void __user *)arg, raddr,
949     + if (copy_to_user((void __user *)arg, raddr,
950     sizeof (raddr)) != 0) {
951     error = -EFAULT;
952     break;
953     @@ -488,7 +488,7 @@ static const struct file_operations perf_fops = {
954     .open = perf_open,
955     .release = perf_release
956     };
957     -
958     +
959     static struct miscdevice perf_dev = {
960     MISC_DYNAMIC_MINOR,
961     PA_PERF_DEV,
962     @@ -596,7 +596,7 @@ static int perf_stop_counters(uint32_t *raddr)
963     /* OR sticky2 (bit 1496) to counter2 bit 32 */
964     tmp64 |= (userbuf[23] >> 8) & 0x0000000080000000;
965     raddr[2] = (uint32_t)tmp64;
966     -
967     +
968     /* Counter3 is bits 1497 to 1528 */
969     tmp64 = (userbuf[23] >> 7) & 0x00000000ffffffff;
970     /* OR sticky3 (bit 1529) to counter3 bit 32 */
971     @@ -618,7 +618,7 @@ static int perf_stop_counters(uint32_t *raddr)
972     userbuf[22] = 0;
973     userbuf[23] = 0;
974    
975     - /*
976     + /*
977     * Write back the zeroed bytes + the image given
978     * the read was destructive.
979     */
980     @@ -626,13 +626,13 @@ static int perf_stop_counters(uint32_t *raddr)
981     } else {
982    
983     /*
984     - * Read RDR-15 which contains the counters and sticky bits
985     + * Read RDR-15 which contains the counters and sticky bits
986     */
987     if (!perf_rdr_read_ubuf(15, userbuf)) {
988     return -13;
989     }
990    
991     - /*
992     + /*
993     * Clear out the counters
994     */
995     perf_rdr_clear(15);
996     @@ -645,7 +645,7 @@ static int perf_stop_counters(uint32_t *raddr)
997     raddr[2] = (uint32_t)((userbuf[1] >> 32) & 0x00000000ffffffffUL);
998     raddr[3] = (uint32_t)(userbuf[1] & 0x00000000ffffffffUL);
999     }
1000     -
1001     +
1002     return 0;
1003     }
1004    
1005     @@ -683,7 +683,7 @@ static int perf_rdr_read_ubuf(uint32_t rdr_num, uint64_t *buffer)
1006     i = tentry->num_words;
1007     while (i--) {
1008     buffer[i] = 0;
1009     - }
1010     + }
1011    
1012     /* Check for bits an even number of 64 */
1013     if ((xbits = width & 0x03f) != 0) {
1014     @@ -809,18 +809,22 @@ static int perf_write_image(uint64_t *memaddr)
1015     }
1016    
1017     runway = ioremap_nocache(cpu_device->hpa.start, 4096);
1018     + if (!runway) {
1019     + pr_err("perf_write_image: ioremap failed!\n");
1020     + return -ENOMEM;
1021     + }
1022    
1023     /* Merge intrigue bits into Runway STATUS 0 */
1024     tmp64 = __raw_readq(runway + RUNWAY_STATUS) & 0xffecfffffffffffful;
1025     - __raw_writeq(tmp64 | (*memaddr++ & 0x0013000000000000ul),
1026     + __raw_writeq(tmp64 | (*memaddr++ & 0x0013000000000000ul),
1027     runway + RUNWAY_STATUS);
1028     -
1029     +
1030     /* Write RUNWAY DEBUG registers */
1031     for (i = 0; i < 8; i++) {
1032     __raw_writeq(*memaddr++, runway + RUNWAY_DEBUG);
1033     }
1034    
1035     - return 0;
1036     + return 0;
1037     }
1038    
1039     /*
1040     @@ -844,7 +848,7 @@ printk("perf_rdr_write\n");
1041     perf_rdr_shift_out_U(rdr_num, buffer[i]);
1042     } else {
1043     perf_rdr_shift_out_W(rdr_num, buffer[i]);
1044     - }
1045     + }
1046     }
1047     printk("perf_rdr_write done\n");
1048     }
1049     diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
1050     index d33f245af5e9..db74d398a443 100644
1051     --- a/arch/s390/include/asm/pgtable.h
1052     +++ b/arch/s390/include/asm/pgtable.h
1053     @@ -1359,7 +1359,9 @@ static inline pmd_t pmdp_huge_clear_flush(struct vm_area_struct *vma,
1054     static inline void pmdp_invalidate(struct vm_area_struct *vma,
1055     unsigned long addr, pmd_t *pmdp)
1056     {
1057     - pmdp_xchg_direct(vma->vm_mm, addr, pmdp, __pmd(_SEGMENT_ENTRY_INVALID));
1058     + pmd_t pmd = __pmd(pmd_val(*pmdp) | _SEGMENT_ENTRY_INVALID);
1059     +
1060     + pmdp_xchg_direct(vma->vm_mm, addr, pmdp, pmd);
1061     }
1062    
1063     #define __HAVE_ARCH_PMDP_SET_WRPROTECT
1064     diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
1065     index d3e0d049a0c2..b89bef95f63b 100644
1066     --- a/arch/x86/kernel/acpi/boot.c
1067     +++ b/arch/x86/kernel/acpi/boot.c
1068     @@ -176,10 +176,15 @@ static int acpi_register_lapic(int id, u32 acpiid, u8 enabled)
1069     return -EINVAL;
1070     }
1071    
1072     + if (!enabled) {
1073     + ++disabled_cpus;
1074     + return -EINVAL;
1075     + }
1076     +
1077     if (boot_cpu_physical_apicid != -1U)
1078     ver = boot_cpu_apic_version;
1079    
1080     - cpu = __generic_processor_info(id, ver, enabled);
1081     + cpu = generic_processor_info(id, ver);
1082     if (cpu >= 0)
1083     early_per_cpu(x86_cpu_to_acpiid, cpu) = acpiid;
1084    
1085     diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
1086     index f2234918e494..e2ead34da465 100644
1087     --- a/arch/x86/kernel/apic/apic.c
1088     +++ b/arch/x86/kernel/apic/apic.c
1089     @@ -2070,7 +2070,7 @@ static int allocate_logical_cpuid(int apicid)
1090     return nr_logical_cpuids++;
1091     }
1092    
1093     -int __generic_processor_info(int apicid, int version, bool enabled)
1094     +int generic_processor_info(int apicid, int version)
1095     {
1096     int cpu, max = nr_cpu_ids;
1097     bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid,
1098     @@ -2128,11 +2128,9 @@ int __generic_processor_info(int apicid, int version, bool enabled)
1099     if (num_processors >= nr_cpu_ids) {
1100     int thiscpu = max + disabled_cpus;
1101    
1102     - if (enabled) {
1103     - pr_warning("APIC: NR_CPUS/possible_cpus limit of %i "
1104     - "reached. Processor %d/0x%x ignored.\n",
1105     - max, thiscpu, apicid);
1106     - }
1107     + pr_warning("APIC: NR_CPUS/possible_cpus limit of %i "
1108     + "reached. Processor %d/0x%x ignored.\n",
1109     + max, thiscpu, apicid);
1110    
1111     disabled_cpus++;
1112     return -EINVAL;
1113     @@ -2184,23 +2182,13 @@ int __generic_processor_info(int apicid, int version, bool enabled)
1114     apic->x86_32_early_logical_apicid(cpu);
1115     #endif
1116     set_cpu_possible(cpu, true);
1117     -
1118     - if (enabled) {
1119     - num_processors++;
1120     - physid_set(apicid, phys_cpu_present_map);
1121     - set_cpu_present(cpu, true);
1122     - } else {
1123     - disabled_cpus++;
1124     - }
1125     + physid_set(apicid, phys_cpu_present_map);
1126     + set_cpu_present(cpu, true);
1127     + num_processors++;
1128    
1129     return cpu;
1130     }
1131    
1132     -int generic_processor_info(int apicid, int version)
1133     -{
1134     - return __generic_processor_info(apicid, version, true);
1135     -}
1136     -
1137     int hard_smp_processor_id(void)
1138     {
1139     return read_apic_id();
1140     diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
1141     index 555b9fa0ad43..7dbdb780264d 100644
1142     --- a/arch/x86/purgatory/Makefile
1143     +++ b/arch/x86/purgatory/Makefile
1144     @@ -8,6 +8,7 @@ PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
1145     LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib
1146     targets += purgatory.ro
1147    
1148     +KASAN_SANITIZE := n
1149     KCOV_INSTRUMENT := n
1150    
1151     # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
1152     diff --git a/block/partitions/efi.c b/block/partitions/efi.c
1153     index bcd86e5cd546..39f70d968754 100644
1154     --- a/block/partitions/efi.c
1155     +++ b/block/partitions/efi.c
1156     @@ -293,7 +293,7 @@ static gpt_entry *alloc_read_gpt_entries(struct parsed_partitions *state,
1157     if (!gpt)
1158     return NULL;
1159    
1160     - count = le32_to_cpu(gpt->num_partition_entries) *
1161     + count = (size_t)le32_to_cpu(gpt->num_partition_entries) *
1162     le32_to_cpu(gpt->sizeof_partition_entry);
1163     if (!count)
1164     return NULL;
1165     @@ -352,7 +352,7 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba,
1166     gpt_header **gpt, gpt_entry **ptes)
1167     {
1168     u32 crc, origcrc;
1169     - u64 lastlba;
1170     + u64 lastlba, pt_size;
1171    
1172     if (!ptes)
1173     return 0;
1174     @@ -434,13 +434,20 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba,
1175     goto fail;
1176     }
1177    
1178     + /* Sanity check partition table size */
1179     + pt_size = (u64)le32_to_cpu((*gpt)->num_partition_entries) *
1180     + le32_to_cpu((*gpt)->sizeof_partition_entry);
1181     + if (pt_size > KMALLOC_MAX_SIZE) {
1182     + pr_debug("GUID Partition Table is too large: %llu > %lu bytes\n",
1183     + (unsigned long long)pt_size, KMALLOC_MAX_SIZE);
1184     + goto fail;
1185     + }
1186     +
1187     if (!(*ptes = alloc_read_gpt_entries(state, *gpt)))
1188     goto fail;
1189    
1190     /* Check the GUID Partition Entry Array CRC */
1191     - crc = efi_crc32((const unsigned char *) (*ptes),
1192     - le32_to_cpu((*gpt)->num_partition_entries) *
1193     - le32_to_cpu((*gpt)->sizeof_partition_entry));
1194     + crc = efi_crc32((const unsigned char *) (*ptes), pt_size);
1195    
1196     if (crc != le32_to_cpu((*gpt)->partition_entry_array_crc32)) {
1197     pr_debug("GUID Partition Entry Array CRC check failed.\n");
1198     diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
1199     index 7ef16c085058..20e2b7ad8925 100644
1200     --- a/drivers/ata/libata-transport.c
1201     +++ b/drivers/ata/libata-transport.c
1202     @@ -224,7 +224,6 @@ static DECLARE_TRANSPORT_CLASS(ata_port_class,
1203    
1204     static void ata_tport_release(struct device *dev)
1205     {
1206     - put_device(dev->parent);
1207     }
1208    
1209     /**
1210     @@ -284,7 +283,7 @@ int ata_tport_add(struct device *parent,
1211     device_initialize(dev);
1212     dev->type = &ata_port_type;
1213    
1214     - dev->parent = get_device(parent);
1215     + dev->parent = parent;
1216     dev->release = ata_tport_release;
1217     dev_set_name(dev, "ata%d", ap->print_id);
1218     transport_setup_device(dev);
1219     @@ -348,7 +347,6 @@ static DECLARE_TRANSPORT_CLASS(ata_link_class,
1220    
1221     static void ata_tlink_release(struct device *dev)
1222     {
1223     - put_device(dev->parent);
1224     }
1225    
1226     /**
1227     @@ -410,7 +408,7 @@ int ata_tlink_add(struct ata_link *link)
1228     int error;
1229    
1230     device_initialize(dev);
1231     - dev->parent = get_device(&ap->tdev);
1232     + dev->parent = &ap->tdev;
1233     dev->release = ata_tlink_release;
1234     if (ata_is_host_link(link))
1235     dev_set_name(dev, "link%d", ap->print_id);
1236     @@ -589,7 +587,6 @@ static DECLARE_TRANSPORT_CLASS(ata_dev_class,
1237    
1238     static void ata_tdev_release(struct device *dev)
1239     {
1240     - put_device(dev->parent);
1241     }
1242    
1243     /**
1244     @@ -662,7 +659,7 @@ static int ata_tdev_add(struct ata_device *ata_dev)
1245     int error;
1246    
1247     device_initialize(dev);
1248     - dev->parent = get_device(&link->tdev);
1249     + dev->parent = &link->tdev;
1250     dev->release = ata_tdev_release;
1251     if (ata_is_host_link(link))
1252     dev_set_name(dev, "dev%d.%d", ap->print_id,ata_dev->devno);
1253     diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
1254     index 0636d84fbefe..f3f538eec7b3 100644
1255     --- a/drivers/ata/sata_via.c
1256     +++ b/drivers/ata/sata_via.c
1257     @@ -644,14 +644,16 @@ static void svia_configure(struct pci_dev *pdev, int board_id,
1258     pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
1259     }
1260    
1261     - /* enable IRQ on hotplug */
1262     - pci_read_config_byte(pdev, SVIA_MISC_3, &tmp8);
1263     - if ((tmp8 & SATA_HOTPLUG) != SATA_HOTPLUG) {
1264     - dev_dbg(&pdev->dev,
1265     - "enabling SATA hotplug (0x%x)\n",
1266     - (int) tmp8);
1267     - tmp8 |= SATA_HOTPLUG;
1268     - pci_write_config_byte(pdev, SVIA_MISC_3, tmp8);
1269     + if (board_id == vt6421) {
1270     + /* enable IRQ on hotplug */
1271     + pci_read_config_byte(pdev, SVIA_MISC_3, &tmp8);
1272     + if ((tmp8 & SATA_HOTPLUG) != SATA_HOTPLUG) {
1273     + dev_dbg(&pdev->dev,
1274     + "enabling SATA hotplug (0x%x)\n",
1275     + (int) tmp8);
1276     + tmp8 |= SATA_HOTPLUG;
1277     + pci_write_config_byte(pdev, SVIA_MISC_3, tmp8);
1278     + }
1279     }
1280    
1281     /*
1282     diff --git a/drivers/clk/axs10x/i2s_pll_clock.c b/drivers/clk/axs10x/i2s_pll_clock.c
1283     index 411310d29581..02d3bcd6216c 100644
1284     --- a/drivers/clk/axs10x/i2s_pll_clock.c
1285     +++ b/drivers/clk/axs10x/i2s_pll_clock.c
1286     @@ -182,6 +182,7 @@ static int i2s_pll_clk_probe(struct platform_device *pdev)
1287     if (IS_ERR(pll_clk->base))
1288     return PTR_ERR(pll_clk->base);
1289    
1290     + memset(&init, 0, sizeof(init));
1291     clk_name = node->name;
1292     init.name = clk_name;
1293     init.ops = &i2s_pll_ops;
1294     diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
1295     index 21c427d86f28..a26c8a19fe93 100644
1296     --- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
1297     +++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
1298     @@ -803,6 +803,13 @@ static const struct sunxi_ccu_desc sun8i_h3_ccu_desc = {
1299     .num_resets = ARRAY_SIZE(sun8i_h3_ccu_resets),
1300     };
1301    
1302     +static struct ccu_mux_nb sun8i_h3_cpu_nb = {
1303     + .common = &cpux_clk.common,
1304     + .cm = &cpux_clk.mux,
1305     + .delay_us = 1, /* > 8 clock cycles at 24 MHz */
1306     + .bypass_index = 1, /* index of 24 MHz oscillator */
1307     +};
1308     +
1309     static void __init sun8i_h3_ccu_setup(struct device_node *node)
1310     {
1311     void __iomem *reg;
1312     @@ -821,6 +828,9 @@ static void __init sun8i_h3_ccu_setup(struct device_node *node)
1313     writel(val | (3 << 16), reg + SUN8I_H3_PLL_AUDIO_REG);
1314    
1315     sunxi_ccu_probe(node, reg, &sun8i_h3_ccu_desc);
1316     +
1317     + ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
1318     + &sun8i_h3_cpu_nb);
1319     }
1320     CLK_OF_DECLARE(sun8i_h3_ccu, "allwinner,sun8i-h3-ccu",
1321     sun8i_h3_ccu_setup);
1322     diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
1323     index 80fa656da5ab..a59ae8e24d3d 100644
1324     --- a/drivers/cpufreq/intel_pstate.c
1325     +++ b/drivers/cpufreq/intel_pstate.c
1326     @@ -609,6 +609,7 @@ static void intel_pstate_hwp_set_online_cpus(void)
1327     static int pid_param_set(void *data, u64 val)
1328     {
1329     *(u32 *)data = val;
1330     + pid_params.sample_rate_ns = pid_params.sample_rate_ms * NSEC_PER_MSEC;
1331     intel_pstate_reset_all_pid();
1332     return 0;
1333     }
1334     diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
1335     index 42f41e808292..27f67c28e700 100644
1336     --- a/drivers/extcon/extcon-axp288.c
1337     +++ b/drivers/extcon/extcon-axp288.c
1338     @@ -168,7 +168,7 @@ static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info)
1339     return ret;
1340     }
1341    
1342     - vbus_attach = (pwr_stat & PS_STAT_VBUS_PRESENT);
1343     + vbus_attach = (pwr_stat & PS_STAT_VBUS_VALID);
1344     if (!vbus_attach)
1345     goto notify_otg;
1346    
1347     diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
1348     index a6a4b2b1c0d9..6a3470f84998 100644
1349     --- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
1350     +++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
1351     @@ -739,8 +739,10 @@ int kfd_wait_on_events(struct kfd_process *p,
1352     struct kfd_event_data event_data;
1353    
1354     if (copy_from_user(&event_data, &events[i],
1355     - sizeof(struct kfd_event_data)))
1356     + sizeof(struct kfd_event_data))) {
1357     + ret = -EFAULT;
1358     goto fail;
1359     + }
1360    
1361     ret = init_event_waiter(p, &event_waiters[i],
1362     event_data.event_id, i);
1363     diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
1364     index 82c193e5e0d6..afe0480d95c9 100644
1365     --- a/drivers/gpu/drm/arm/malidp_planes.c
1366     +++ b/drivers/gpu/drm/arm/malidp_planes.c
1367     @@ -150,13 +150,8 @@ static void malidp_de_plane_update(struct drm_plane *plane,
1368     /* convert src values from Q16 fixed point to integer */
1369     src_w = plane->state->src_w >> 16;
1370     src_h = plane->state->src_h >> 16;
1371     - if (plane->state->rotation & MALIDP_ROTATED_MASK) {
1372     - dest_w = plane->state->crtc_h;
1373     - dest_h = plane->state->crtc_w;
1374     - } else {
1375     - dest_w = plane->state->crtc_w;
1376     - dest_h = plane->state->crtc_h;
1377     - }
1378     + dest_w = plane->state->crtc_w;
1379     + dest_h = plane->state->crtc_h;
1380    
1381     malidp_hw_write(mp->hwdev, format_id, mp->layer->base);
1382    
1383     @@ -189,9 +184,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
1384     if (plane->state->rotation & DRM_ROTATE_MASK)
1385     val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET;
1386     if (plane->state->rotation & DRM_REFLECT_X)
1387     - val |= LAYER_V_FLIP;
1388     - if (plane->state->rotation & DRM_REFLECT_Y)
1389     val |= LAYER_H_FLIP;
1390     + if (plane->state->rotation & DRM_REFLECT_Y)
1391     + val |= LAYER_V_FLIP;
1392    
1393     /* set the 'enable layer' bit */
1394     val |= LAYER_ENABLE;
1395     diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
1396     index a2655cd5a84e..8ab6f30dc23c 100644
1397     --- a/drivers/gpu/drm/i915/intel_overlay.c
1398     +++ b/drivers/gpu/drm/i915/intel_overlay.c
1399     @@ -272,8 +272,30 @@ static int intel_overlay_on(struct intel_overlay *overlay)
1400     return intel_overlay_do_wait_request(overlay, req, NULL);
1401     }
1402    
1403     +static void intel_overlay_flip_prepare(struct intel_overlay *overlay,
1404     + struct i915_vma *vma)
1405     +{
1406     + enum pipe pipe = overlay->crtc->pipe;
1407     +
1408     + WARN_ON(overlay->old_vma);
1409     +
1410     + i915_gem_track_fb(overlay->vma ? overlay->vma->obj : NULL,
1411     + vma ? vma->obj : NULL,
1412     + INTEL_FRONTBUFFER_OVERLAY(pipe));
1413     +
1414     + intel_frontbuffer_flip_prepare(overlay->i915,
1415     + INTEL_FRONTBUFFER_OVERLAY(pipe));
1416     +
1417     + overlay->old_vma = overlay->vma;
1418     + if (vma)
1419     + overlay->vma = i915_vma_get(vma);
1420     + else
1421     + overlay->vma = NULL;
1422     +}
1423     +
1424     /* overlay needs to be enabled in OCMD reg */
1425     static int intel_overlay_continue(struct intel_overlay *overlay,
1426     + struct i915_vma *vma,
1427     bool load_polyphase_filter)
1428     {
1429     struct drm_i915_private *dev_priv = overlay->i915;
1430     @@ -308,43 +330,44 @@ static int intel_overlay_continue(struct intel_overlay *overlay,
1431     intel_ring_emit(ring, flip_addr);
1432     intel_ring_advance(ring);
1433    
1434     + intel_overlay_flip_prepare(overlay, vma);
1435     +
1436     intel_overlay_submit_request(overlay, req, NULL);
1437    
1438     return 0;
1439     }
1440    
1441     -static void intel_overlay_release_old_vid_tail(struct i915_gem_active *active,
1442     - struct drm_i915_gem_request *req)
1443     +static void intel_overlay_release_old_vma(struct intel_overlay *overlay)
1444     {
1445     - struct intel_overlay *overlay =
1446     - container_of(active, typeof(*overlay), last_flip);
1447     struct i915_vma *vma;
1448    
1449     vma = fetch_and_zero(&overlay->old_vma);
1450     if (WARN_ON(!vma))
1451     return;
1452    
1453     - i915_gem_track_fb(vma->obj, NULL,
1454     - INTEL_FRONTBUFFER_OVERLAY(overlay->crtc->pipe));
1455     + intel_frontbuffer_flip_complete(overlay->i915,
1456     + INTEL_FRONTBUFFER_OVERLAY(overlay->crtc->pipe));
1457    
1458     i915_gem_object_unpin_from_display_plane(vma);
1459     i915_vma_put(vma);
1460     }
1461    
1462     +static void intel_overlay_release_old_vid_tail(struct i915_gem_active *active,
1463     + struct drm_i915_gem_request *req)
1464     +{
1465     + struct intel_overlay *overlay =
1466     + container_of(active, typeof(*overlay), last_flip);
1467     +
1468     + intel_overlay_release_old_vma(overlay);
1469     +}
1470     +
1471     static void intel_overlay_off_tail(struct i915_gem_active *active,
1472     struct drm_i915_gem_request *req)
1473     {
1474     struct intel_overlay *overlay =
1475     container_of(active, typeof(*overlay), last_flip);
1476     - struct i915_vma *vma;
1477     -
1478     - /* never have the overlay hw on without showing a frame */
1479     - vma = fetch_and_zero(&overlay->vma);
1480     - if (WARN_ON(!vma))
1481     - return;
1482    
1483     - i915_gem_object_unpin_from_display_plane(vma);
1484     - i915_vma_put(vma);
1485     + intel_overlay_release_old_vma(overlay);
1486    
1487     overlay->crtc->overlay = NULL;
1488     overlay->crtc = NULL;
1489     @@ -398,6 +421,8 @@ static int intel_overlay_off(struct intel_overlay *overlay)
1490     }
1491     intel_ring_advance(ring);
1492    
1493     + intel_overlay_flip_prepare(overlay, NULL);
1494     +
1495     return intel_overlay_do_wait_request(overlay, req,
1496     intel_overlay_off_tail);
1497     }
1498     @@ -836,18 +861,10 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
1499    
1500     intel_overlay_unmap_regs(overlay, regs);
1501    
1502     - ret = intel_overlay_continue(overlay, scale_changed);
1503     + ret = intel_overlay_continue(overlay, vma, scale_changed);
1504     if (ret)
1505     goto out_unpin;
1506    
1507     - i915_gem_track_fb(overlay->vma ? overlay->vma->obj : NULL,
1508     - vma->obj, INTEL_FRONTBUFFER_OVERLAY(pipe));
1509     -
1510     - overlay->old_vma = overlay->vma;
1511     - overlay->vma = vma;
1512     -
1513     - intel_frontbuffer_flip(dev_priv, INTEL_FRONTBUFFER_OVERLAY(pipe));
1514     -
1515     return 0;
1516    
1517     out_unpin:
1518     @@ -1215,6 +1232,7 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,
1519    
1520     mutex_unlock(&dev->struct_mutex);
1521     drm_modeset_unlock_all(dev);
1522     + i915_gem_object_put(new_bo);
1523    
1524     kfree(params);
1525    
1526     diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
1527     index 9b307cee3008..dff478498f05 100644
1528     --- a/drivers/gpu/drm/i915/intel_psr.c
1529     +++ b/drivers/gpu/drm/i915/intel_psr.c
1530     @@ -387,6 +387,13 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp)
1531     return false;
1532     }
1533    
1534     + /* PSR2 is restricted to work with panel resolutions upto 3200x2000 */
1535     + if (intel_crtc->config->pipe_src_w > 3200 ||
1536     + intel_crtc->config->pipe_src_h > 2000) {
1537     + dev_priv->psr.psr2_support = false;
1538     + return false;
1539     + }
1540     +
1541     dev_priv->psr.source_ok = true;
1542     return true;
1543     }
1544     @@ -425,7 +432,6 @@ void intel_psr_enable(struct intel_dp *intel_dp)
1545     struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
1546     struct drm_device *dev = intel_dig_port->base.base.dev;
1547     struct drm_i915_private *dev_priv = to_i915(dev);
1548     - struct intel_crtc *crtc = to_intel_crtc(intel_dig_port->base.base.crtc);
1549    
1550     if (!HAS_PSR(dev)) {
1551     DRM_DEBUG_KMS("PSR not supported on this platform\n");
1552     @@ -452,12 +458,7 @@ void intel_psr_enable(struct intel_dp *intel_dp)
1553     hsw_psr_setup_vsc(intel_dp);
1554    
1555     if (dev_priv->psr.psr2_support) {
1556     - /* PSR2 is restricted to work with panel resolutions upto 3200x2000 */
1557     - if (crtc->config->pipe_src_w > 3200 ||
1558     - crtc->config->pipe_src_h > 2000)
1559     - dev_priv->psr.psr2_support = false;
1560     - else
1561     - skl_psr_setup_su_vsc(intel_dp);
1562     + skl_psr_setup_su_vsc(intel_dp);
1563     }
1564    
1565     /*
1566     diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
1567     index 0c535d0f3b95..53ac19b3727a 100644
1568     --- a/drivers/hid/wacom_sys.c
1569     +++ b/drivers/hid/wacom_sys.c
1570     @@ -2433,6 +2433,8 @@ static void wacom_remove(struct hid_device *hdev)
1571     if (hdev->bus == BUS_BLUETOOTH)
1572     device_remove_file(&hdev->dev, &dev_attr_speed);
1573    
1574     + wacom_release_resources(wacom);
1575     +
1576     hid_set_drvdata(hdev, NULL);
1577     }
1578    
1579     diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
1580     index dee93ec87d02..84e0994aafdd 100644
1581     --- a/drivers/hwmon/gl520sm.c
1582     +++ b/drivers/hwmon/gl520sm.c
1583     @@ -208,11 +208,13 @@ static ssize_t get_cpu_vid(struct device *dev, struct device_attribute *attr,
1584     }
1585     static DEVICE_ATTR(cpu0_vid, S_IRUGO, get_cpu_vid, NULL);
1586    
1587     -#define VDD_FROM_REG(val) (((val) * 95 + 2) / 4)
1588     -#define VDD_TO_REG(val) clamp_val((((val) * 4 + 47) / 95), 0, 255)
1589     +#define VDD_FROM_REG(val) DIV_ROUND_CLOSEST((val) * 95, 4)
1590     +#define VDD_CLAMP(val) clamp_val(val, 0, 255 * 95 / 4)
1591     +#define VDD_TO_REG(val) DIV_ROUND_CLOSEST(VDD_CLAMP(val) * 4, 95)
1592    
1593     -#define IN_FROM_REG(val) ((val) * 19)
1594     -#define IN_TO_REG(val) clamp_val((((val) + 9) / 19), 0, 255)
1595     +#define IN_FROM_REG(val) ((val) * 19)
1596     +#define IN_CLAMP(val) clamp_val(val, 0, 255 * 19)
1597     +#define IN_TO_REG(val) DIV_ROUND_CLOSEST(IN_CLAMP(val), 19)
1598    
1599     static ssize_t get_in_input(struct device *dev, struct device_attribute *attr,
1600     char *buf)
1601     @@ -349,8 +351,13 @@ static SENSOR_DEVICE_ATTR(in4_max, S_IRUGO | S_IWUSR,
1602    
1603     #define DIV_FROM_REG(val) (1 << (val))
1604     #define FAN_FROM_REG(val, div) ((val) == 0 ? 0 : (480000 / ((val) << (div))))
1605     -#define FAN_TO_REG(val, div) ((val) <= 0 ? 0 : \
1606     - clamp_val((480000 + ((val) << ((div)-1))) / ((val) << (div)), 1, 255))
1607     +
1608     +#define FAN_BASE(div) (480000 >> (div))
1609     +#define FAN_CLAMP(val, div) clamp_val(val, FAN_BASE(div) / 255, \
1610     + FAN_BASE(div))
1611     +#define FAN_TO_REG(val, div) ((val) == 0 ? 0 : \
1612     + DIV_ROUND_CLOSEST(480000, \
1613     + FAN_CLAMP(val, div) << (div)))
1614    
1615     static ssize_t get_fan_input(struct device *dev, struct device_attribute *attr,
1616     char *buf)
1617     @@ -513,9 +520,9 @@ static SENSOR_DEVICE_ATTR(fan2_div, S_IRUGO | S_IWUSR,
1618     static DEVICE_ATTR(fan1_off, S_IRUGO | S_IWUSR,
1619     get_fan_off, set_fan_off);
1620    
1621     -#define TEMP_FROM_REG(val) (((val) - 130) * 1000)
1622     -#define TEMP_TO_REG(val) clamp_val(((((val) < 0 ? \
1623     - (val) - 500 : (val) + 500) / 1000) + 130), 0, 255)
1624     +#define TEMP_FROM_REG(val) (((val) - 130) * 1000)
1625     +#define TEMP_CLAMP(val) clamp_val(val, -130000, 125000)
1626     +#define TEMP_TO_REG(val) (DIV_ROUND_CLOSEST(TEMP_CLAMP(val), 1000) + 130)
1627    
1628     static ssize_t get_temp_input(struct device *dev, struct device_attribute *attr,
1629     char *buf)
1630     diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
1631     index 2aa61bbbd307..73b97c71a484 100644
1632     --- a/drivers/i2c/busses/i2c-meson.c
1633     +++ b/drivers/i2c/busses/i2c-meson.c
1634     @@ -175,7 +175,7 @@ static void meson_i2c_put_data(struct meson_i2c *i2c, char *buf, int len)
1635     wdata1 |= *buf++ << ((i - 4) * 8);
1636    
1637     writel(wdata0, i2c->regs + REG_TOK_WDATA0);
1638     - writel(wdata0, i2c->regs + REG_TOK_WDATA1);
1639     + writel(wdata1, i2c->regs + REG_TOK_WDATA1);
1640    
1641     dev_dbg(i2c->dev, "%s: data %08x %08x len %d\n", __func__,
1642     wdata0, wdata1, len);
1643     diff --git a/drivers/iio/adc/axp288_adc.c b/drivers/iio/adc/axp288_adc.c
1644     index 7fd24949c0c1..64799ad7ebad 100644
1645     --- a/drivers/iio/adc/axp288_adc.c
1646     +++ b/drivers/iio/adc/axp288_adc.c
1647     @@ -28,8 +28,6 @@
1648     #include <linux/iio/driver.h>
1649    
1650     #define AXP288_ADC_EN_MASK 0xF1
1651     -#define AXP288_ADC_TS_PIN_GPADC 0xF2
1652     -#define AXP288_ADC_TS_PIN_ON 0xF3
1653    
1654     enum axp288_adc_id {
1655     AXP288_ADC_TS,
1656     @@ -123,16 +121,6 @@ static int axp288_adc_read_channel(int *val, unsigned long address,
1657     return IIO_VAL_INT;
1658     }
1659    
1660     -static int axp288_adc_set_ts(struct regmap *regmap, unsigned int mode,
1661     - unsigned long address)
1662     -{
1663     - /* channels other than GPADC do not need to switch TS pin */
1664     - if (address != AXP288_GP_ADC_H)
1665     - return 0;
1666     -
1667     - return regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, mode);
1668     -}
1669     -
1670     static int axp288_adc_read_raw(struct iio_dev *indio_dev,
1671     struct iio_chan_spec const *chan,
1672     int *val, int *val2, long mask)
1673     @@ -143,16 +131,7 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev,
1674     mutex_lock(&indio_dev->mlock);
1675     switch (mask) {
1676     case IIO_CHAN_INFO_RAW:
1677     - if (axp288_adc_set_ts(info->regmap, AXP288_ADC_TS_PIN_GPADC,
1678     - chan->address)) {
1679     - dev_err(&indio_dev->dev, "GPADC mode\n");
1680     - ret = -EINVAL;
1681     - break;
1682     - }
1683     ret = axp288_adc_read_channel(val, chan->address, info->regmap);
1684     - if (axp288_adc_set_ts(info->regmap, AXP288_ADC_TS_PIN_ON,
1685     - chan->address))
1686     - dev_err(&indio_dev->dev, "TS pin restore\n");
1687     break;
1688     default:
1689     ret = -EINVAL;
1690     @@ -162,15 +141,6 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev,
1691     return ret;
1692     }
1693    
1694     -static int axp288_adc_set_state(struct regmap *regmap)
1695     -{
1696     - /* ADC should be always enabled for internal FG to function */
1697     - if (regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, AXP288_ADC_TS_PIN_ON))
1698     - return -EIO;
1699     -
1700     - return regmap_write(regmap, AXP20X_ADC_EN1, AXP288_ADC_EN_MASK);
1701     -}
1702     -
1703     static const struct iio_info axp288_adc_iio_info = {
1704     .read_raw = &axp288_adc_read_raw,
1705     .driver_module = THIS_MODULE,
1706     @@ -199,7 +169,7 @@ static int axp288_adc_probe(struct platform_device *pdev)
1707     * Set ADC to enabled state at all time, including system suspend.
1708     * otherwise internal fuel gauge functionality may be affected.
1709     */
1710     - ret = axp288_adc_set_state(axp20x->regmap);
1711     + ret = regmap_write(info->regmap, AXP20X_ADC_EN1, AXP288_ADC_EN_MASK);
1712     if (ret) {
1713     dev_err(&pdev->dev, "unable to enable ADC device\n");
1714     return ret;
1715     diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c
1716     index 72b32c1ab257..ea264fa9e567 100644
1717     --- a/drivers/iio/adc/fsl-imx25-gcq.c
1718     +++ b/drivers/iio/adc/fsl-imx25-gcq.c
1719     @@ -401,6 +401,7 @@ static const struct of_device_id mx25_gcq_ids[] = {
1720     { .compatible = "fsl,imx25-gcq", },
1721     { /* Sentinel */ }
1722     };
1723     +MODULE_DEVICE_TABLE(of, mx25_gcq_ids);
1724    
1725     static struct platform_driver mx25_gcq_driver = {
1726     .driver = {
1727     diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
1728     index ded27172320e..cedb447d0162 100644
1729     --- a/drivers/infiniband/hw/qib/qib_iba7322.c
1730     +++ b/drivers/infiniband/hw/qib/qib_iba7322.c
1731     @@ -7080,7 +7080,7 @@ static void qib_7322_txchk_change(struct qib_devdata *dd, u32 start,
1732     unsigned long flags;
1733    
1734     while (wait) {
1735     - unsigned long shadow;
1736     + unsigned long shadow = 0;
1737     int cstart, previ = -1;
1738    
1739     /*
1740     diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c
1741     index 6bac0717c540..ee26a1b1b4ed 100644
1742     --- a/drivers/infiniband/sw/rxe/rxe_pool.c
1743     +++ b/drivers/infiniband/sw/rxe/rxe_pool.c
1744     @@ -274,6 +274,7 @@ static u32 alloc_index(struct rxe_pool *pool)
1745     if (index >= range)
1746     index = find_first_zero_bit(pool->table, range);
1747    
1748     + WARN_ON_ONCE(index >= range);
1749     set_bit(index, pool->table);
1750     pool->last = index;
1751     return index + pool->min_index;
1752     diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
1753     index ccf624763565..69ed4e0d7a0d 100644
1754     --- a/drivers/infiniband/sw/rxe/rxe_resp.c
1755     +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
1756     @@ -418,7 +418,7 @@ static enum resp_states check_length(struct rxe_qp *qp,
1757     static enum resp_states check_rkey(struct rxe_qp *qp,
1758     struct rxe_pkt_info *pkt)
1759     {
1760     - struct rxe_mem *mem;
1761     + struct rxe_mem *mem = NULL;
1762     u64 va;
1763     u32 rkey;
1764     u32 resid;
1765     @@ -452,38 +452,38 @@ static enum resp_states check_rkey(struct rxe_qp *qp,
1766     mem = lookup_mem(qp->pd, access, rkey, lookup_remote);
1767     if (!mem) {
1768     state = RESPST_ERR_RKEY_VIOLATION;
1769     - goto err1;
1770     + goto err;
1771     }
1772    
1773     if (unlikely(mem->state == RXE_MEM_STATE_FREE)) {
1774     state = RESPST_ERR_RKEY_VIOLATION;
1775     - goto err1;
1776     + goto err;
1777     }
1778    
1779     if (mem_check_range(mem, va, resid)) {
1780     state = RESPST_ERR_RKEY_VIOLATION;
1781     - goto err2;
1782     + goto err;
1783     }
1784    
1785     if (pkt->mask & RXE_WRITE_MASK) {
1786     if (resid > mtu) {
1787     if (pktlen != mtu || bth_pad(pkt)) {
1788     state = RESPST_ERR_LENGTH;
1789     - goto err2;
1790     + goto err;
1791     }
1792    
1793     qp->resp.resid = mtu;
1794     } else {
1795     if (pktlen != resid) {
1796     state = RESPST_ERR_LENGTH;
1797     - goto err2;
1798     + goto err;
1799     }
1800     if ((bth_pad(pkt) != (0x3 & (-resid)))) {
1801     /* This case may not be exactly that
1802     * but nothing else fits.
1803     */
1804     state = RESPST_ERR_LENGTH;
1805     - goto err2;
1806     + goto err;
1807     }
1808     }
1809     }
1810     @@ -493,9 +493,9 @@ static enum resp_states check_rkey(struct rxe_qp *qp,
1811     qp->resp.mr = mem;
1812     return RESPST_EXECUTE;
1813    
1814     -err2:
1815     - rxe_drop_ref(mem);
1816     -err1:
1817     +err:
1818     + if (mem)
1819     + rxe_drop_ref(mem);
1820     return state;
1821     }
1822    
1823     diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1824     index 08c4b0287304..183db0cd849e 100644
1825     --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
1826     +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1827     @@ -1302,7 +1302,7 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv)
1828     rcu_dereference_protected(neigh->hnext,
1829     lockdep_is_held(&priv->lock)));
1830     /* remove from path/mc list */
1831     - list_del(&neigh->list);
1832     + list_del_init(&neigh->list);
1833     call_rcu(&neigh->rcu, ipoib_neigh_reclaim);
1834     } else {
1835     np = &neigh->hnext;
1836     @@ -1466,7 +1466,7 @@ void ipoib_neigh_free(struct ipoib_neigh *neigh)
1837     rcu_dereference_protected(neigh->hnext,
1838     lockdep_is_held(&priv->lock)));
1839     /* remove from parent list */
1840     - list_del(&neigh->list);
1841     + list_del_init(&neigh->list);
1842     call_rcu(&neigh->rcu, ipoib_neigh_reclaim);
1843     return;
1844     } else {
1845     @@ -1551,7 +1551,7 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid)
1846     rcu_dereference_protected(neigh->hnext,
1847     lockdep_is_held(&priv->lock)));
1848     /* remove from parent list */
1849     - list_del(&neigh->list);
1850     + list_del_init(&neigh->list);
1851     call_rcu(&neigh->rcu, ipoib_neigh_reclaim);
1852     } else {
1853     np = &neigh->hnext;
1854     @@ -1593,7 +1593,7 @@ static void ipoib_flush_neighs(struct ipoib_dev_priv *priv)
1855     rcu_dereference_protected(neigh->hnext,
1856     lockdep_is_held(&priv->lock)));
1857     /* remove from path/mc list */
1858     - list_del(&neigh->list);
1859     + list_del_init(&neigh->list);
1860     call_rcu(&neigh->rcu, ipoib_neigh_reclaim);
1861     }
1862     }
1863     diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
1864     index 57eadd2b7a71..93b50be14438 100644
1865     --- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
1866     +++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
1867     @@ -165,11 +165,11 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
1868     out:
1869     up_write(&ppriv->vlan_rwsem);
1870    
1871     + rtnl_unlock();
1872     +
1873     if (result)
1874     free_netdev(priv->dev);
1875    
1876     - rtnl_unlock();
1877     -
1878     return result;
1879     }
1880    
1881     @@ -193,7 +193,6 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
1882     list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) {
1883     if (priv->pkey == pkey &&
1884     priv->child_type == IPOIB_LEGACY_CHILD) {
1885     - unregister_netdevice(priv->dev);
1886     list_del(&priv->list);
1887     dev = priv->dev;
1888     break;
1889     @@ -201,6 +200,11 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
1890     }
1891     up_write(&ppriv->vlan_rwsem);
1892    
1893     + if (dev) {
1894     + ipoib_dbg(ppriv, "delete child vlan %s\n", dev->name);
1895     + unregister_netdevice(dev);
1896     + }
1897     +
1898     rtnl_unlock();
1899    
1900     if (dev) {
1901     diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
1902     index 8f7281444551..5a9a4416f467 100644
1903     --- a/drivers/iommu/arm-smmu.c
1904     +++ b/drivers/iommu/arm-smmu.c
1905     @@ -1211,7 +1211,7 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
1906     continue;
1907    
1908     s2cr[idx].type = type;
1909     - s2cr[idx].privcfg = S2CR_PRIVCFG_UNPRIV;
1910     + s2cr[idx].privcfg = S2CR_PRIVCFG_DEFAULT;
1911     s2cr[idx].cbndx = cbndx;
1912     arm_smmu_write_s2cr(smmu, idx);
1913     }
1914     diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
1915     index 30808e91b775..c7820b3ea80e 100644
1916     --- a/drivers/iommu/exynos-iommu.c
1917     +++ b/drivers/iommu/exynos-iommu.c
1918     @@ -542,7 +542,10 @@ static void sysmmu_tlb_invalidate_flpdcache(struct sysmmu_drvdata *data,
1919     spin_lock_irqsave(&data->lock, flags);
1920     if (is_sysmmu_active(data) && data->version >= MAKE_MMU_VER(3, 3)) {
1921     clk_enable(data->clk_master);
1922     - __sysmmu_tlb_invalidate_entry(data, iova, 1);
1923     + if (sysmmu_block(data)) {
1924     + __sysmmu_tlb_invalidate_entry(data, iova, 1);
1925     + sysmmu_unblock(data);
1926     + }
1927     clk_disable(data->clk_master);
1928     }
1929     spin_unlock_irqrestore(&data->lock, flags);
1930     diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
1931     index f5c90e1366ce..7c9d632f1d09 100644
1932     --- a/drivers/iommu/io-pgtable-arm.c
1933     +++ b/drivers/iommu/io-pgtable-arm.c
1934     @@ -335,8 +335,12 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
1935     if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_NS)
1936     pte |= ARM_LPAE_PTE_NSTABLE;
1937     __arm_lpae_set_pte(ptep, pte, cfg);
1938     - } else {
1939     + } else if (!iopte_leaf(pte, lvl)) {
1940     cptep = iopte_deref(pte, data);
1941     + } else {
1942     + /* We require an unmap first */
1943     + WARN_ON(!selftest_running);
1944     + return -EEXIST;
1945     }
1946    
1947     /* Rinse, repeat */
1948     diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
1949     index 4c4aab02e311..b19b551bb34b 100644
1950     --- a/drivers/md/raid10.c
1951     +++ b/drivers/md/raid10.c
1952     @@ -1407,11 +1407,24 @@ static void __make_request(struct mddev *mddev, struct bio *bio)
1953     mbio->bi_private = r10_bio;
1954    
1955     atomic_inc(&r10_bio->remaining);
1956     +
1957     + cb = blk_check_plugged(raid10_unplug, mddev,
1958     + sizeof(*plug));
1959     + if (cb)
1960     + plug = container_of(cb, struct raid10_plug_cb,
1961     + cb);
1962     + else
1963     + plug = NULL;
1964     spin_lock_irqsave(&conf->device_lock, flags);
1965     - bio_list_add(&conf->pending_bio_list, mbio);
1966     - conf->pending_count++;
1967     + if (plug) {
1968     + bio_list_add(&plug->pending, mbio);
1969     + plug->pending_cnt++;
1970     + } else {
1971     + bio_list_add(&conf->pending_bio_list, mbio);
1972     + conf->pending_count++;
1973     + }
1974     spin_unlock_irqrestore(&conf->device_lock, flags);
1975     - if (!mddev_check_plugged(mddev))
1976     + if (!plug)
1977     md_wakeup_thread(mddev->thread);
1978     }
1979     }
1980     diff --git a/drivers/media/pci/ttpci/av7110_hw.c b/drivers/media/pci/ttpci/av7110_hw.c
1981     index 0583d56ef5ef..41ba8489db34 100644
1982     --- a/drivers/media/pci/ttpci/av7110_hw.c
1983     +++ b/drivers/media/pci/ttpci/av7110_hw.c
1984     @@ -56,11 +56,11 @@
1985     by Nathan Laredo <laredo@gnu.org> */
1986    
1987     int av7110_debiwrite(struct av7110 *av7110, u32 config,
1988     - int addr, u32 val, int count)
1989     + int addr, u32 val, unsigned int count)
1990     {
1991     struct saa7146_dev *dev = av7110->dev;
1992    
1993     - if (count <= 0 || count > 32764) {
1994     + if (count > 32764) {
1995     printk("%s: invalid count %d\n", __func__, count);
1996     return -1;
1997     }
1998     @@ -78,12 +78,12 @@ int av7110_debiwrite(struct av7110 *av7110, u32 config,
1999     return 0;
2000     }
2001    
2002     -u32 av7110_debiread(struct av7110 *av7110, u32 config, int addr, int count)
2003     +u32 av7110_debiread(struct av7110 *av7110, u32 config, int addr, unsigned int count)
2004     {
2005     struct saa7146_dev *dev = av7110->dev;
2006     u32 result = 0;
2007    
2008     - if (count > 32764 || count <= 0) {
2009     + if (count > 32764) {
2010     printk("%s: invalid count %d\n", __func__, count);
2011     return 0;
2012     }
2013     diff --git a/drivers/media/pci/ttpci/av7110_hw.h b/drivers/media/pci/ttpci/av7110_hw.h
2014     index 1634aba5cb84..ccb148059406 100644
2015     --- a/drivers/media/pci/ttpci/av7110_hw.h
2016     +++ b/drivers/media/pci/ttpci/av7110_hw.h
2017     @@ -377,14 +377,14 @@ extern int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
2018    
2019     /* DEBI (saa7146 data extension bus interface) access */
2020     extern int av7110_debiwrite(struct av7110 *av7110, u32 config,
2021     - int addr, u32 val, int count);
2022     + int addr, u32 val, unsigned int count);
2023     extern u32 av7110_debiread(struct av7110 *av7110, u32 config,
2024     - int addr, int count);
2025     + int addr, unsigned int count);
2026    
2027    
2028     /* DEBI during interrupt */
2029     /* single word writes */
2030     -static inline void iwdebi(struct av7110 *av7110, u32 config, int addr, u32 val, int count)
2031     +static inline void iwdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count)
2032     {
2033     av7110_debiwrite(av7110, config, addr, val, count);
2034     }
2035     @@ -397,7 +397,7 @@ static inline void mwdebi(struct av7110 *av7110, u32 config, int addr,
2036     av7110_debiwrite(av7110, config, addr, 0, count);
2037     }
2038    
2039     -static inline u32 irdebi(struct av7110 *av7110, u32 config, int addr, u32 val, int count)
2040     +static inline u32 irdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count)
2041     {
2042     u32 res;
2043    
2044     @@ -408,7 +408,7 @@ static inline u32 irdebi(struct av7110 *av7110, u32 config, int addr, u32 val, i
2045     }
2046    
2047     /* DEBI outside interrupts, only for count <= 4! */
2048     -static inline void wdebi(struct av7110 *av7110, u32 config, int addr, u32 val, int count)
2049     +static inline void wdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count)
2050     {
2051     unsigned long flags;
2052    
2053     @@ -417,7 +417,7 @@ static inline void wdebi(struct av7110 *av7110, u32 config, int addr, u32 val, i
2054     spin_unlock_irqrestore(&av7110->debilock, flags);
2055     }
2056    
2057     -static inline u32 rdebi(struct av7110 *av7110, u32 config, int addr, u32 val, int count)
2058     +static inline u32 rdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count)
2059     {
2060     unsigned long flags;
2061     u32 res;
2062     diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
2063     index 787bd16c19e5..bbb5feef8308 100644
2064     --- a/drivers/media/platform/exynos-gsc/gsc-core.c
2065     +++ b/drivers/media/platform/exynos-gsc/gsc-core.c
2066     @@ -849,9 +849,7 @@ int gsc_prepare_addr(struct gsc_ctx *ctx, struct vb2_buffer *vb,
2067    
2068     if ((frame->fmt->pixelformat == V4L2_PIX_FMT_VYUY) ||
2069     (frame->fmt->pixelformat == V4L2_PIX_FMT_YVYU) ||
2070     - (frame->fmt->pixelformat == V4L2_PIX_FMT_NV61) ||
2071     (frame->fmt->pixelformat == V4L2_PIX_FMT_YVU420) ||
2072     - (frame->fmt->pixelformat == V4L2_PIX_FMT_NV21) ||
2073     (frame->fmt->pixelformat == V4L2_PIX_FMT_YVU420M))
2074     swap(addr->cb, addr->cr);
2075    
2076     diff --git a/drivers/misc/lkdtm_core.c b/drivers/misc/lkdtm_core.c
2077     index f9154b8d67f6..b2989f2d3126 100644
2078     --- a/drivers/misc/lkdtm_core.c
2079     +++ b/drivers/misc/lkdtm_core.c
2080     @@ -533,7 +533,9 @@ static void __exit lkdtm_module_exit(void)
2081     /* Handle test-specific clean-up. */
2082     lkdtm_usercopy_exit();
2083    
2084     - unregister_jprobe(lkdtm_jprobe);
2085     + if (lkdtm_jprobe != NULL)
2086     + unregister_jprobe(lkdtm_jprobe);
2087     +
2088     pr_info("Crash point unregistered\n");
2089     }
2090    
2091     diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
2092     index 86f5b3223aae..d56a3b6c2fb9 100644
2093     --- a/drivers/mmc/core/sdio_bus.c
2094     +++ b/drivers/mmc/core/sdio_bus.c
2095     @@ -266,7 +266,7 @@ static void sdio_release_func(struct device *dev)
2096     sdio_free_func_cis(func);
2097    
2098     kfree(func->info);
2099     -
2100     + kfree(func->tmpbuf);
2101     kfree(func);
2102     }
2103    
2104     @@ -281,6 +281,16 @@ struct sdio_func *sdio_alloc_func(struct mmc_card *card)
2105     if (!func)
2106     return ERR_PTR(-ENOMEM);
2107    
2108     + /*
2109     + * allocate buffer separately to make sure it's properly aligned for
2110     + * DMA usage (incl. 64 bit DMA)
2111     + */
2112     + func->tmpbuf = kmalloc(4, GFP_KERNEL);
2113     + if (!func->tmpbuf) {
2114     + kfree(func);
2115     + return ERR_PTR(-ENOMEM);
2116     + }
2117     +
2118     func->card = card;
2119    
2120     device_initialize(&func->dev);
2121     diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
2122     index 3ec573c13dac..c26debc531ee 100644
2123     --- a/drivers/net/dsa/b53/b53_common.c
2124     +++ b/drivers/net/dsa/b53/b53_common.c
2125     @@ -326,6 +326,7 @@ static void b53_get_vlan_entry(struct b53_device *dev, u16 vid,
2126    
2127     static void b53_set_forwarding(struct b53_device *dev, int enable)
2128     {
2129     + struct dsa_switch *ds = dev->ds;
2130     u8 mgmt;
2131    
2132     b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, &mgmt);
2133     @@ -336,6 +337,15 @@ static void b53_set_forwarding(struct b53_device *dev, int enable)
2134     mgmt &= ~SM_SW_FWD_EN;
2135    
2136     b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, mgmt);
2137     +
2138     + /* Include IMP port in dumb forwarding mode when no tagging protocol is
2139     + * set
2140     + */
2141     + if (ds->ops->get_tag_protocol(ds) == DSA_TAG_PROTO_NONE) {
2142     + b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, &mgmt);
2143     + mgmt |= B53_MII_DUMB_FWDG_EN;
2144     + b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, mgmt);
2145     + }
2146     }
2147    
2148     static void b53_enable_vlan(struct b53_device *dev, bool enable)
2149     diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h
2150     index dac0af4e2cd0..81044000ce75 100644
2151     --- a/drivers/net/dsa/b53/b53_regs.h
2152     +++ b/drivers/net/dsa/b53/b53_regs.h
2153     @@ -104,6 +104,10 @@
2154     #define B53_UC_FWD_EN BIT(6)
2155     #define B53_MC_FWD_EN BIT(7)
2156    
2157     +/* Switch control (8 bit) */
2158     +#define B53_SWITCH_CTRL 0x22
2159     +#define B53_MII_DUMB_FWDG_EN BIT(6)
2160     +
2161     /* (16 bit) */
2162     #define B53_UC_FLOOD_MASK 0x32
2163     #define B53_MC_FLOOD_MASK 0x34
2164     diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
2165     index 9f2184be55dc..b8778e7b1f79 100644
2166     --- a/drivers/net/ethernet/ibm/ibmvnic.c
2167     +++ b/drivers/net/ethernet/ibm/ibmvnic.c
2168     @@ -1253,6 +1253,7 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter)
2169     release_sub_crq_queue(adapter,
2170     adapter->tx_scrq[i]);
2171     }
2172     + kfree(adapter->tx_scrq);
2173     adapter->tx_scrq = NULL;
2174     }
2175    
2176     @@ -1265,6 +1266,7 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter)
2177     release_sub_crq_queue(adapter,
2178     adapter->rx_scrq[i]);
2179     }
2180     + kfree(adapter->rx_scrq);
2181     adapter->rx_scrq = NULL;
2182     }
2183    
2184     diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
2185     index 9affd7c198bd..6a62447fe377 100644
2186     --- a/drivers/net/ethernet/intel/igb/igb_main.c
2187     +++ b/drivers/net/ethernet/intel/igb/igb_main.c
2188     @@ -7882,6 +7882,11 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
2189     pci_enable_wake(pdev, PCI_D3hot, 0);
2190     pci_enable_wake(pdev, PCI_D3cold, 0);
2191    
2192     + /* In case of PCI error, adapter lose its HW address
2193     + * so we should re-assign it here.
2194     + */
2195     + hw->hw_addr = adapter->io_addr;
2196     +
2197     igb_reset(adapter);
2198     wr32(E1000_WUS, ~0);
2199     result = PCI_ERS_RESULT_RECOVERED;
2200     diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
2201     index a4789a93b692..9d59cb85c012 100644
2202     --- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
2203     +++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
2204     @@ -1222,7 +1222,7 @@ static struct qed_dcbx_get *qed_dcbnl_get_dcbx(struct qed_hwfn *hwfn,
2205     {
2206     struct qed_dcbx_get *dcbx_info;
2207    
2208     - dcbx_info = kzalloc(sizeof(*dcbx_info), GFP_KERNEL);
2209     + dcbx_info = kmalloc(sizeof(*dcbx_info), GFP_ATOMIC);
2210     if (!dcbx_info)
2211     return NULL;
2212    
2213     diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
2214     index d050f37f3e0f..5024280f5af2 100644
2215     --- a/drivers/net/ethernet/renesas/sh_eth.h
2216     +++ b/drivers/net/ethernet/renesas/sh_eth.h
2217     @@ -339,7 +339,7 @@ enum FELIC_MODE_BIT {
2218     ECMR_DPAD = 0x00200000, ECMR_RZPF = 0x00100000,
2219     ECMR_ZPF = 0x00080000, ECMR_PFR = 0x00040000, ECMR_RXF = 0x00020000,
2220     ECMR_TXF = 0x00010000, ECMR_MCT = 0x00002000, ECMR_PRCEF = 0x00001000,
2221     - ECMR_PMDE = 0x00000200, ECMR_RE = 0x00000040, ECMR_TE = 0x00000020,
2222     + ECMR_MPDE = 0x00000200, ECMR_RE = 0x00000040, ECMR_TE = 0x00000020,
2223     ECMR_RTM = 0x00000010, ECMR_ILB = 0x00000008, ECMR_ELB = 0x00000004,
2224     ECMR_DM = 0x00000002, ECMR_PRM = 0x00000001,
2225     };
2226     diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
2227     index c4ada7227f40..1d85109cb8ed 100644
2228     --- a/drivers/net/ethernet/sfc/ef10.c
2229     +++ b/drivers/net/ethernet/sfc/ef10.c
2230     @@ -197,11 +197,15 @@ static int efx_ef10_init_datapath_caps(struct efx_nic *efx)
2231     nic_data->datapath_caps =
2232     MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1);
2233    
2234     - if (outlen >= MC_CMD_GET_CAPABILITIES_V2_OUT_LEN)
2235     + if (outlen >= MC_CMD_GET_CAPABILITIES_V2_OUT_LEN) {
2236     nic_data->datapath_caps2 = MCDI_DWORD(outbuf,
2237     GET_CAPABILITIES_V2_OUT_FLAGS2);
2238     - else
2239     + nic_data->piobuf_size = MCDI_WORD(outbuf,
2240     + GET_CAPABILITIES_V2_OUT_SIZE_PIO_BUFF);
2241     + } else {
2242     nic_data->datapath_caps2 = 0;
2243     + nic_data->piobuf_size = ER_DZ_TX_PIOBUF_SIZE;
2244     + }
2245    
2246     /* record the DPCPU firmware IDs to determine VEB vswitching support.
2247     */
2248     @@ -825,8 +829,8 @@ static int efx_ef10_link_piobufs(struct efx_nic *efx)
2249     offset = ((efx->tx_channel_offset + efx->n_tx_channels -
2250     tx_queue->channel->channel - 1) *
2251     efx_piobuf_size);
2252     - index = offset / ER_DZ_TX_PIOBUF_SIZE;
2253     - offset = offset % ER_DZ_TX_PIOBUF_SIZE;
2254     + index = offset / nic_data->piobuf_size;
2255     + offset = offset % nic_data->piobuf_size;
2256    
2257     /* When the host page size is 4K, the first
2258     * host page in the WC mapping may be within
2259     @@ -1161,11 +1165,11 @@ static int efx_ef10_dimension_resources(struct efx_nic *efx)
2260     * functions of the controller.
2261     */
2262     if (efx_piobuf_size != 0 &&
2263     - ER_DZ_TX_PIOBUF_SIZE / efx_piobuf_size * EF10_TX_PIOBUF_COUNT >=
2264     + nic_data->piobuf_size / efx_piobuf_size * EF10_TX_PIOBUF_COUNT >=
2265     efx->n_tx_channels) {
2266     unsigned int n_piobufs =
2267     DIV_ROUND_UP(efx->n_tx_channels,
2268     - ER_DZ_TX_PIOBUF_SIZE / efx_piobuf_size);
2269     + nic_data->piobuf_size / efx_piobuf_size);
2270    
2271     rc = efx_ef10_alloc_piobufs(efx, n_piobufs);
2272     if (rc)
2273     diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h
2274     index 73bee7ea332a..73028f21a2d7 100644
2275     --- a/drivers/net/ethernet/sfc/nic.h
2276     +++ b/drivers/net/ethernet/sfc/nic.h
2277     @@ -500,6 +500,7 @@ enum {
2278     * @pio_write_base: Base address for writing PIO buffers
2279     * @pio_write_vi_base: Relative VI number for @pio_write_base
2280     * @piobuf_handle: Handle of each PIO buffer allocated
2281     + * @piobuf_size: size of a single PIO buffer
2282     * @must_restore_piobufs: Flag: PIO buffers have yet to be restored after MC
2283     * reboot
2284     * @rx_rss_context: Firmware handle for our RSS context
2285     @@ -537,6 +538,7 @@ struct efx_ef10_nic_data {
2286     void __iomem *wc_membase, *pio_write_base;
2287     unsigned int pio_write_vi_base;
2288     unsigned int piobuf_handle[EF10_TX_PIOBUF_COUNT];
2289     + u16 piobuf_size;
2290     bool must_restore_piobufs;
2291     u32 rx_rss_context;
2292     bool rx_rss_context_exclusive;
2293     diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
2294     index 233778911557..6f26acd0aa61 100644
2295     --- a/drivers/net/ethernet/sfc/tx.c
2296     +++ b/drivers/net/ethernet/sfc/tx.c
2297     @@ -27,7 +27,6 @@
2298    
2299     #ifdef EFX_USE_PIO
2300    
2301     -#define EFX_PIOBUF_SIZE_MAX ER_DZ_TX_PIOBUF_SIZE
2302     #define EFX_PIOBUF_SIZE_DEF ALIGN(256, L1_CACHE_BYTES)
2303     unsigned int efx_piobuf_size __read_mostly = EFX_PIOBUF_SIZE_DEF;
2304    
2305     diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
2306     index a380649bf6b5..26681707fc7a 100644
2307     --- a/drivers/net/team/team.c
2308     +++ b/drivers/net/team/team.c
2309     @@ -2366,8 +2366,10 @@ static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq,
2310    
2311     hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags | NLM_F_MULTI,
2312     TEAM_CMD_OPTIONS_GET);
2313     - if (!hdr)
2314     + if (!hdr) {
2315     + nlmsg_free(skb);
2316     return -EMSGSIZE;
2317     + }
2318    
2319     if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
2320     goto nla_put_failure;
2321     @@ -2639,8 +2641,10 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq,
2322    
2323     hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags | NLM_F_MULTI,
2324     TEAM_CMD_PORT_LIST_GET);
2325     - if (!hdr)
2326     + if (!hdr) {
2327     + nlmsg_free(skb);
2328     return -EMSGSIZE;
2329     + }
2330    
2331     if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
2332     goto nla_put_failure;
2333     diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
2334     index cdde59089f72..3a7286256db0 100644
2335     --- a/drivers/net/usb/Kconfig
2336     +++ b/drivers/net/usb/Kconfig
2337     @@ -364,7 +364,7 @@ config USB_NET_NET1080
2338     optionally with LEDs that indicate traffic
2339    
2340     config USB_NET_PLUSB
2341     - tristate "Prolific PL-2301/2302/25A1 based cables"
2342     + tristate "Prolific PL-2301/2302/25A1/27A1 based cables"
2343     # if the handshake/init/reset problems, from original 'plusb',
2344     # are ever resolved ... then remove "experimental"
2345     depends on USB_USBNET
2346     diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c
2347     index 22e1a9a99a7d..6fe59373cba9 100644
2348     --- a/drivers/net/usb/plusb.c
2349     +++ b/drivers/net/usb/plusb.c
2350     @@ -102,7 +102,7 @@ static int pl_reset(struct usbnet *dev)
2351     }
2352    
2353     static const struct driver_info prolific_info = {
2354     - .description = "Prolific PL-2301/PL-2302/PL-25A1",
2355     + .description = "Prolific PL-2301/PL-2302/PL-25A1/PL-27A1",
2356     .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT,
2357     /* some PL-2302 versions seem to fail usb_set_interface() */
2358     .reset = pl_reset,
2359     @@ -139,6 +139,17 @@ static const struct usb_device_id products [] = {
2360     * Host-to-Host Cable
2361     */
2362     .driver_info = (unsigned long) &prolific_info,
2363     +
2364     +},
2365     +
2366     +/* super speed cables */
2367     +{
2368     + USB_DEVICE(0x067b, 0x27a1), /* PL-27A1, no eeprom
2369     + * also: goobay Active USB 3.0
2370     + * Data Link,
2371     + * Unitek Y-3501
2372     + */
2373     + .driver_info = (unsigned long) &prolific_info,
2374     },
2375    
2376     { }, // END
2377     @@ -158,5 +169,5 @@ static struct usb_driver plusb_driver = {
2378     module_usb_driver(plusb_driver);
2379    
2380     MODULE_AUTHOR("David Brownell");
2381     -MODULE_DESCRIPTION("Prolific PL-2301/2302/25A1 USB Host to Host Link Driver");
2382     +MODULE_DESCRIPTION("Prolific PL-2301/2302/25A1/27A1 USB Host to Host Link Driver");
2383     MODULE_LICENSE("GPL");
2384     diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
2385     index be5b527472f9..90c0c4a7175d 100644
2386     --- a/drivers/net/wireless/ath/ath10k/core.h
2387     +++ b/drivers/net/wireless/ath/ath10k/core.h
2388     @@ -314,6 +314,7 @@ struct ath10k_peer {
2389     struct ieee80211_vif *vif;
2390     struct ieee80211_sta *sta;
2391    
2392     + bool removed;
2393     int vdev_id;
2394     u8 addr[ETH_ALEN];
2395     DECLARE_BITMAP(peer_ids, ATH10K_MAX_NUM_PEER_IDS);
2396     diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
2397     index f2e85eb22afe..30e98afa2e68 100644
2398     --- a/drivers/net/wireless/ath/ath10k/mac.c
2399     +++ b/drivers/net/wireless/ath/ath10k/mac.c
2400     @@ -3738,6 +3738,9 @@ struct ieee80211_txq *ath10k_mac_txq_lookup(struct ath10k *ar,
2401     if (!peer)
2402     return NULL;
2403    
2404     + if (peer->removed)
2405     + return NULL;
2406     +
2407     if (peer->sta)
2408     return peer->sta->txq[tid];
2409     else if (peer->vif)
2410     @@ -7422,6 +7425,20 @@ ath10k_mac_op_switch_vif_chanctx(struct ieee80211_hw *hw,
2411     return 0;
2412     }
2413    
2414     +static void ath10k_mac_op_sta_pre_rcu_remove(struct ieee80211_hw *hw,
2415     + struct ieee80211_vif *vif,
2416     + struct ieee80211_sta *sta)
2417     +{
2418     + struct ath10k *ar;
2419     + struct ath10k_peer *peer;
2420     +
2421     + ar = hw->priv;
2422     +
2423     + list_for_each_entry(peer, &ar->peers, list)
2424     + if (peer->sta == sta)
2425     + peer->removed = true;
2426     +}
2427     +
2428     static const struct ieee80211_ops ath10k_ops = {
2429     .tx = ath10k_mac_op_tx,
2430     .wake_tx_queue = ath10k_mac_op_wake_tx_queue,
2431     @@ -7462,6 +7479,7 @@ static const struct ieee80211_ops ath10k_ops = {
2432     .assign_vif_chanctx = ath10k_mac_op_assign_vif_chanctx,
2433     .unassign_vif_chanctx = ath10k_mac_op_unassign_vif_chanctx,
2434     .switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx,
2435     + .sta_pre_rcu_remove = ath10k_mac_op_sta_pre_rcu_remove,
2436    
2437     CFG80211_TESTMODE_CMD(ath10k_tm_cmd)
2438    
2439     diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
2440     index 82d949ede294..4e725d165aa6 100644
2441     --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
2442     +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
2443     @@ -6316,6 +6316,13 @@ static struct usb_device_id dev_table[] = {
2444     .driver_info = (unsigned long)&rtl8192cu_fops},
2445     {USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0x7822, 0xff, 0xff, 0xff),
2446     .driver_info = (unsigned long)&rtl8192cu_fops},
2447     +/* found in rtl8192eu vendor driver */
2448     +{USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0107, 0xff, 0xff, 0xff),
2449     + .driver_info = (unsigned long)&rtl8192eu_fops},
2450     +{USB_DEVICE_AND_INTERFACE_INFO(0x2019, 0xab33, 0xff, 0xff, 0xff),
2451     + .driver_info = (unsigned long)&rtl8192eu_fops},
2452     +{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x818c, 0xff, 0xff, 0xff),
2453     + .driver_info = (unsigned long)&rtl8192eu_fops},
2454     #endif
2455     { }
2456     };
2457     diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
2458     index 286fda4ee100..ab4f8db2a8ca 100644
2459     --- a/drivers/nvme/host/rdma.c
2460     +++ b/drivers/nvme/host/rdma.c
2461     @@ -337,8 +337,6 @@ static int __nvme_rdma_init_request(struct nvme_rdma_ctrl *ctrl,
2462     struct ib_device *ibdev = dev->dev;
2463     int ret;
2464    
2465     - BUG_ON(queue_idx >= ctrl->queue_count);
2466     -
2467     ret = nvme_rdma_alloc_qe(ibdev, &req->sqe, sizeof(struct nvme_command),
2468     DMA_TO_DEVICE);
2469     if (ret)
2470     @@ -643,8 +641,22 @@ static int nvme_rdma_connect_io_queues(struct nvme_rdma_ctrl *ctrl)
2471    
2472     static int nvme_rdma_init_io_queues(struct nvme_rdma_ctrl *ctrl)
2473     {
2474     + struct nvmf_ctrl_options *opts = ctrl->ctrl.opts;
2475     + unsigned int nr_io_queues;
2476     int i, ret;
2477    
2478     + nr_io_queues = min(opts->nr_io_queues, num_online_cpus());
2479     + ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues);
2480     + if (ret)
2481     + return ret;
2482     +
2483     + ctrl->queue_count = nr_io_queues + 1;
2484     + if (ctrl->queue_count < 2)
2485     + return 0;
2486     +
2487     + dev_info(ctrl->ctrl.device,
2488     + "creating %d I/O queues.\n", nr_io_queues);
2489     +
2490     for (i = 1; i < ctrl->queue_count; i++) {
2491     ret = nvme_rdma_init_queue(ctrl, i,
2492     ctrl->ctrl.opts->queue_size);
2493     @@ -1795,20 +1807,8 @@ static const struct nvme_ctrl_ops nvme_rdma_ctrl_ops = {
2494    
2495     static int nvme_rdma_create_io_queues(struct nvme_rdma_ctrl *ctrl)
2496     {
2497     - struct nvmf_ctrl_options *opts = ctrl->ctrl.opts;
2498     int ret;
2499    
2500     - ret = nvme_set_queue_count(&ctrl->ctrl, &opts->nr_io_queues);
2501     - if (ret)
2502     - return ret;
2503     -
2504     - ctrl->queue_count = opts->nr_io_queues + 1;
2505     - if (ctrl->queue_count < 2)
2506     - return 0;
2507     -
2508     - dev_info(ctrl->ctrl.device,
2509     - "creating %d I/O queues.\n", opts->nr_io_queues);
2510     -
2511     ret = nvme_rdma_init_io_queues(ctrl);
2512     if (ret)
2513     return ret;
2514     diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
2515     index 5bdde692f724..f62f9dfea984 100644
2516     --- a/drivers/power/supply/axp288_fuel_gauge.c
2517     +++ b/drivers/power/supply/axp288_fuel_gauge.c
2518     @@ -169,8 +169,10 @@ static int fuel_gauge_reg_readb(struct axp288_fg_info *info, int reg)
2519     break;
2520     }
2521    
2522     - if (ret < 0)
2523     + if (ret < 0) {
2524     dev_err(&info->pdev->dev, "axp288 reg read err:%d\n", ret);
2525     + return ret;
2526     + }
2527    
2528     return val;
2529     }
2530     diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
2531     index 9d19b9a62011..315a4be8dc1e 100644
2532     --- a/drivers/rapidio/devices/tsi721.c
2533     +++ b/drivers/rapidio/devices/tsi721.c
2534     @@ -37,8 +37,8 @@
2535     #include "tsi721.h"
2536    
2537     #ifdef DEBUG
2538     -u32 dbg_level;
2539     -module_param(dbg_level, uint, S_IWUSR | S_IRUGO);
2540     +u32 tsi_dbg_level;
2541     +module_param_named(dbg_level, tsi_dbg_level, uint, S_IWUSR | S_IRUGO);
2542     MODULE_PARM_DESC(dbg_level, "Debugging output level (default 0 = none)");
2543     #endif
2544    
2545     diff --git a/drivers/rapidio/devices/tsi721.h b/drivers/rapidio/devices/tsi721.h
2546     index 5941437cbdd1..957eadc58150 100644
2547     --- a/drivers/rapidio/devices/tsi721.h
2548     +++ b/drivers/rapidio/devices/tsi721.h
2549     @@ -40,11 +40,11 @@ enum {
2550     };
2551    
2552     #ifdef DEBUG
2553     -extern u32 dbg_level;
2554     +extern u32 tsi_dbg_level;
2555    
2556     #define tsi_debug(level, dev, fmt, arg...) \
2557     do { \
2558     - if (DBG_##level & dbg_level) \
2559     + if (DBG_##level & tsi_dbg_level) \
2560     dev_dbg(dev, "%s: " fmt "\n", __func__, ##arg); \
2561     } while (0)
2562     #else
2563     diff --git a/drivers/reset/reset-ti-syscon.c b/drivers/reset/reset-ti-syscon.c
2564     index 47f0ffd3b013..1799fd423901 100644
2565     --- a/drivers/reset/reset-ti-syscon.c
2566     +++ b/drivers/reset/reset-ti-syscon.c
2567     @@ -154,8 +154,8 @@ static int ti_syscon_reset_status(struct reset_controller_dev *rcdev,
2568     if (ret)
2569     return ret;
2570    
2571     - return (reset_state & BIT(control->status_bit)) &&
2572     - (control->flags & STATUS_SET);
2573     + return !(reset_state & BIT(control->status_bit)) ==
2574     + !(control->flags & STATUS_SET);
2575     }
2576    
2577     static struct reset_control_ops ti_syscon_reset_ops = {
2578     diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
2579     index ba258217614e..963c732a3d24 100644
2580     --- a/drivers/scsi/be2iscsi/be_iscsi.c
2581     +++ b/drivers/scsi/be2iscsi/be_iscsi.c
2582     @@ -165,33 +165,6 @@ beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid)
2583     return cls_conn;
2584     }
2585    
2586     -/**
2587     - * beiscsi_bindconn_cid - Bind the beiscsi_conn with phba connection table
2588     - * @beiscsi_conn: The pointer to beiscsi_conn structure
2589     - * @phba: The phba instance
2590     - * @cid: The cid to free
2591     - */
2592     -static int beiscsi_bindconn_cid(struct beiscsi_hba *phba,
2593     - struct beiscsi_conn *beiscsi_conn,
2594     - unsigned int cid)
2595     -{
2596     - uint16_t cri_index = BE_GET_CRI_FROM_CID(cid);
2597     -
2598     - if (phba->conn_table[cri_index]) {
2599     - beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
2600     - "BS_%d : Connection table already occupied. Detected clash\n");
2601     -
2602     - return -EINVAL;
2603     - } else {
2604     - beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
2605     - "BS_%d : phba->conn_table[%d]=%p(beiscsi_conn)\n",
2606     - cri_index, beiscsi_conn);
2607     -
2608     - phba->conn_table[cri_index] = beiscsi_conn;
2609     - }
2610     - return 0;
2611     -}
2612     -
2613     /**
2614     * beiscsi_conn_bind - Binds iscsi session/connection with TCP connection
2615     * @cls_session: pointer to iscsi cls session
2616     @@ -212,6 +185,7 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,
2617     struct hwi_wrb_context *pwrb_context;
2618     struct beiscsi_endpoint *beiscsi_ep;
2619     struct iscsi_endpoint *ep;
2620     + uint16_t cri_index;
2621    
2622     ep = iscsi_lookup_endpoint(transport_fd);
2623     if (!ep)
2624     @@ -229,20 +203,34 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,
2625    
2626     return -EEXIST;
2627     }
2628     -
2629     - pwrb_context = &phwi_ctrlr->wrb_context[BE_GET_CRI_FROM_CID(
2630     - beiscsi_ep->ep_cid)];
2631     + cri_index = BE_GET_CRI_FROM_CID(beiscsi_ep->ep_cid);
2632     + if (phba->conn_table[cri_index]) {
2633     + if (beiscsi_conn != phba->conn_table[cri_index] ||
2634     + beiscsi_ep != phba->conn_table[cri_index]->ep) {
2635     + __beiscsi_log(phba, KERN_ERR,
2636     + "BS_%d : conn_table not empty at %u: cid %u conn %p:%p\n",
2637     + cri_index,
2638     + beiscsi_ep->ep_cid,
2639     + beiscsi_conn,
2640     + phba->conn_table[cri_index]);
2641     + return -EINVAL;
2642     + }
2643     + }
2644    
2645     beiscsi_conn->beiscsi_conn_cid = beiscsi_ep->ep_cid;
2646     beiscsi_conn->ep = beiscsi_ep;
2647     beiscsi_ep->conn = beiscsi_conn;
2648     + /**
2649     + * Each connection is associated with a WRBQ kept in wrb_context.
2650     + * Store doorbell offset for transmit path.
2651     + */
2652     + pwrb_context = &phwi_ctrlr->wrb_context[cri_index];
2653     beiscsi_conn->doorbell_offset = pwrb_context->doorbell_offset;
2654     -
2655     beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
2656     - "BS_%d : beiscsi_conn=%p conn=%p ep_cid=%d\n",
2657     - beiscsi_conn, conn, beiscsi_ep->ep_cid);
2658     -
2659     - return beiscsi_bindconn_cid(phba, beiscsi_conn, beiscsi_ep->ep_cid);
2660     + "BS_%d : cid %d phba->conn_table[%u]=%p\n",
2661     + beiscsi_ep->ep_cid, cri_index, beiscsi_conn);
2662     + phba->conn_table[cri_index] = beiscsi_conn;
2663     + return 0;
2664     }
2665    
2666     static int beiscsi_iface_create_ipv4(struct beiscsi_hba *phba)
2667     @@ -973,9 +961,9 @@ int beiscsi_conn_start(struct iscsi_cls_conn *cls_conn)
2668     */
2669     static int beiscsi_get_cid(struct beiscsi_hba *phba)
2670     {
2671     - unsigned short cid = 0xFFFF, cid_from_ulp;
2672     - struct ulp_cid_info *cid_info = NULL;
2673     uint16_t cid_avlbl_ulp0, cid_avlbl_ulp1;
2674     + unsigned short cid, cid_from_ulp;
2675     + struct ulp_cid_info *cid_info;
2676    
2677     /* Find the ULP which has more CID available */
2678     cid_avlbl_ulp0 = (phba->cid_array_info[BEISCSI_ULP0]) ?
2679     @@ -984,20 +972,27 @@ static int beiscsi_get_cid(struct beiscsi_hba *phba)
2680     BEISCSI_ULP1_AVLBL_CID(phba) : 0;
2681     cid_from_ulp = (cid_avlbl_ulp0 > cid_avlbl_ulp1) ?
2682     BEISCSI_ULP0 : BEISCSI_ULP1;
2683     -
2684     - if (test_bit(cid_from_ulp, (void *)&phba->fw_config.ulp_supported)) {
2685     - cid_info = phba->cid_array_info[cid_from_ulp];
2686     - if (!cid_info->avlbl_cids)
2687     - return cid;
2688     -
2689     - cid = cid_info->cid_array[cid_info->cid_alloc++];
2690     -
2691     - if (cid_info->cid_alloc == BEISCSI_GET_CID_COUNT(
2692     - phba, cid_from_ulp))
2693     - cid_info->cid_alloc = 0;
2694     -
2695     - cid_info->avlbl_cids--;
2696     + /**
2697     + * If iSCSI protocol is loaded only on ULP 0, and when cid_avlbl_ulp
2698     + * is ZERO for both, ULP 1 is returned.
2699     + * Check if ULP is loaded before getting new CID.
2700     + */
2701     + if (!test_bit(cid_from_ulp, (void *)&phba->fw_config.ulp_supported))
2702     + return BE_INVALID_CID;
2703     +
2704     + cid_info = phba->cid_array_info[cid_from_ulp];
2705     + cid = cid_info->cid_array[cid_info->cid_alloc];
2706     + if (!cid_info->avlbl_cids || cid == BE_INVALID_CID) {
2707     + __beiscsi_log(phba, KERN_ERR,
2708     + "BS_%d : failed to get cid: available %u:%u\n",
2709     + cid_info->avlbl_cids, cid_info->cid_free);
2710     + return BE_INVALID_CID;
2711     }
2712     + /* empty the slot */
2713     + cid_info->cid_array[cid_info->cid_alloc++] = BE_INVALID_CID;
2714     + if (cid_info->cid_alloc == BEISCSI_GET_CID_COUNT(phba, cid_from_ulp))
2715     + cid_info->cid_alloc = 0;
2716     + cid_info->avlbl_cids--;
2717     return cid;
2718     }
2719    
2720     @@ -1008,22 +1003,28 @@ static int beiscsi_get_cid(struct beiscsi_hba *phba)
2721     */
2722     static void beiscsi_put_cid(struct beiscsi_hba *phba, unsigned short cid)
2723     {
2724     - uint16_t cid_post_ulp;
2725     - struct hwi_controller *phwi_ctrlr;
2726     - struct hwi_wrb_context *pwrb_context;
2727     - struct ulp_cid_info *cid_info = NULL;
2728     uint16_t cri_index = BE_GET_CRI_FROM_CID(cid);
2729     + struct hwi_wrb_context *pwrb_context;
2730     + struct hwi_controller *phwi_ctrlr;
2731     + struct ulp_cid_info *cid_info;
2732     + uint16_t cid_post_ulp;
2733    
2734     phwi_ctrlr = phba->phwi_ctrlr;
2735     pwrb_context = &phwi_ctrlr->wrb_context[cri_index];
2736     cid_post_ulp = pwrb_context->ulp_num;
2737    
2738     cid_info = phba->cid_array_info[cid_post_ulp];
2739     - cid_info->avlbl_cids++;
2740     -
2741     + /* fill only in empty slot */
2742     + if (cid_info->cid_array[cid_info->cid_free] != BE_INVALID_CID) {
2743     + __beiscsi_log(phba, KERN_ERR,
2744     + "BS_%d : failed to put cid %u: available %u:%u\n",
2745     + cid, cid_info->avlbl_cids, cid_info->cid_free);
2746     + return;
2747     + }
2748     cid_info->cid_array[cid_info->cid_free++] = cid;
2749     if (cid_info->cid_free == BEISCSI_GET_CID_COUNT(phba, cid_post_ulp))
2750     cid_info->cid_free = 0;
2751     + cid_info->avlbl_cids++;
2752     }
2753    
2754     /**
2755     @@ -1037,8 +1038,8 @@ static void beiscsi_free_ep(struct beiscsi_endpoint *beiscsi_ep)
2756    
2757     beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
2758     beiscsi_ep->phba = NULL;
2759     - phba->ep_array[BE_GET_CRI_FROM_CID
2760     - (beiscsi_ep->ep_cid)] = NULL;
2761     + /* clear this to track freeing in beiscsi_ep_disconnect */
2762     + phba->ep_array[BE_GET_CRI_FROM_CID(beiscsi_ep->ep_cid)] = NULL;
2763    
2764     /**
2765     * Check if any connection resource allocated by driver
2766     @@ -1049,6 +1050,11 @@ static void beiscsi_free_ep(struct beiscsi_endpoint *beiscsi_ep)
2767     return;
2768    
2769     beiscsi_conn = beiscsi_ep->conn;
2770     + /**
2771     + * Break ep->conn link here so that completions after
2772     + * this are ignored.
2773     + */
2774     + beiscsi_ep->conn = NULL;
2775     if (beiscsi_conn->login_in_progress) {
2776     beiscsi_free_mgmt_task_handles(beiscsi_conn,
2777     beiscsi_conn->task);
2778     @@ -1079,7 +1085,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
2779     "BS_%d : In beiscsi_open_conn\n");
2780    
2781     beiscsi_ep->ep_cid = beiscsi_get_cid(phba);
2782     - if (beiscsi_ep->ep_cid == 0xFFFF) {
2783     + if (beiscsi_ep->ep_cid == BE_INVALID_CID) {
2784     beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
2785     "BS_%d : No free cid available\n");
2786     return ret;
2787     @@ -1284,26 +1290,6 @@ static int beiscsi_close_conn(struct beiscsi_endpoint *beiscsi_ep, int flag)
2788     return ret;
2789     }
2790    
2791     -/**
2792     - * beiscsi_unbind_conn_to_cid - Unbind the beiscsi_conn from phba conn table
2793     - * @phba: The phba instance
2794     - * @cid: The cid to free
2795     - */
2796     -static int beiscsi_unbind_conn_to_cid(struct beiscsi_hba *phba,
2797     - unsigned int cid)
2798     -{
2799     - uint16_t cri_index = BE_GET_CRI_FROM_CID(cid);
2800     -
2801     - if (phba->conn_table[cri_index])
2802     - phba->conn_table[cri_index] = NULL;
2803     - else {
2804     - beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
2805     - "BS_%d : Connection table Not occupied.\n");
2806     - return -EINVAL;
2807     - }
2808     - return 0;
2809     -}
2810     -
2811     /**
2812     * beiscsi_ep_disconnect - Tears down the TCP connection
2813     * @ep: endpoint to be used
2814     @@ -1318,13 +1304,23 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
2815     unsigned int tag;
2816     uint8_t mgmt_invalidate_flag, tcp_upload_flag;
2817     unsigned short savecfg_flag = CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH;
2818     + uint16_t cri_index;
2819    
2820     beiscsi_ep = ep->dd_data;
2821     phba = beiscsi_ep->phba;
2822     beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
2823     - "BS_%d : In beiscsi_ep_disconnect for ep_cid = %d\n",
2824     + "BS_%d : In beiscsi_ep_disconnect for ep_cid = %u\n",
2825     beiscsi_ep->ep_cid);
2826    
2827     + cri_index = BE_GET_CRI_FROM_CID(beiscsi_ep->ep_cid);
2828     + if (!phba->ep_array[cri_index]) {
2829     + __beiscsi_log(phba, KERN_ERR,
2830     + "BS_%d : ep_array at %u cid %u empty\n",
2831     + cri_index,
2832     + beiscsi_ep->ep_cid);
2833     + return;
2834     + }
2835     +
2836     if (beiscsi_ep->conn) {
2837     beiscsi_conn = beiscsi_ep->conn;
2838     iscsi_suspend_queue(beiscsi_conn->conn);
2839     @@ -1356,7 +1352,12 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
2840     free_ep:
2841     msleep(BEISCSI_LOGOUT_SYNC_DELAY);
2842     beiscsi_free_ep(beiscsi_ep);
2843     - beiscsi_unbind_conn_to_cid(phba, beiscsi_ep->ep_cid);
2844     + if (!phba->conn_table[cri_index])
2845     + __beiscsi_log(phba, KERN_ERR,
2846     + "BS_%d : conn_table empty at %u: cid %u\n",
2847     + cri_index,
2848     + beiscsi_ep->ep_cid);
2849     + phba->conn_table[cri_index] = NULL;
2850     iscsi_destroy_endpoint(beiscsi_ep->openiscsi_ep);
2851     }
2852    
2853     diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
2854     index d9239c2d49b1..741cc96379cb 100644
2855     --- a/drivers/scsi/be2iscsi/be_main.c
2856     +++ b/drivers/scsi/be2iscsi/be_main.c
2857     @@ -4085,9 +4085,10 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba)
2858     }
2859    
2860     /* Allocate memory for CID array */
2861     - ptr_cid_info->cid_array = kzalloc(sizeof(void *) *
2862     - BEISCSI_GET_CID_COUNT(phba,
2863     - ulp_num), GFP_KERNEL);
2864     + ptr_cid_info->cid_array =
2865     + kcalloc(BEISCSI_GET_CID_COUNT(phba, ulp_num),
2866     + sizeof(*ptr_cid_info->cid_array),
2867     + GFP_KERNEL);
2868     if (!ptr_cid_info->cid_array) {
2869     beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2870     "BM_%d : Failed to allocate memory"
2871     diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
2872     index 6376657e45f7..02d00ab6d981 100644
2873     --- a/drivers/scsi/be2iscsi/be_main.h
2874     +++ b/drivers/scsi/be2iscsi/be_main.h
2875     @@ -358,6 +358,7 @@ struct beiscsi_hba {
2876     unsigned int age;
2877     struct list_head hba_queue;
2878     #define BE_MAX_SESSION 2048
2879     +#define BE_INVALID_CID 0xffff
2880     #define BE_SET_CID_TO_CRI(cri_index, cid) \
2881     (phba->cid_to_cri_map[cid] = cri_index)
2882     #define BE_GET_CRI_FROM_CID(cid) (phba->cid_to_cri_map[cid])
2883     diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
2884     index d6239fa718be..3f3751e2b521 100644
2885     --- a/drivers/spi/spi-pxa2xx.c
2886     +++ b/drivers/spi/spi-pxa2xx.c
2887     @@ -1458,6 +1458,10 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = {
2888     { PCI_VDEVICE(INTEL, 0x1ac2), LPSS_BXT_SSP },
2889     { PCI_VDEVICE(INTEL, 0x1ac4), LPSS_BXT_SSP },
2890     { PCI_VDEVICE(INTEL, 0x1ac6), LPSS_BXT_SSP },
2891     + /* GLK */
2892     + { PCI_VDEVICE(INTEL, 0x31c2), LPSS_BXT_SSP },
2893     + { PCI_VDEVICE(INTEL, 0x31c4), LPSS_BXT_SSP },
2894     + { PCI_VDEVICE(INTEL, 0x31c6), LPSS_BXT_SSP },
2895     /* APL */
2896     { PCI_VDEVICE(INTEL, 0x5ac2), LPSS_BXT_SSP },
2897     { PCI_VDEVICE(INTEL, 0x5ac4), LPSS_BXT_SSP },
2898     diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c
2899     index 3fc912373adf..996bd473dd03 100644
2900     --- a/drivers/tty/goldfish.c
2901     +++ b/drivers/tty/goldfish.c
2902     @@ -300,7 +300,7 @@ static int goldfish_tty_probe(struct platform_device *pdev)
2903     return 0;
2904    
2905     err_tty_register_device_failed:
2906     - free_irq(irq, pdev);
2907     + free_irq(irq, qtty);
2908     err_request_irq_failed:
2909     goldfish_tty_current_line_count--;
2910     if (goldfish_tty_current_line_count == 0)
2911     diff --git a/drivers/tty/serial/8250/8250_moxa.c b/drivers/tty/serial/8250/8250_moxa.c
2912     index 26eb5393a263..d5069b2d4d79 100644
2913     --- a/drivers/tty/serial/8250/8250_moxa.c
2914     +++ b/drivers/tty/serial/8250/8250_moxa.c
2915     @@ -68,6 +68,7 @@ static int moxa8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2916     sizeof(unsigned int) * nr_ports, GFP_KERNEL);
2917     if (!brd)
2918     return -ENOMEM;
2919     + brd->num_ports = nr_ports;
2920    
2921     memset(&uart, 0, sizeof(struct uart_8250_port));
2922    
2923     diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
2924     index f24d3030b98c..1ef31e3ee4a1 100644
2925     --- a/drivers/tty/serial/8250/8250_port.c
2926     +++ b/drivers/tty/serial/8250/8250_port.c
2927     @@ -1751,8 +1751,6 @@ void serial8250_tx_chars(struct uart_8250_port *up)
2928     if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
2929     uart_write_wakeup(port);
2930    
2931     - pr_debug("%s: THRE\n", __func__);
2932     -
2933     /*
2934     * With RPM enabled, we have to wait until the FIFO is empty before the
2935     * HW can go idle. So we get here once again with empty FIFO and disable
2936     @@ -1817,8 +1815,6 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
2937    
2938     status = serial_port_in(port, UART_LSR);
2939    
2940     - pr_debug("%s: status = %x\n", __func__, status);
2941     -
2942     if (status & (UART_LSR_DR | UART_LSR_BI)) {
2943     if (!up->dma || handle_rx_dma(up, iir))
2944     status = serial8250_rx_chars(up, status);
2945     diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c
2946     index 0cf149edddd8..f36a1ac3bfbd 100644
2947     --- a/drivers/usb/chipidea/otg.c
2948     +++ b/drivers/usb/chipidea/otg.c
2949     @@ -134,9 +134,9 @@ void ci_handle_vbus_change(struct ci_hdrc *ci)
2950     if (!ci->is_otg)
2951     return;
2952    
2953     - if (hw_read_otgsc(ci, OTGSC_BSV))
2954     + if (hw_read_otgsc(ci, OTGSC_BSV) && !ci->vbus_active)
2955     usb_gadget_vbus_connect(&ci->gadget);
2956     - else
2957     + else if (!hw_read_otgsc(ci, OTGSC_BSV) && ci->vbus_active)
2958     usb_gadget_vbus_disconnect(&ci->gadget);
2959     }
2960    
2961     @@ -175,14 +175,21 @@ static void ci_handle_id_switch(struct ci_hdrc *ci)
2962    
2963     ci_role_stop(ci);
2964    
2965     - if (role == CI_ROLE_GADGET)
2966     + if (role == CI_ROLE_GADGET &&
2967     + IS_ERR(ci->platdata->vbus_extcon.edev))
2968     /*
2969     - * wait vbus lower than OTGSC_BSV before connecting
2970     - * to host
2971     + * Wait vbus lower than OTGSC_BSV before connecting
2972     + * to host. If connecting status is from an external
2973     + * connector instead of register, we don't need to
2974     + * care vbus on the board, since it will not affect
2975     + * external connector status.
2976     */
2977     hw_wait_vbus_lower_bsv(ci);
2978    
2979     ci_role_start(ci, role);
2980     + /* vbus change may have already occurred */
2981     + if (role == CI_ROLE_GADGET)
2982     + ci_handle_vbus_change(ci);
2983     }
2984     }
2985     /**
2986     diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
2987     index 0b80cee30da4..eb121b2a55d4 100644
2988     --- a/drivers/usb/host/Kconfig
2989     +++ b/drivers/usb/host/Kconfig
2990     @@ -45,9 +45,9 @@ config USB_XHCI_PLATFORM
2991     If unsure, say N.
2992    
2993     config USB_XHCI_MTK
2994     - tristate "xHCI support for Mediatek MT65xx"
2995     + tristate "xHCI support for Mediatek MT65xx/MT7621"
2996     select MFD_SYSCON
2997     - depends on ARCH_MEDIATEK || COMPILE_TEST
2998     + depends on (MIPS && SOC_MT7621) || ARCH_MEDIATEK || COMPILE_TEST
2999     ---help---
3000     Say 'Y' to enable the support for the xHCI host controller
3001     found in Mediatek MT65xx SoCs.
3002     diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
3003     index 136ff5e1b7c1..135eb04368f9 100644
3004     --- a/drivers/usb/serial/mos7720.c
3005     +++ b/drivers/usb/serial/mos7720.c
3006     @@ -234,11 +234,16 @@ static int read_mos_reg(struct usb_serial *serial, unsigned int serial_portnum,
3007    
3008     status = usb_control_msg(usbdev, pipe, request, requesttype, value,
3009     index, buf, 1, MOS_WDR_TIMEOUT);
3010     - if (status == 1)
3011     + if (status == 1) {
3012     *data = *buf;
3013     - else if (status < 0)
3014     + } else {
3015     dev_err(&usbdev->dev,
3016     "mos7720: usb_control_msg() failed: %d\n", status);
3017     + if (status >= 0)
3018     + status = -EIO;
3019     + *data = 0;
3020     + }
3021     +
3022     kfree(buf);
3023    
3024     return status;
3025     diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
3026     index 5c4fc3abf6a7..6baacf64b21e 100644
3027     --- a/drivers/usb/serial/mos7840.c
3028     +++ b/drivers/usb/serial/mos7840.c
3029     @@ -285,9 +285,15 @@ static int mos7840_get_reg_sync(struct usb_serial_port *port, __u16 reg,
3030     ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ,
3031     MCS_RD_RTYPE, 0, reg, buf, VENDOR_READ_LENGTH,
3032     MOS_WDR_TIMEOUT);
3033     + if (ret < VENDOR_READ_LENGTH) {
3034     + if (ret >= 0)
3035     + ret = -EIO;
3036     + goto out;
3037     + }
3038     +
3039     *val = buf[0];
3040     dev_dbg(&port->dev, "%s offset is %x, return val %x\n", __func__, reg, *val);
3041     -
3042     +out:
3043     kfree(buf);
3044     return ret;
3045     }
3046     @@ -353,8 +359,13 @@ static int mos7840_get_uart_reg(struct usb_serial_port *port, __u16 reg,
3047     ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ,
3048     MCS_RD_RTYPE, Wval, reg, buf, VENDOR_READ_LENGTH,
3049     MOS_WDR_TIMEOUT);
3050     + if (ret < VENDOR_READ_LENGTH) {
3051     + if (ret >= 0)
3052     + ret = -EIO;
3053     + goto out;
3054     + }
3055     *val = buf[0];
3056     -
3057     +out:
3058     kfree(buf);
3059     return ret;
3060     }
3061     @@ -1490,10 +1501,10 @@ static int mos7840_tiocmget(struct tty_struct *tty)
3062     return -ENODEV;
3063    
3064     status = mos7840_get_uart_reg(port, MODEM_STATUS_REGISTER, &msr);
3065     - if (status != 1)
3066     + if (status < 0)
3067     return -EIO;
3068     status = mos7840_get_uart_reg(port, MODEM_CONTROL_REGISTER, &mcr);
3069     - if (status != 1)
3070     + if (status < 0)
3071     return -EIO;
3072     result = ((mcr & MCR_DTR) ? TIOCM_DTR : 0)
3073     | ((mcr & MCR_RTS) ? TIOCM_RTS : 0)
3074     diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
3075     index 8a05fa7e2152..f089d7d8afe7 100644
3076     --- a/fs/btrfs/inode.c
3077     +++ b/fs/btrfs/inode.c
3078     @@ -8050,8 +8050,10 @@ static int __btrfs_correct_data_nocsum(struct inode *inode,
3079    
3080     start += sectorsize;
3081    
3082     - if (nr_sectors--) {
3083     + nr_sectors--;
3084     + if (nr_sectors) {
3085     pgoff += sectorsize;
3086     + ASSERT(pgoff < PAGE_SIZE);
3087     goto next_block_or_try_again;
3088     }
3089     }
3090     @@ -8157,8 +8159,10 @@ static int __btrfs_subio_endio_read(struct inode *inode,
3091    
3092     ASSERT(nr_sectors);
3093    
3094     - if (--nr_sectors) {
3095     + nr_sectors--;
3096     + if (nr_sectors) {
3097     pgoff += sectorsize;
3098     + ASSERT(pgoff < PAGE_SIZE);
3099     goto next_block;
3100     }
3101     }
3102     diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
3103     index 71a60cc01451..06a77e47957d 100644
3104     --- a/fs/btrfs/volumes.c
3105     +++ b/fs/btrfs/volumes.c
3106     @@ -6226,7 +6226,7 @@ int btrfs_map_bio(struct btrfs_root *root, struct bio *bio,
3107     for (dev_nr = 0; dev_nr < total_devs; dev_nr++) {
3108     dev = bbio->stripes[dev_nr].dev;
3109     if (!dev || !dev->bdev ||
3110     - (bio_op(bio) == REQ_OP_WRITE && !dev->writeable)) {
3111     + (bio_op(first_bio) == REQ_OP_WRITE && !dev->writeable)) {
3112     bbio_error(bbio, first_bio, logical);
3113     continue;
3114     }
3115     diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
3116     index f7cae1629c6c..7a8b1d72e3d9 100644
3117     --- a/fs/gfs2/glock.c
3118     +++ b/fs/gfs2/glock.c
3119     @@ -1820,16 +1820,18 @@ void gfs2_glock_exit(void)
3120    
3121     static void gfs2_glock_iter_next(struct gfs2_glock_iter *gi)
3122     {
3123     - do {
3124     - gi->gl = rhashtable_walk_next(&gi->hti);
3125     + while ((gi->gl = rhashtable_walk_next(&gi->hti))) {
3126     if (IS_ERR(gi->gl)) {
3127     if (PTR_ERR(gi->gl) == -EAGAIN)
3128     continue;
3129     gi->gl = NULL;
3130     + return;
3131     }
3132     - /* Skip entries for other sb and dead entries */
3133     - } while ((gi->gl) && ((gi->sdp != gi->gl->gl_name.ln_sbd) ||
3134     - __lockref_is_dead(&gi->gl->gl_lockref)));
3135     + /* Skip entries for other sb and dead entries */
3136     + if (gi->sdp == gi->gl->gl_name.ln_sbd &&
3137     + !__lockref_is_dead(&gi->gl->gl_lockref))
3138     + return;
3139     + }
3140     }
3141    
3142     static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos)
3143     diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
3144     index 704fa0b17309..2c2f182cde03 100644
3145     --- a/fs/hugetlbfs/inode.c
3146     +++ b/fs/hugetlbfs/inode.c
3147     @@ -695,14 +695,11 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb,
3148    
3149     inode = new_inode(sb);
3150     if (inode) {
3151     - struct hugetlbfs_inode_info *info;
3152     inode->i_ino = get_next_ino();
3153     inode->i_mode = S_IFDIR | config->mode;
3154     inode->i_uid = config->uid;
3155     inode->i_gid = config->gid;
3156     inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
3157     - info = HUGETLBFS_I(inode);
3158     - mpol_shared_policy_init(&info->policy, NULL);
3159     inode->i_op = &hugetlbfs_dir_inode_operations;
3160     inode->i_fop = &simple_dir_operations;
3161     /* directory inodes start off with i_nlink == 2 (for "." entry) */
3162     @@ -733,7 +730,6 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
3163    
3164     inode = new_inode(sb);
3165     if (inode) {
3166     - struct hugetlbfs_inode_info *info;
3167     inode->i_ino = get_next_ino();
3168     inode_init_owner(inode, dir, mode);
3169     lockdep_set_class(&inode->i_mapping->i_mmap_rwsem,
3170     @@ -741,15 +737,6 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
3171     inode->i_mapping->a_ops = &hugetlbfs_aops;
3172     inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
3173     inode->i_mapping->private_data = resv_map;
3174     - info = HUGETLBFS_I(inode);
3175     - /*
3176     - * The policy is initialized here even if we are creating a
3177     - * private inode because initialization simply creates an
3178     - * an empty rb tree and calls rwlock_init(), later when we
3179     - * call mpol_free_shared_policy() it will just return because
3180     - * the rb tree will still be empty.
3181     - */
3182     - mpol_shared_policy_init(&info->policy, NULL);
3183     switch (mode & S_IFMT) {
3184     default:
3185     init_special_inode(inode, mode, dev);
3186     @@ -937,6 +924,18 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb)
3187     hugetlbfs_inc_free_inodes(sbinfo);
3188     return NULL;
3189     }
3190     +
3191     + /*
3192     + * Any time after allocation, hugetlbfs_destroy_inode can be called
3193     + * for the inode. mpol_free_shared_policy is unconditionally called
3194     + * as part of hugetlbfs_destroy_inode. So, initialize policy here
3195     + * in case of a quick call to destroy.
3196     + *
3197     + * Note that the policy is initialized even if we are creating a
3198     + * private inode. This simplifies hugetlbfs_destroy_inode.
3199     + */
3200     + mpol_shared_policy_init(&p->policy, NULL);
3201     +
3202     return &p->vfs_inode;
3203     }
3204    
3205     diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
3206     index 582bfee40345..af84a92cb142 100644
3207     --- a/fs/nfs/callback.c
3208     +++ b/fs/nfs/callback.c
3209     @@ -239,12 +239,12 @@ static struct svc_serv_ops nfs41_cb_sv_ops = {
3210     .svo_module = THIS_MODULE,
3211     };
3212    
3213     -struct svc_serv_ops *nfs4_cb_sv_ops[] = {
3214     +static struct svc_serv_ops *nfs4_cb_sv_ops[] = {
3215     [0] = &nfs40_cb_sv_ops,
3216     [1] = &nfs41_cb_sv_ops,
3217     };
3218     #else
3219     -struct svc_serv_ops *nfs4_cb_sv_ops[] = {
3220     +static struct svc_serv_ops *nfs4_cb_sv_ops[] = {
3221     [0] = &nfs40_cb_sv_ops,
3222     [1] = NULL,
3223     };
3224     diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c
3225     index 339c696bbc01..bb2beaef531a 100644
3226     --- a/fs/xfs/kmem.c
3227     +++ b/fs/xfs/kmem.c
3228     @@ -24,24 +24,6 @@
3229     #include "kmem.h"
3230     #include "xfs_message.h"
3231    
3232     -/*
3233     - * Greedy allocation. May fail and may return vmalloced memory.
3234     - */
3235     -void *
3236     -kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize)
3237     -{
3238     - void *ptr;
3239     - size_t kmsize = maxsize;
3240     -
3241     - while (!(ptr = vzalloc(kmsize))) {
3242     - if ((kmsize >>= 1) <= minsize)
3243     - kmsize = minsize;
3244     - }
3245     - if (ptr)
3246     - *size = kmsize;
3247     - return ptr;
3248     -}
3249     -
3250     void *
3251     kmem_alloc(size_t size, xfs_km_flags_t flags)
3252     {
3253     diff --git a/fs/xfs/kmem.h b/fs/xfs/kmem.h
3254     index 689f746224e7..f0fc84fcaac2 100644
3255     --- a/fs/xfs/kmem.h
3256     +++ b/fs/xfs/kmem.h
3257     @@ -69,8 +69,6 @@ static inline void kmem_free(const void *ptr)
3258     }
3259    
3260    
3261     -extern void *kmem_zalloc_greedy(size_t *, size_t, size_t);
3262     -
3263     static inline void *
3264     kmem_zalloc(size_t size, xfs_km_flags_t flags)
3265     {
3266     diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
3267     index d8a77dbf4e3a..26d67ce3c18d 100644
3268     --- a/fs/xfs/xfs_itable.c
3269     +++ b/fs/xfs/xfs_itable.c
3270     @@ -361,7 +361,6 @@ xfs_bulkstat(
3271     xfs_agino_t agino; /* inode # in allocation group */
3272     xfs_agnumber_t agno; /* allocation group number */
3273     xfs_btree_cur_t *cur; /* btree cursor for ialloc btree */
3274     - size_t irbsize; /* size of irec buffer in bytes */
3275     xfs_inobt_rec_incore_t *irbuf; /* start of irec buffer */
3276     int nirbuf; /* size of irbuf */
3277     int ubcount; /* size of user's buffer */
3278     @@ -388,11 +387,10 @@ xfs_bulkstat(
3279     *ubcountp = 0;
3280     *done = 0;
3281    
3282     - irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4);
3283     + irbuf = kmem_zalloc_large(PAGE_SIZE * 4, KM_SLEEP);
3284     if (!irbuf)
3285     return -ENOMEM;
3286     -
3287     - nirbuf = irbsize / sizeof(*irbuf);
3288     + nirbuf = (PAGE_SIZE * 4) / sizeof(*irbuf);
3289    
3290     /*
3291     * Loop over the allocation groups, starting from the last
3292     diff --git a/include/linux/audit.h b/include/linux/audit.h
3293     index 9d4443f93db6..2be99b276d29 100644
3294     --- a/include/linux/audit.h
3295     +++ b/include/linux/audit.h
3296     @@ -387,6 +387,20 @@ static inline int audit_socketcall(int nargs, unsigned long *args)
3297     return __audit_socketcall(nargs, args);
3298     return 0;
3299     }
3300     +
3301     +static inline int audit_socketcall_compat(int nargs, u32 *args)
3302     +{
3303     + unsigned long a[AUDITSC_ARGS];
3304     + int i;
3305     +
3306     + if (audit_dummy_context())
3307     + return 0;
3308     +
3309     + for (i = 0; i < nargs; i++)
3310     + a[i] = (unsigned long)args[i];
3311     + return __audit_socketcall(nargs, a);
3312     +}
3313     +
3314     static inline int audit_sockaddr(int len, void *addr)
3315     {
3316     if (unlikely(!audit_dummy_context()))
3317     @@ -513,6 +527,12 @@ static inline int audit_socketcall(int nargs, unsigned long *args)
3318     {
3319     return 0;
3320     }
3321     +
3322     +static inline int audit_socketcall_compat(int nargs, u32 *args)
3323     +{
3324     + return 0;
3325     +}
3326     +
3327     static inline void audit_fd_pair(int fd1, int fd2)
3328     { }
3329     static inline int audit_sockaddr(int len, void *addr)
3330     diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
3331     index aab032a6ae61..97ca105347a6 100644
3332     --- a/include/linux/mmc/sdio_func.h
3333     +++ b/include/linux/mmc/sdio_func.h
3334     @@ -53,7 +53,7 @@ struct sdio_func {
3335     unsigned int state; /* function state */
3336     #define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */
3337    
3338     - u8 tmpbuf[4]; /* DMA:able scratch buffer */
3339     + u8 *tmpbuf; /* DMA:able scratch buffer */
3340    
3341     unsigned num_info; /* number of info strings */
3342     const char **info; /* info strings */
3343     diff --git a/include/net/netfilter/nf_tables_ipv6.h b/include/net/netfilter/nf_tables_ipv6.h
3344     index d150b5066201..97983d1c05e4 100644
3345     --- a/include/net/netfilter/nf_tables_ipv6.h
3346     +++ b/include/net/netfilter/nf_tables_ipv6.h
3347     @@ -9,12 +9,13 @@ nft_set_pktinfo_ipv6(struct nft_pktinfo *pkt,
3348     struct sk_buff *skb,
3349     const struct nf_hook_state *state)
3350     {
3351     + unsigned int flags = IP6_FH_F_AUTH;
3352     int protohdr, thoff = 0;
3353     unsigned short frag_off;
3354    
3355     nft_set_pktinfo(pkt, skb, state);
3356    
3357     - protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL);
3358     + protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, &flags);
3359     if (protohdr < 0) {
3360     nft_set_pktinfo_proto_unspec(pkt, skb);
3361     return;
3362     @@ -32,6 +33,7 @@ __nft_set_pktinfo_ipv6_validate(struct nft_pktinfo *pkt,
3363     const struct nf_hook_state *state)
3364     {
3365     #if IS_ENABLED(CONFIG_IPV6)
3366     + unsigned int flags = IP6_FH_F_AUTH;
3367     struct ipv6hdr *ip6h, _ip6h;
3368     unsigned int thoff = 0;
3369     unsigned short frag_off;
3370     @@ -50,7 +52,7 @@ __nft_set_pktinfo_ipv6_validate(struct nft_pktinfo *pkt,
3371     if (pkt_len + sizeof(*ip6h) > skb->len)
3372     return -1;
3373    
3374     - protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL);
3375     + protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, &flags);
3376     if (protohdr < 0)
3377     return -1;
3378    
3379     diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
3380     index a5890bf44c0a..d1601a621929 100644
3381     --- a/include/uapi/drm/drm_fourcc.h
3382     +++ b/include/uapi/drm/drm_fourcc.h
3383     @@ -154,6 +154,7 @@ extern "C" {
3384    
3385     /* Vendor Ids: */
3386     #define DRM_FORMAT_MOD_NONE 0
3387     +#define DRM_FORMAT_MOD_VENDOR_NONE 0
3388     #define DRM_FORMAT_MOD_VENDOR_INTEL 0x01
3389     #define DRM_FORMAT_MOD_VENDOR_AMD 0x02
3390     #define DRM_FORMAT_MOD_VENDOR_NV 0x03
3391     diff --git a/mm/memcontrol.c b/mm/memcontrol.c
3392     index 47559cc0cdcc..2a800c4a39bd 100644
3393     --- a/mm/memcontrol.c
3394     +++ b/mm/memcontrol.c
3395     @@ -462,6 +462,8 @@ static void mem_cgroup_update_tree(struct mem_cgroup *memcg, struct page *page)
3396     struct mem_cgroup_tree_per_node *mctz;
3397    
3398     mctz = soft_limit_tree_from_page(page);
3399     + if (!mctz)
3400     + return;
3401     /*
3402     * Necessary to update all ancestors when hierarchy is used.
3403     * because their event counter is not touched.
3404     @@ -499,7 +501,8 @@ static void mem_cgroup_remove_from_trees(struct mem_cgroup *memcg)
3405     for_each_node(nid) {
3406     mz = mem_cgroup_nodeinfo(memcg, nid);
3407     mctz = soft_limit_tree_node(nid);
3408     - mem_cgroup_remove_exceeded(mz, mctz);
3409     + if (mctz)
3410     + mem_cgroup_remove_exceeded(mz, mctz);
3411     }
3412     }
3413    
3414     @@ -2565,7 +2568,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
3415     * is empty. Do it lockless to prevent lock bouncing. Races
3416     * are acceptable as soft limit is best effort anyway.
3417     */
3418     - if (RB_EMPTY_ROOT(&mctz->rb_root))
3419     + if (!mctz || RB_EMPTY_ROOT(&mctz->rb_root))
3420     return 0;
3421    
3422     /*
3423     diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
3424     index 7625ec8458de..5d4006e589cb 100644
3425     --- a/net/bridge/br_netlink.c
3426     +++ b/net/bridge/br_netlink.c
3427     @@ -1098,11 +1098,14 @@ static int br_dev_newlink(struct net *src_net, struct net_device *dev,
3428     spin_unlock_bh(&br->lock);
3429     }
3430    
3431     - err = br_changelink(dev, tb, data);
3432     + err = register_netdevice(dev);
3433     if (err)
3434     return err;
3435    
3436     - return register_netdevice(dev);
3437     + err = br_changelink(dev, tb, data);
3438     + if (err)
3439     + unregister_netdevice(dev);
3440     + return err;
3441     }
3442    
3443     static size_t br_get_size(const struct net_device *brdev)
3444     diff --git a/net/compat.c b/net/compat.c
3445     index 1cd2ec046164..a96fd2f3507b 100644
3446     --- a/net/compat.c
3447     +++ b/net/compat.c
3448     @@ -22,6 +22,7 @@
3449     #include <linux/filter.h>
3450     #include <linux/compat.h>
3451     #include <linux/security.h>
3452     +#include <linux/audit.h>
3453     #include <linux/export.h>
3454    
3455     #include <net/scm.h>
3456     @@ -781,14 +782,24 @@ COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
3457    
3458     COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args)
3459     {
3460     - int ret;
3461     - u32 a[6];
3462     + u32 a[AUDITSC_ARGS];
3463     + unsigned int len;
3464     u32 a0, a1;
3465     + int ret;
3466    
3467     if (call < SYS_SOCKET || call > SYS_SENDMMSG)
3468     return -EINVAL;
3469     - if (copy_from_user(a, args, nas[call]))
3470     + len = nas[call];
3471     + if (len > sizeof(a))
3472     + return -EINVAL;
3473     +
3474     + if (copy_from_user(a, args, len))
3475     return -EFAULT;
3476     +
3477     + ret = audit_socketcall_compat(len / sizeof(a[0]), a);
3478     + if (ret)
3479     + return ret;
3480     +
3481     a0 = a[0];
3482     a1 = a[1];
3483    
3484     diff --git a/net/core/dev.c b/net/core/dev.c
3485     index ba7b8121a414..7f2caad46a3d 100644
3486     --- a/net/core/dev.c
3487     +++ b/net/core/dev.c
3488     @@ -2355,6 +2355,9 @@ void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason)
3489     {
3490     unsigned long flags;
3491    
3492     + if (unlikely(!skb))
3493     + return;
3494     +
3495     if (likely(atomic_read(&skb->users) == 1)) {
3496     smp_rmb();
3497     atomic_set(&skb->users, 0);
3498     diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
3499     index c9b52c361da2..5a8f7c360887 100644
3500     --- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
3501     +++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
3502     @@ -1304,6 +1304,7 @@ static int __init nf_nat_snmp_basic_init(void)
3503     static void __exit nf_nat_snmp_basic_fini(void)
3504     {
3505     RCU_INIT_POINTER(nf_nat_snmp_hook, NULL);
3506     + synchronize_rcu();
3507     nf_conntrack_helper_unregister(&snmp_trap_helper);
3508     }
3509    
3510     diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
3511     index 6de016f80f17..0932c85b42af 100644
3512     --- a/net/ipv4/udp_offload.c
3513     +++ b/net/ipv4/udp_offload.c
3514     @@ -29,6 +29,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,
3515     u16 mac_len = skb->mac_len;
3516     int udp_offset, outer_hlen;
3517     __wsum partial;
3518     + bool need_ipsec;
3519    
3520     if (unlikely(!pskb_may_pull(skb, tnl_hlen)))
3521     goto out;
3522     @@ -62,8 +63,10 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,
3523    
3524     ufo = !!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP);
3525    
3526     + need_ipsec = skb_dst(skb) && dst_xfrm(skb_dst(skb));
3527     /* Try to offload checksum if possible */
3528     offload_csum = !!(need_csum &&
3529     + !need_ipsec &&
3530     (skb->dev->features &
3531     (is_ipv6 ? (NETIF_F_HW_CSUM | NETIF_F_IPV6_CSUM) :
3532     (NETIF_F_HW_CSUM | NETIF_F_IP_CSUM))));
3533     diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c
3534     index da9df2d56e66..22fc32143e9c 100644
3535     --- a/net/netfilter/nf_conntrack_ecache.c
3536     +++ b/net/netfilter/nf_conntrack_ecache.c
3537     @@ -290,6 +290,7 @@ void nf_conntrack_unregister_notifier(struct net *net,
3538     BUG_ON(notify != new);
3539     RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, NULL);
3540     mutex_unlock(&nf_ct_ecache_mutex);
3541     + /* synchronize_rcu() is called from ctnetlink_exit. */
3542     }
3543     EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier);
3544    
3545     @@ -326,6 +327,7 @@ void nf_ct_expect_unregister_notifier(struct net *net,
3546     BUG_ON(notify != new);
3547     RCU_INIT_POINTER(net->ct.nf_expect_event_cb, NULL);
3548     mutex_unlock(&nf_ct_ecache_mutex);
3549     + /* synchronize_rcu() is called from ctnetlink_exit. */
3550     }
3551     EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier);
3552    
3553     diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
3554     index 04111c1c3988..d5caed5bcfb1 100644
3555     --- a/net/netfilter/nf_conntrack_netlink.c
3556     +++ b/net/netfilter/nf_conntrack_netlink.c
3557     @@ -3413,6 +3413,7 @@ static void __exit ctnetlink_exit(void)
3558     #ifdef CONFIG_NETFILTER_NETLINK_GLUE_CT
3559     RCU_INIT_POINTER(nfnl_ct_hook, NULL);
3560     #endif
3561     + synchronize_rcu();
3562     }
3563    
3564     module_init(ctnetlink_init);
3565     diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
3566     index dde64c4565d2..2916f4815c9c 100644
3567     --- a/net/netfilter/nf_nat_core.c
3568     +++ b/net/netfilter/nf_nat_core.c
3569     @@ -892,6 +892,8 @@ static void __exit nf_nat_cleanup(void)
3570     #ifdef CONFIG_XFRM
3571     RCU_INIT_POINTER(nf_nat_decode_session_hook, NULL);
3572     #endif
3573     + synchronize_rcu();
3574     +
3575     for (i = 0; i < NFPROTO_NUMPROTO; i++)
3576     kfree(nf_nat_l4protos[i]);
3577    
3578     diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c
3579     index 3b79f34b5095..b1fcfa08f0b4 100644
3580     --- a/net/netfilter/nfnetlink_cthelper.c
3581     +++ b/net/netfilter/nfnetlink_cthelper.c
3582     @@ -161,6 +161,7 @@ nfnl_cthelper_parse_expect_policy(struct nf_conntrack_helper *helper,
3583     int i, ret;
3584     struct nf_conntrack_expect_policy *expect_policy;
3585     struct nlattr *tb[NFCTH_POLICY_SET_MAX+1];
3586     + unsigned int class_max;
3587    
3588     ret = nla_parse_nested(tb, NFCTH_POLICY_SET_MAX, attr,
3589     nfnl_cthelper_expect_policy_set);
3590     @@ -170,19 +171,18 @@ nfnl_cthelper_parse_expect_policy(struct nf_conntrack_helper *helper,
3591     if (!tb[NFCTH_POLICY_SET_NUM])
3592     return -EINVAL;
3593    
3594     - helper->expect_class_max =
3595     - ntohl(nla_get_be32(tb[NFCTH_POLICY_SET_NUM]));
3596     -
3597     - if (helper->expect_class_max != 0 &&
3598     - helper->expect_class_max > NF_CT_MAX_EXPECT_CLASSES)
3599     + class_max = ntohl(nla_get_be32(tb[NFCTH_POLICY_SET_NUM]));
3600     + if (class_max == 0)
3601     + return -EINVAL;
3602     + if (class_max > NF_CT_MAX_EXPECT_CLASSES)
3603     return -EOVERFLOW;
3604    
3605     expect_policy = kzalloc(sizeof(struct nf_conntrack_expect_policy) *
3606     - helper->expect_class_max, GFP_KERNEL);
3607     + class_max, GFP_KERNEL);
3608     if (expect_policy == NULL)
3609     return -ENOMEM;
3610    
3611     - for (i=0; i<helper->expect_class_max; i++) {
3612     + for (i = 0; i < class_max; i++) {
3613     if (!tb[NFCTH_POLICY_SET+i])
3614     goto err;
3615    
3616     @@ -191,6 +191,8 @@ nfnl_cthelper_parse_expect_policy(struct nf_conntrack_helper *helper,
3617     if (ret < 0)
3618     goto err;
3619     }
3620     +
3621     + helper->expect_class_max = class_max - 1;
3622     helper->expect_policy = expect_policy;
3623     return 0;
3624     err:
3625     @@ -377,10 +379,10 @@ nfnl_cthelper_dump_policy(struct sk_buff *skb,
3626     goto nla_put_failure;
3627    
3628     if (nla_put_be32(skb, NFCTH_POLICY_SET_NUM,
3629     - htonl(helper->expect_class_max)))
3630     + htonl(helper->expect_class_max + 1)))
3631     goto nla_put_failure;
3632    
3633     - for (i=0; i<helper->expect_class_max; i++) {
3634     + for (i = 0; i < helper->expect_class_max + 1; i++) {
3635     nest_parms2 = nla_nest_start(skb,
3636     (NFCTH_POLICY_SET+i) | NLA_F_NESTED);
3637     if (nest_parms2 == NULL)
3638     diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c
3639     index 139e0867e56e..47d6656c9119 100644
3640     --- a/net/netfilter/nfnetlink_cttimeout.c
3641     +++ b/net/netfilter/nfnetlink_cttimeout.c
3642     @@ -646,8 +646,8 @@ static void __exit cttimeout_exit(void)
3643     #ifdef CONFIG_NF_CONNTRACK_TIMEOUT
3644     RCU_INIT_POINTER(nf_ct_timeout_find_get_hook, NULL);
3645     RCU_INIT_POINTER(nf_ct_timeout_put_hook, NULL);
3646     + synchronize_rcu();
3647     #endif /* CONFIG_NF_CONNTRACK_TIMEOUT */
3648     - rcu_barrier();
3649     }
3650    
3651     module_init(cttimeout_init);
3652     diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
3653     index 35ba4b60d927..9c92c6cb6a4f 100644
3654     --- a/net/packet/af_packet.c
3655     +++ b/net/packet/af_packet.c
3656     @@ -3884,6 +3884,8 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
3657     case PACKET_HDRLEN:
3658     if (len > sizeof(int))
3659     len = sizeof(int);
3660     + if (len < sizeof(int))
3661     + return -EINVAL;
3662     if (copy_from_user(&val, optval, len))
3663     return -EFAULT;
3664     switch (val) {
3665     diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
3666     index 5b2ab95afa07..169156cfd4c8 100644
3667     --- a/net/rds/ib_cm.c
3668     +++ b/net/rds/ib_cm.c
3669     @@ -405,7 +405,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
3670     ret = PTR_ERR(ic->i_send_cq);
3671     ic->i_send_cq = NULL;
3672     rdsdebug("ib_create_cq send failed: %d\n", ret);
3673     - goto out;
3674     + goto rds_ibdev_out;
3675     }
3676    
3677     cq_attr.cqe = ic->i_recv_ring.w_nr;
3678     @@ -416,19 +416,19 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
3679     ret = PTR_ERR(ic->i_recv_cq);
3680     ic->i_recv_cq = NULL;
3681     rdsdebug("ib_create_cq recv failed: %d\n", ret);
3682     - goto out;
3683     + goto send_cq_out;
3684     }
3685    
3686     ret = ib_req_notify_cq(ic->i_send_cq, IB_CQ_NEXT_COMP);
3687     if (ret) {
3688     rdsdebug("ib_req_notify_cq send failed: %d\n", ret);
3689     - goto out;
3690     + goto recv_cq_out;
3691     }
3692    
3693     ret = ib_req_notify_cq(ic->i_recv_cq, IB_CQ_SOLICITED);
3694     if (ret) {
3695     rdsdebug("ib_req_notify_cq recv failed: %d\n", ret);
3696     - goto out;
3697     + goto recv_cq_out;
3698     }
3699    
3700     /* XXX negotiate max send/recv with remote? */
3701     @@ -453,7 +453,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
3702     ret = rdma_create_qp(ic->i_cm_id, ic->i_pd, &attr);
3703     if (ret) {
3704     rdsdebug("rdma_create_qp failed: %d\n", ret);
3705     - goto out;
3706     + goto recv_cq_out;
3707     }
3708    
3709     ic->i_send_hdrs = ib_dma_alloc_coherent(dev,
3710     @@ -463,7 +463,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
3711     if (!ic->i_send_hdrs) {
3712     ret = -ENOMEM;
3713     rdsdebug("ib_dma_alloc_coherent send failed\n");
3714     - goto out;
3715     + goto qp_out;
3716     }
3717    
3718     ic->i_recv_hdrs = ib_dma_alloc_coherent(dev,
3719     @@ -473,7 +473,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
3720     if (!ic->i_recv_hdrs) {
3721     ret = -ENOMEM;
3722     rdsdebug("ib_dma_alloc_coherent recv failed\n");
3723     - goto out;
3724     + goto send_hdrs_dma_out;
3725     }
3726    
3727     ic->i_ack = ib_dma_alloc_coherent(dev, sizeof(struct rds_header),
3728     @@ -481,7 +481,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
3729     if (!ic->i_ack) {
3730     ret = -ENOMEM;
3731     rdsdebug("ib_dma_alloc_coherent ack failed\n");
3732     - goto out;
3733     + goto recv_hdrs_dma_out;
3734     }
3735    
3736     ic->i_sends = vzalloc_node(ic->i_send_ring.w_nr * sizeof(struct rds_ib_send_work),
3737     @@ -489,7 +489,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
3738     if (!ic->i_sends) {
3739     ret = -ENOMEM;
3740     rdsdebug("send allocation failed\n");
3741     - goto out;
3742     + goto ack_dma_out;
3743     }
3744    
3745     ic->i_recvs = vzalloc_node(ic->i_recv_ring.w_nr * sizeof(struct rds_ib_recv_work),
3746     @@ -497,7 +497,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
3747     if (!ic->i_recvs) {
3748     ret = -ENOMEM;
3749     rdsdebug("recv allocation failed\n");
3750     - goto out;
3751     + goto sends_out;
3752     }
3753    
3754     rds_ib_recv_init_ack(ic);
3755     @@ -505,8 +505,33 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
3756     rdsdebug("conn %p pd %p cq %p %p\n", conn, ic->i_pd,
3757     ic->i_send_cq, ic->i_recv_cq);
3758    
3759     -out:
3760     + return ret;
3761     +
3762     +sends_out:
3763     + vfree(ic->i_sends);
3764     +ack_dma_out:
3765     + ib_dma_free_coherent(dev, sizeof(struct rds_header),
3766     + ic->i_ack, ic->i_ack_dma);
3767     +recv_hdrs_dma_out:
3768     + ib_dma_free_coherent(dev, ic->i_recv_ring.w_nr *
3769     + sizeof(struct rds_header),
3770     + ic->i_recv_hdrs, ic->i_recv_hdrs_dma);
3771     +send_hdrs_dma_out:
3772     + ib_dma_free_coherent(dev, ic->i_send_ring.w_nr *
3773     + sizeof(struct rds_header),
3774     + ic->i_send_hdrs, ic->i_send_hdrs_dma);
3775     +qp_out:
3776     + rdma_destroy_qp(ic->i_cm_id);
3777     +recv_cq_out:
3778     + if (!ib_destroy_cq(ic->i_recv_cq))
3779     + ic->i_recv_cq = NULL;
3780     +send_cq_out:
3781     + if (!ib_destroy_cq(ic->i_send_cq))
3782     + ic->i_send_cq = NULL;
3783     +rds_ibdev_out:
3784     + rds_ib_remove_conn(rds_ibdev, conn);
3785     rds_ib_dev_put(rds_ibdev);
3786     +
3787     return ret;
3788     }
3789    
3790     diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c
3791     index 84d90c97332f..191098173018 100644
3792     --- a/net/rds/ib_send.c
3793     +++ b/net/rds/ib_send.c
3794     @@ -69,16 +69,6 @@ static void rds_ib_send_complete(struct rds_message *rm,
3795     complete(rm, notify_status);
3796     }
3797    
3798     -static void rds_ib_send_unmap_data(struct rds_ib_connection *ic,
3799     - struct rm_data_op *op,
3800     - int wc_status)
3801     -{
3802     - if (op->op_nents)
3803     - ib_dma_unmap_sg(ic->i_cm_id->device,
3804     - op->op_sg, op->op_nents,
3805     - DMA_TO_DEVICE);
3806     -}
3807     -
3808     static void rds_ib_send_unmap_rdma(struct rds_ib_connection *ic,
3809     struct rm_rdma_op *op,
3810     int wc_status)
3811     @@ -139,6 +129,21 @@ static void rds_ib_send_unmap_atomic(struct rds_ib_connection *ic,
3812     rds_ib_stats_inc(s_ib_atomic_fadd);
3813     }
3814    
3815     +static void rds_ib_send_unmap_data(struct rds_ib_connection *ic,
3816     + struct rm_data_op *op,
3817     + int wc_status)
3818     +{
3819     + struct rds_message *rm = container_of(op, struct rds_message, data);
3820     +
3821     + if (op->op_nents)
3822     + ib_dma_unmap_sg(ic->i_cm_id->device,
3823     + op->op_sg, op->op_nents,
3824     + DMA_TO_DEVICE);
3825     +
3826     + if (rm->rdma.op_active && rm->data.op_notify)
3827     + rds_ib_send_unmap_rdma(ic, &rm->rdma, wc_status);
3828     +}
3829     +
3830     /*
3831     * Unmap the resources associated with a struct send_work.
3832     *
3833     diff --git a/net/rds/rdma.c b/net/rds/rdma.c
3834     index 4c93badeabf2..8d3a851a3476 100644
3835     --- a/net/rds/rdma.c
3836     +++ b/net/rds/rdma.c
3837     @@ -626,6 +626,16 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
3838     }
3839     op->op_notifier->n_user_token = args->user_token;
3840     op->op_notifier->n_status = RDS_RDMA_SUCCESS;
3841     +
3842     + /* Enable rmda notification on data operation for composite
3843     + * rds messages and make sure notification is enabled only
3844     + * for the data operation which follows it so that application
3845     + * gets notified only after full message gets delivered.
3846     + */
3847     + if (rm->data.op_sg) {
3848     + rm->rdma.op_notify = 0;
3849     + rm->data.op_notify = !!(args->flags & RDS_RDMA_NOTIFY_ME);
3850     + }
3851     }
3852    
3853     /* The cookie contains the R_Key of the remote memory region, and
3854     diff --git a/net/rds/rds.h b/net/rds/rds.h
3855     index 67ba67c058b1..f107a968ddff 100644
3856     --- a/net/rds/rds.h
3857     +++ b/net/rds/rds.h
3858     @@ -414,6 +414,7 @@ struct rds_message {
3859     } rdma;
3860     struct rm_data_op {
3861     unsigned int op_active:1;
3862     + unsigned int op_notify:1;
3863     unsigned int op_nents;
3864     unsigned int op_count;
3865     unsigned int op_dmasg;
3866     diff --git a/net/rds/send.c b/net/rds/send.c
3867     index 896626b9a0ef..f28651b6ae83 100644
3868     --- a/net/rds/send.c
3869     +++ b/net/rds/send.c
3870     @@ -475,12 +475,14 @@ void rds_rdma_send_complete(struct rds_message *rm, int status)
3871     struct rm_rdma_op *ro;
3872     struct rds_notifier *notifier;
3873     unsigned long flags;
3874     + unsigned int notify = 0;
3875    
3876     spin_lock_irqsave(&rm->m_rs_lock, flags);
3877    
3878     + notify = rm->rdma.op_notify | rm->data.op_notify;
3879     ro = &rm->rdma;
3880     if (test_bit(RDS_MSG_ON_SOCK, &rm->m_flags) &&
3881     - ro->op_active && ro->op_notify && ro->op_notifier) {
3882     + ro->op_active && notify && ro->op_notifier) {
3883     notifier = ro->op_notifier;
3884     rs = rm->m_rs;
3885     sock_hold(rds_rs_to_sk(rs));
3886     diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c
3887     index e1af24f87566..c308a4f70550 100644
3888     --- a/sound/pci/au88x0/au88x0_core.c
3889     +++ b/sound/pci/au88x0/au88x0_core.c
3890     @@ -2279,6 +2279,9 @@ vortex_adb_allocroute(vortex_t *vortex, int dma, int nr_ch, int dir,
3891     } else {
3892     int src[2], mix[2];
3893    
3894     + if (nr_ch < 1)
3895     + return -EINVAL;
3896     +
3897     /* Get SRC and MIXER hardware resources. */
3898     for (i = 0; i < nr_ch; i++) {
3899     if ((mix[i] =
3900     diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c
3901     index f24b7cfd3a89..e024800213f5 100644
3902     --- a/sound/soc/codecs/rt5514.c
3903     +++ b/sound/soc/codecs/rt5514.c
3904     @@ -395,14 +395,14 @@ static const char * const rt5514_dmic_src[] = {
3905     "DMIC1", "DMIC2"
3906     };
3907    
3908     -static const SOC_ENUM_SINGLE_DECL(
3909     +static SOC_ENUM_SINGLE_DECL(
3910     rt5514_stereo1_dmic_enum, RT5514_DIG_SOURCE_CTRL,
3911     RT5514_AD0_DMIC_INPUT_SEL_SFT, rt5514_dmic_src);
3912    
3913     static const struct snd_kcontrol_new rt5514_sto1_dmic_mux =
3914     SOC_DAPM_ENUM("Stereo1 DMIC Source", rt5514_stereo1_dmic_enum);
3915    
3916     -static const SOC_ENUM_SINGLE_DECL(
3917     +static SOC_ENUM_SINGLE_DECL(
3918     rt5514_stereo2_dmic_enum, RT5514_DIG_SOURCE_CTRL,
3919     RT5514_AD1_DMIC_INPUT_SEL_SFT, rt5514_dmic_src);
3920    
3921     diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c
3922     index db54550aed60..635818fcda00 100644
3923     --- a/sound/soc/codecs/rt5659.c
3924     +++ b/sound/soc/codecs/rt5659.c
3925     @@ -1150,28 +1150,28 @@ static const char * const rt5659_data_select[] = {
3926     "L/R", "R/L", "L/L", "R/R"
3927     };
3928    
3929     -static const SOC_ENUM_SINGLE_DECL(rt5659_if1_01_adc_enum,
3930     +static SOC_ENUM_SINGLE_DECL(rt5659_if1_01_adc_enum,
3931     RT5659_TDM_CTRL_2, RT5659_DS_ADC_SLOT01_SFT, rt5659_data_select);
3932    
3933     -static const SOC_ENUM_SINGLE_DECL(rt5659_if1_23_adc_enum,
3934     +static SOC_ENUM_SINGLE_DECL(rt5659_if1_23_adc_enum,
3935     RT5659_TDM_CTRL_2, RT5659_DS_ADC_SLOT23_SFT, rt5659_data_select);
3936    
3937     -static const SOC_ENUM_SINGLE_DECL(rt5659_if1_45_adc_enum,
3938     +static SOC_ENUM_SINGLE_DECL(rt5659_if1_45_adc_enum,
3939     RT5659_TDM_CTRL_2, RT5659_DS_ADC_SLOT45_SFT, rt5659_data_select);
3940    
3941     -static const SOC_ENUM_SINGLE_DECL(rt5659_if1_67_adc_enum,
3942     +static SOC_ENUM_SINGLE_DECL(rt5659_if1_67_adc_enum,
3943     RT5659_TDM_CTRL_2, RT5659_DS_ADC_SLOT67_SFT, rt5659_data_select);
3944    
3945     -static const SOC_ENUM_SINGLE_DECL(rt5659_if2_dac_enum,
3946     +static SOC_ENUM_SINGLE_DECL(rt5659_if2_dac_enum,
3947     RT5659_DIG_INF23_DATA, RT5659_IF2_DAC_SEL_SFT, rt5659_data_select);
3948    
3949     -static const SOC_ENUM_SINGLE_DECL(rt5659_if2_adc_enum,
3950     +static SOC_ENUM_SINGLE_DECL(rt5659_if2_adc_enum,
3951     RT5659_DIG_INF23_DATA, RT5659_IF2_ADC_SEL_SFT, rt5659_data_select);
3952    
3953     -static const SOC_ENUM_SINGLE_DECL(rt5659_if3_dac_enum,
3954     +static SOC_ENUM_SINGLE_DECL(rt5659_if3_dac_enum,
3955     RT5659_DIG_INF23_DATA, RT5659_IF3_DAC_SEL_SFT, rt5659_data_select);
3956    
3957     -static const SOC_ENUM_SINGLE_DECL(rt5659_if3_adc_enum,
3958     +static SOC_ENUM_SINGLE_DECL(rt5659_if3_adc_enum,
3959     RT5659_DIG_INF23_DATA, RT5659_IF3_ADC_SEL_SFT, rt5659_data_select);
3960    
3961     static const struct snd_kcontrol_new rt5659_if1_01_adc_swap_mux =
3962     @@ -1207,31 +1207,31 @@ static unsigned int rt5659_asrc_clk_map_values[] = {
3963     0, 1, 2, 3, 5, 6,
3964     };
3965    
3966     -static const SOC_VALUE_ENUM_SINGLE_DECL(
3967     +static SOC_VALUE_ENUM_SINGLE_DECL(
3968     rt5659_da_sto_asrc_enum, RT5659_ASRC_2, RT5659_DA_STO_T_SFT, 0x7,
3969     rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
3970    
3971     -static const SOC_VALUE_ENUM_SINGLE_DECL(
3972     +static SOC_VALUE_ENUM_SINGLE_DECL(
3973     rt5659_da_monol_asrc_enum, RT5659_ASRC_2, RT5659_DA_MONO_L_T_SFT, 0x7,
3974     rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
3975    
3976     -static const SOC_VALUE_ENUM_SINGLE_DECL(
3977     +static SOC_VALUE_ENUM_SINGLE_DECL(
3978     rt5659_da_monor_asrc_enum, RT5659_ASRC_2, RT5659_DA_MONO_R_T_SFT, 0x7,
3979     rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
3980    
3981     -static const SOC_VALUE_ENUM_SINGLE_DECL(
3982     +static SOC_VALUE_ENUM_SINGLE_DECL(
3983     rt5659_ad_sto1_asrc_enum, RT5659_ASRC_2, RT5659_AD_STO1_T_SFT, 0x7,
3984     rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
3985    
3986     -static const SOC_VALUE_ENUM_SINGLE_DECL(
3987     +static SOC_VALUE_ENUM_SINGLE_DECL(
3988     rt5659_ad_sto2_asrc_enum, RT5659_ASRC_3, RT5659_AD_STO2_T_SFT, 0x7,
3989     rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
3990    
3991     -static const SOC_VALUE_ENUM_SINGLE_DECL(
3992     +static SOC_VALUE_ENUM_SINGLE_DECL(
3993     rt5659_ad_monol_asrc_enum, RT5659_ASRC_3, RT5659_AD_MONO_L_T_SFT, 0x7,
3994     rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
3995    
3996     -static const SOC_VALUE_ENUM_SINGLE_DECL(
3997     +static SOC_VALUE_ENUM_SINGLE_DECL(
3998     rt5659_ad_monor_asrc_enum, RT5659_ASRC_3, RT5659_AD_MONO_R_T_SFT, 0x7,
3999     rt5659_asrc_clk_src, rt5659_asrc_clk_map_values);
4000    
4001     @@ -1930,14 +1930,14 @@ static const char * const rt5659_dac2_src[] = {
4002     "IF1 DAC2", "IF2 DAC", "IF3 DAC", "Mono ADC MIX"
4003     };
4004    
4005     -static const SOC_ENUM_SINGLE_DECL(
4006     +static SOC_ENUM_SINGLE_DECL(
4007     rt5659_dac_l2_enum, RT5659_DAC_CTRL,
4008     RT5659_DAC_L2_SEL_SFT, rt5659_dac2_src);
4009    
4010     static const struct snd_kcontrol_new rt5659_dac_l2_mux =
4011     SOC_DAPM_ENUM("DAC L2 Source", rt5659_dac_l2_enum);
4012    
4013     -static const SOC_ENUM_SINGLE_DECL(
4014     +static SOC_ENUM_SINGLE_DECL(
4015     rt5659_dac_r2_enum, RT5659_DAC_CTRL,
4016     RT5659_DAC_R2_SEL_SFT, rt5659_dac2_src);
4017    
4018     @@ -1951,7 +1951,7 @@ static const char * const rt5659_sto1_adc1_src[] = {
4019     "DAC MIX", "ADC"
4020     };
4021    
4022     -static const SOC_ENUM_SINGLE_DECL(
4023     +static SOC_ENUM_SINGLE_DECL(
4024     rt5659_sto1_adc1_enum, RT5659_STO1_ADC_MIXER,
4025     RT5659_STO1_ADC1_SRC_SFT, rt5659_sto1_adc1_src);
4026    
4027     @@ -1964,7 +1964,7 @@ static const char * const rt5659_sto1_adc_src[] = {
4028     "ADC1", "ADC2"
4029     };
4030    
4031     -static const SOC_ENUM_SINGLE_DECL(
4032     +static SOC_ENUM_SINGLE_DECL(
4033     rt5659_sto1_adc_enum, RT5659_STO1_ADC_MIXER,
4034     RT5659_STO1_ADC_SRC_SFT, rt5659_sto1_adc_src);
4035    
4036     @@ -1977,7 +1977,7 @@ static const char * const rt5659_sto1_adc2_src[] = {
4037     "DAC MIX", "DMIC"
4038     };
4039    
4040     -static const SOC_ENUM_SINGLE_DECL(
4041     +static SOC_ENUM_SINGLE_DECL(
4042     rt5659_sto1_adc2_enum, RT5659_STO1_ADC_MIXER,
4043     RT5659_STO1_ADC2_SRC_SFT, rt5659_sto1_adc2_src);
4044    
4045     @@ -1990,7 +1990,7 @@ static const char * const rt5659_sto1_dmic_src[] = {
4046     "DMIC1", "DMIC2"
4047     };
4048    
4049     -static const SOC_ENUM_SINGLE_DECL(
4050     +static SOC_ENUM_SINGLE_DECL(
4051     rt5659_sto1_dmic_enum, RT5659_STO1_ADC_MIXER,
4052     RT5659_STO1_DMIC_SRC_SFT, rt5659_sto1_dmic_src);
4053    
4054     @@ -2004,7 +2004,7 @@ static const char * const rt5659_mono_adc_l2_src[] = {
4055     "Mono DAC MIXL", "DMIC"
4056     };
4057    
4058     -static const SOC_ENUM_SINGLE_DECL(
4059     +static SOC_ENUM_SINGLE_DECL(
4060     rt5659_mono_adc_l2_enum, RT5659_MONO_ADC_MIXER,
4061     RT5659_MONO_ADC_L2_SRC_SFT, rt5659_mono_adc_l2_src);
4062    
4063     @@ -2018,7 +2018,7 @@ static const char * const rt5659_mono_adc_l1_src[] = {
4064     "Mono DAC MIXL", "ADC"
4065     };
4066    
4067     -static const SOC_ENUM_SINGLE_DECL(
4068     +static SOC_ENUM_SINGLE_DECL(
4069     rt5659_mono_adc_l1_enum, RT5659_MONO_ADC_MIXER,
4070     RT5659_MONO_ADC_L1_SRC_SFT, rt5659_mono_adc_l1_src);
4071    
4072     @@ -2031,14 +2031,14 @@ static const char * const rt5659_mono_adc_src[] = {
4073     "ADC1 L", "ADC1 R", "ADC2 L", "ADC2 R"
4074     };
4075    
4076     -static const SOC_ENUM_SINGLE_DECL(
4077     +static SOC_ENUM_SINGLE_DECL(
4078     rt5659_mono_adc_l_enum, RT5659_MONO_ADC_MIXER,
4079     RT5659_MONO_ADC_L_SRC_SFT, rt5659_mono_adc_src);
4080    
4081     static const struct snd_kcontrol_new rt5659_mono_adc_l_mux =
4082     SOC_DAPM_ENUM("Mono ADC L Source", rt5659_mono_adc_l_enum);
4083    
4084     -static const SOC_ENUM_SINGLE_DECL(
4085     +static SOC_ENUM_SINGLE_DECL(
4086     rt5659_mono_adcr_enum, RT5659_MONO_ADC_MIXER,
4087     RT5659_MONO_ADC_R_SRC_SFT, rt5659_mono_adc_src);
4088    
4089     @@ -2051,7 +2051,7 @@ static const char * const rt5659_mono_dmic_l_src[] = {
4090     "DMIC1 L", "DMIC2 L"
4091     };
4092    
4093     -static const SOC_ENUM_SINGLE_DECL(
4094     +static SOC_ENUM_SINGLE_DECL(
4095     rt5659_mono_dmic_l_enum, RT5659_MONO_ADC_MIXER,
4096     RT5659_MONO_DMIC_L_SRC_SFT, rt5659_mono_dmic_l_src);
4097    
4098     @@ -2064,7 +2064,7 @@ static const char * const rt5659_mono_adc_r2_src[] = {
4099     "Mono DAC MIXR", "DMIC"
4100     };
4101    
4102     -static const SOC_ENUM_SINGLE_DECL(
4103     +static SOC_ENUM_SINGLE_DECL(
4104     rt5659_mono_adc_r2_enum, RT5659_MONO_ADC_MIXER,
4105     RT5659_MONO_ADC_R2_SRC_SFT, rt5659_mono_adc_r2_src);
4106    
4107     @@ -2077,7 +2077,7 @@ static const char * const rt5659_mono_adc_r1_src[] = {
4108     "Mono DAC MIXR", "ADC"
4109     };
4110    
4111     -static const SOC_ENUM_SINGLE_DECL(
4112     +static SOC_ENUM_SINGLE_DECL(
4113     rt5659_mono_adc_r1_enum, RT5659_MONO_ADC_MIXER,
4114     RT5659_MONO_ADC_R1_SRC_SFT, rt5659_mono_adc_r1_src);
4115    
4116     @@ -2090,7 +2090,7 @@ static const char * const rt5659_mono_dmic_r_src[] = {
4117     "DMIC1 R", "DMIC2 R"
4118     };
4119    
4120     -static const SOC_ENUM_SINGLE_DECL(
4121     +static SOC_ENUM_SINGLE_DECL(
4122     rt5659_mono_dmic_r_enum, RT5659_MONO_ADC_MIXER,
4123     RT5659_MONO_DMIC_R_SRC_SFT, rt5659_mono_dmic_r_src);
4124    
4125     @@ -2104,14 +2104,14 @@ static const char * const rt5659_dac1_src[] = {
4126     "IF1 DAC1", "IF2 DAC", "IF3 DAC"
4127     };
4128    
4129     -static const SOC_ENUM_SINGLE_DECL(
4130     +static SOC_ENUM_SINGLE_DECL(
4131     rt5659_dac_r1_enum, RT5659_AD_DA_MIXER,
4132     RT5659_DAC1_R_SEL_SFT, rt5659_dac1_src);
4133    
4134     static const struct snd_kcontrol_new rt5659_dac_r1_mux =
4135     SOC_DAPM_ENUM("DAC R1 Source", rt5659_dac_r1_enum);
4136    
4137     -static const SOC_ENUM_SINGLE_DECL(
4138     +static SOC_ENUM_SINGLE_DECL(
4139     rt5659_dac_l1_enum, RT5659_AD_DA_MIXER,
4140     RT5659_DAC1_L_SEL_SFT, rt5659_dac1_src);
4141    
4142     @@ -2124,14 +2124,14 @@ static const char * const rt5659_dig_dac_mix_src[] = {
4143     "Stereo DAC Mixer", "Mono DAC Mixer"
4144     };
4145    
4146     -static const SOC_ENUM_SINGLE_DECL(
4147     +static SOC_ENUM_SINGLE_DECL(
4148     rt5659_dig_dac_mixl_enum, RT5659_DIG_MIXER,
4149     RT5659_DAC_MIX_L_SFT, rt5659_dig_dac_mix_src);
4150    
4151     static const struct snd_kcontrol_new rt5659_dig_dac_mixl_mux =
4152     SOC_DAPM_ENUM("DAC Digital Mixer L Source", rt5659_dig_dac_mixl_enum);
4153    
4154     -static const SOC_ENUM_SINGLE_DECL(
4155     +static SOC_ENUM_SINGLE_DECL(
4156     rt5659_dig_dac_mixr_enum, RT5659_DIG_MIXER,
4157     RT5659_DAC_MIX_R_SFT, rt5659_dig_dac_mix_src);
4158    
4159     @@ -2144,14 +2144,14 @@ static const char * const rt5659_alg_dac1_src[] = {
4160     "DAC", "Stereo DAC Mixer"
4161     };
4162    
4163     -static const SOC_ENUM_SINGLE_DECL(
4164     +static SOC_ENUM_SINGLE_DECL(
4165     rt5659_alg_dac_l1_enum, RT5659_A_DAC_MUX,
4166     RT5659_A_DACL1_SFT, rt5659_alg_dac1_src);
4167    
4168     static const struct snd_kcontrol_new rt5659_alg_dac_l1_mux =
4169     SOC_DAPM_ENUM("Analog DACL1 Source", rt5659_alg_dac_l1_enum);
4170    
4171     -static const SOC_ENUM_SINGLE_DECL(
4172     +static SOC_ENUM_SINGLE_DECL(
4173     rt5659_alg_dac_r1_enum, RT5659_A_DAC_MUX,
4174     RT5659_A_DACR1_SFT, rt5659_alg_dac1_src);
4175    
4176     @@ -2164,14 +2164,14 @@ static const char * const rt5659_alg_dac2_src[] = {
4177     "Stereo DAC Mixer", "Mono DAC Mixer"
4178     };
4179    
4180     -static const SOC_ENUM_SINGLE_DECL(
4181     +static SOC_ENUM_SINGLE_DECL(
4182     rt5659_alg_dac_l2_enum, RT5659_A_DAC_MUX,
4183     RT5659_A_DACL2_SFT, rt5659_alg_dac2_src);
4184    
4185     static const struct snd_kcontrol_new rt5659_alg_dac_l2_mux =
4186     SOC_DAPM_ENUM("Analog DAC L2 Source", rt5659_alg_dac_l2_enum);
4187    
4188     -static const SOC_ENUM_SINGLE_DECL(
4189     +static SOC_ENUM_SINGLE_DECL(
4190     rt5659_alg_dac_r2_enum, RT5659_A_DAC_MUX,
4191     RT5659_A_DACR2_SFT, rt5659_alg_dac2_src);
4192    
4193     @@ -2184,7 +2184,7 @@ static const char * const rt5659_if2_adc_in_src[] = {
4194     "IF_ADC1", "IF_ADC2", "DAC_REF", "IF_ADC3"
4195     };
4196    
4197     -static const SOC_ENUM_SINGLE_DECL(
4198     +static SOC_ENUM_SINGLE_DECL(
4199     rt5659_if2_adc_in_enum, RT5659_DIG_INF23_DATA,
4200     RT5659_IF2_ADC_IN_SFT, rt5659_if2_adc_in_src);
4201    
4202     @@ -2197,7 +2197,7 @@ static const char * const rt5659_if3_adc_in_src[] = {
4203     "IF_ADC1", "IF_ADC2", "DAC_REF", "Stereo2_ADC_L/R"
4204     };
4205    
4206     -static const SOC_ENUM_SINGLE_DECL(
4207     +static SOC_ENUM_SINGLE_DECL(
4208     rt5659_if3_adc_in_enum, RT5659_DIG_INF23_DATA,
4209     RT5659_IF3_ADC_IN_SFT, rt5659_if3_adc_in_src);
4210    
4211     @@ -2210,14 +2210,14 @@ static const char * const rt5659_pdm_src[] = {
4212     "Mono DAC", "Stereo DAC"
4213     };
4214    
4215     -static const SOC_ENUM_SINGLE_DECL(
4216     +static SOC_ENUM_SINGLE_DECL(
4217     rt5659_pdm_l_enum, RT5659_PDM_OUT_CTRL,
4218     RT5659_PDM1_L_SFT, rt5659_pdm_src);
4219    
4220     static const struct snd_kcontrol_new rt5659_pdm_l_mux =
4221     SOC_DAPM_ENUM("PDM L Source", rt5659_pdm_l_enum);
4222    
4223     -static const SOC_ENUM_SINGLE_DECL(
4224     +static SOC_ENUM_SINGLE_DECL(
4225     rt5659_pdm_r_enum, RT5659_PDM_OUT_CTRL,
4226     RT5659_PDM1_R_SFT, rt5659_pdm_src);
4227    
4228     @@ -2230,7 +2230,7 @@ static const char * const rt5659_spdif_src[] = {
4229     "IF1_DAC1", "IF1_DAC2", "IF2_DAC", "IF3_DAC"
4230     };
4231    
4232     -static const SOC_ENUM_SINGLE_DECL(
4233     +static SOC_ENUM_SINGLE_DECL(
4234     rt5659_spdif_enum, RT5659_SPDIF_CTRL,
4235     RT5659_SPDIF_SEL_SFT, rt5659_spdif_src);
4236    
4237     @@ -2250,7 +2250,7 @@ static const char * const rt5659_rx_adc_data_src[] = {
4238     "NUL:AD2:DAC:AD1", "NUL:DAC:DAC:AD2", "NUL:DAC:AD2:DAC"
4239     };
4240    
4241     -static const SOC_ENUM_SINGLE_DECL(
4242     +static SOC_ENUM_SINGLE_DECL(
4243     rt5659_rx_adc_data_enum, RT5659_TDM_CTRL_2,
4244     RT5659_ADCDAT_SRC_SFT, rt5659_rx_adc_data_src);
4245    
4246     diff --git a/sound/soc/codecs/rt5660.c b/sound/soc/codecs/rt5660.c
4247     index 9f0933ced804..e396b7680fa1 100644
4248     --- a/sound/soc/codecs/rt5660.c
4249     +++ b/sound/soc/codecs/rt5660.c
4250     @@ -526,10 +526,10 @@ static const char * const rt5660_data_select[] = {
4251     "L/R", "R/L", "L/L", "R/R"
4252     };
4253    
4254     -static const SOC_ENUM_SINGLE_DECL(rt5660_if1_dac_enum,
4255     +static SOC_ENUM_SINGLE_DECL(rt5660_if1_dac_enum,
4256     RT5660_DIG_INF1_DATA, RT5660_IF1_DAC_IN_SFT, rt5660_data_select);
4257    
4258     -static const SOC_ENUM_SINGLE_DECL(rt5660_if1_adc_enum,
4259     +static SOC_ENUM_SINGLE_DECL(rt5660_if1_adc_enum,
4260     RT5660_DIG_INF1_DATA, RT5660_IF1_ADC_IN_SFT, rt5660_data_select);
4261    
4262     static const struct snd_kcontrol_new rt5660_if1_dac_swap_mux =
4263     diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
4264     index b943dde8dbe5..3bdd81930486 100644
4265     --- a/sound/soc/codecs/wm_adsp.c
4266     +++ b/sound/soc/codecs/wm_adsp.c
4267     @@ -789,7 +789,10 @@ static int wm_coeff_put(struct snd_kcontrol *kctl,
4268    
4269     mutex_lock(&ctl->dsp->pwr_lock);
4270    
4271     - memcpy(ctl->cache, p, ctl->len);
4272     + if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
4273     + ret = -EPERM;
4274     + else
4275     + memcpy(ctl->cache, p, ctl->len);
4276    
4277     ctl->set = 1;
4278     if (ctl->enabled && ctl->dsp->running)
4279     @@ -816,6 +819,8 @@ static int wm_coeff_tlv_put(struct snd_kcontrol *kctl,
4280     ctl->set = 1;
4281     if (ctl->enabled && ctl->dsp->running)
4282     ret = wm_coeff_write_control(ctl, ctl->cache, size);
4283     + else if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
4284     + ret = -EPERM;
4285     }
4286    
4287     mutex_unlock(&ctl->dsp->pwr_lock);
4288     diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
4289     index 3bbe32ee4630..6780eba55ec2 100644
4290     --- a/sound/soc/soc-dapm.c
4291     +++ b/sound/soc/soc-dapm.c
4292     @@ -358,6 +358,10 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
4293     snd_soc_dapm_new_control_unlocked(widget->dapm,
4294     &template);
4295     kfree(name);
4296     + if (IS_ERR(data->widget)) {
4297     + ret = PTR_ERR(data->widget);
4298     + goto err_data;
4299     + }
4300     if (!data->widget) {
4301     ret = -ENOMEM;
4302     goto err_data;
4303     @@ -392,6 +396,10 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
4304     data->widget = snd_soc_dapm_new_control_unlocked(
4305     widget->dapm, &template);
4306     kfree(name);
4307     + if (IS_ERR(data->widget)) {
4308     + ret = PTR_ERR(data->widget);
4309     + goto err_data;
4310     + }
4311     if (!data->widget) {
4312     ret = -ENOMEM;
4313     goto err_data;
4314     @@ -3311,11 +3319,22 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
4315    
4316     mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
4317     w = snd_soc_dapm_new_control_unlocked(dapm, widget);
4318     + /* Do not nag about probe deferrals */
4319     + if (IS_ERR(w)) {
4320     + int ret = PTR_ERR(w);
4321     +
4322     + if (ret != -EPROBE_DEFER)
4323     + dev_err(dapm->dev,
4324     + "ASoC: Failed to create DAPM control %s (%d)\n",
4325     + widget->name, ret);
4326     + goto out_unlock;
4327     + }
4328     if (!w)
4329     dev_err(dapm->dev,
4330     "ASoC: Failed to create DAPM control %s\n",
4331     widget->name);
4332    
4333     +out_unlock:
4334     mutex_unlock(&dapm->card->dapm_mutex);
4335     return w;
4336     }
4337     @@ -3338,6 +3357,8 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm,
4338     w->regulator = devm_regulator_get(dapm->dev, w->name);
4339     if (IS_ERR(w->regulator)) {
4340     ret = PTR_ERR(w->regulator);
4341     + if (ret == -EPROBE_DEFER)
4342     + return ERR_PTR(ret);
4343     dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n",
4344     w->name, ret);
4345     return NULL;
4346     @@ -3356,6 +3377,8 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm,
4347     w->clk = devm_clk_get(dapm->dev, w->name);
4348     if (IS_ERR(w->clk)) {
4349     ret = PTR_ERR(w->clk);
4350     + if (ret == -EPROBE_DEFER)
4351     + return ERR_PTR(ret);
4352     dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n",
4353     w->name, ret);
4354     return NULL;
4355     @@ -3474,6 +3497,16 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
4356     mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
4357     for (i = 0; i < num; i++) {
4358     w = snd_soc_dapm_new_control_unlocked(dapm, widget);
4359     + if (IS_ERR(w)) {
4360     + ret = PTR_ERR(w);
4361     + /* Do not nag about probe deferrals */
4362     + if (ret == -EPROBE_DEFER)
4363     + break;
4364     + dev_err(dapm->dev,
4365     + "ASoC: Failed to create DAPM control %s (%d)\n",
4366     + widget->name, ret);
4367     + break;
4368     + }
4369     if (!w) {
4370     dev_err(dapm->dev,
4371     "ASoC: Failed to create DAPM control %s\n",
4372     @@ -3750,6 +3783,15 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
4373     dev_dbg(card->dev, "ASoC: adding %s widget\n", link_name);
4374    
4375     w = snd_soc_dapm_new_control_unlocked(&card->dapm, &template);
4376     + if (IS_ERR(w)) {
4377     + ret = PTR_ERR(w);
4378     + /* Do not nag about probe deferrals */
4379     + if (ret != -EPROBE_DEFER)
4380     + dev_err(card->dev,
4381     + "ASoC: Failed to create %s widget (%d)\n",
4382     + link_name, ret);
4383     + goto outfree_kcontrol_news;
4384     + }
4385     if (!w) {
4386     dev_err(card->dev, "ASoC: Failed to create %s widget\n",
4387     link_name);
4388     @@ -3801,6 +3843,16 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
4389     template.name);
4390    
4391     w = snd_soc_dapm_new_control_unlocked(dapm, &template);
4392     + if (IS_ERR(w)) {
4393     + int ret = PTR_ERR(w);
4394     +
4395     + /* Do not nag about probe deferrals */
4396     + if (ret != -EPROBE_DEFER)
4397     + dev_err(dapm->dev,
4398     + "ASoC: Failed to create %s widget (%d)\n",
4399     + dai->driver->playback.stream_name, ret);
4400     + return ret;
4401     + }
4402     if (!w) {
4403     dev_err(dapm->dev, "ASoC: Failed to create %s widget\n",
4404     dai->driver->playback.stream_name);
4405     @@ -3820,6 +3872,16 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
4406     template.name);
4407    
4408     w = snd_soc_dapm_new_control_unlocked(dapm, &template);
4409     + if (IS_ERR(w)) {
4410     + int ret = PTR_ERR(w);
4411     +
4412     + /* Do not nag about probe deferrals */
4413     + if (ret != -EPROBE_DEFER)
4414     + dev_err(dapm->dev,
4415     + "ASoC: Failed to create %s widget (%d)\n",
4416     + dai->driver->playback.stream_name, ret);
4417     + return ret;
4418     + }
4419     if (!w) {
4420     dev_err(dapm->dev, "ASoC: Failed to create %s widget\n",
4421     dai->driver->capture.stream_name);
4422     diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
4423     index 6b05047a4134..8a758c994506 100644
4424     --- a/sound/soc/soc-topology.c
4425     +++ b/sound/soc/soc-topology.c
4426     @@ -1473,6 +1473,15 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
4427     widget = snd_soc_dapm_new_control(dapm, &template);
4428     else
4429     widget = snd_soc_dapm_new_control_unlocked(dapm, &template);
4430     + if (IS_ERR(widget)) {
4431     + ret = PTR_ERR(widget);
4432     + /* Do not nag about probe deferrals */
4433     + if (ret != -EPROBE_DEFER)
4434     + dev_err(tplg->dev,
4435     + "ASoC: failed to create widget %s controls (%d)\n",
4436     + w->name, ret);
4437     + goto hdr_err;
4438     + }
4439     if (widget == NULL) {
4440     dev_err(tplg->dev, "ASoC: failed to create widget %s controls\n",
4441     w->name);
4442     diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
4443     index 3e199b508a96..9664b1ff4285 100644
4444     --- a/tools/power/x86/turbostat/turbostat.c
4445     +++ b/tools/power/x86/turbostat/turbostat.c
4446     @@ -2003,8 +2003,10 @@ int snapshot_gfx_mhz(void)
4447    
4448     if (fp == NULL)
4449     fp = fopen_or_die("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", "r");
4450     - else
4451     + else {
4452     rewind(fp);
4453     + fflush(fp);
4454     + }
4455    
4456     retval = fscanf(fp, "%d", &gfx_cur_mhz);
4457     if (retval != 1)