Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0291-5.4.192-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3637 - (show annotations) (download)
Mon Oct 24 12:40:44 2022 UTC (18 months, 3 weeks ago) by niro
File size: 80117 byte(s)
-add missing
1 diff --git a/Makefile b/Makefile
2 index 365b487e50d7f..968470cf368ee 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6 # SPDX-License-Identifier: GPL-2.0
7 VERSION = 5
8 PATCHLEVEL = 4
9 -SUBLEVEL = 191
10 +SUBLEVEL = 192
11 EXTRAVERSION =
12 NAME = Kleptomaniac Octopus
13
14 diff --git a/arch/arm/boot/dts/am3517-evm.dts b/arch/arm/boot/dts/am3517-evm.dts
15 index a1fd3e63e86ec..3db30ce134b95 100644
16 --- a/arch/arm/boot/dts/am3517-evm.dts
17 +++ b/arch/arm/boot/dts/am3517-evm.dts
18 @@ -160,6 +160,8 @@
19
20 /* HS USB Host PHY on PORT 1 */
21 hsusb1_phy: hsusb1_phy {
22 + pinctrl-names = "default";
23 + pinctrl-0 = <&hsusb1_rst_pins>;
24 compatible = "usb-nop-xceiv";
25 reset-gpios = <&gpio2 25 GPIO_ACTIVE_LOW>; /* gpio_57 */
26 #phy-cells = <0>;
27 @@ -167,7 +169,9 @@
28 };
29
30 &davinci_emac {
31 - status = "okay";
32 + pinctrl-names = "default";
33 + pinctrl-0 = <&ethernet_pins>;
34 + status = "okay";
35 };
36
37 &davinci_mdio {
38 @@ -192,6 +196,8 @@
39 };
40
41 &i2c2 {
42 + pinctrl-names = "default";
43 + pinctrl-0 = <&i2c2_pins>;
44 clock-frequency = <400000>;
45 /* User DIP swithes [1:8] / User LEDS [1:2] */
46 tca6416: gpio@21 {
47 @@ -204,6 +210,8 @@
48 };
49
50 &i2c3 {
51 + pinctrl-names = "default";
52 + pinctrl-0 = <&i2c3_pins>;
53 clock-frequency = <400000>;
54 };
55
56 @@ -222,6 +230,8 @@
57 };
58
59 &usbhshost {
60 + pinctrl-names = "default";
61 + pinctrl-0 = <&hsusb1_pins>;
62 port1-mode = "ehci-phy";
63 };
64
65 @@ -230,8 +240,35 @@
66 };
67
68 &omap3_pmx_core {
69 - pinctrl-names = "default";
70 - pinctrl-0 = <&hsusb1_rst_pins>;
71 +
72 + ethernet_pins: pinmux_ethernet_pins {
73 + pinctrl-single,pins = <
74 + OMAP3_CORE1_IOPAD(0x21fe, PIN_INPUT | MUX_MODE0) /* rmii_mdio_data */
75 + OMAP3_CORE1_IOPAD(0x2200, MUX_MODE0) /* rmii_mdio_clk */
76 + OMAP3_CORE1_IOPAD(0x2202, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_rxd0 */
77 + OMAP3_CORE1_IOPAD(0x2204, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_rxd1 */
78 + OMAP3_CORE1_IOPAD(0x2206, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_crs_dv */
79 + OMAP3_CORE1_IOPAD(0x2208, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* rmii_rxer */
80 + OMAP3_CORE1_IOPAD(0x220a, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* rmii_txd0 */
81 + OMAP3_CORE1_IOPAD(0x220c, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* rmii_txd1 */
82 + OMAP3_CORE1_IOPAD(0x220e, PIN_OUTPUT_PULLDOWN |MUX_MODE0) /* rmii_txen */
83 + OMAP3_CORE1_IOPAD(0x2210, PIN_INPUT_PULLDOWN | MUX_MODE0) /* rmii_50mhz_clk */
84 + >;
85 + };
86 +
87 + i2c2_pins: pinmux_i2c2_pins {
88 + pinctrl-single,pins = <
89 + OMAP3_CORE1_IOPAD(0x21be, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_scl */
90 + OMAP3_CORE1_IOPAD(0x21c0, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_sda */
91 + >;
92 + };
93 +
94 + i2c3_pins: pinmux_i2c3_pins {
95 + pinctrl-single,pins = <
96 + OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_scl */
97 + OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_sda */
98 + >;
99 + };
100
101 leds_pins: pinmux_leds_pins {
102 pinctrl-single,pins = <
103 @@ -299,8 +336,6 @@
104 };
105
106 &omap3_pmx_core2 {
107 - pinctrl-names = "default";
108 - pinctrl-0 = <&hsusb1_pins>;
109
110 hsusb1_pins: pinmux_hsusb1_pins {
111 pinctrl-single,pins = <
112 diff --git a/arch/arm/boot/dts/am3517-som.dtsi b/arch/arm/boot/dts/am3517-som.dtsi
113 index 8b669e2eafec4..f7b680f6c48ad 100644
114 --- a/arch/arm/boot/dts/am3517-som.dtsi
115 +++ b/arch/arm/boot/dts/am3517-som.dtsi
116 @@ -69,6 +69,8 @@
117 };
118
119 &i2c1 {
120 + pinctrl-names = "default";
121 + pinctrl-0 = <&i2c1_pins>;
122 clock-frequency = <400000>;
123
124 s35390a: s35390a@30 {
125 @@ -179,6 +181,13 @@
126
127 &omap3_pmx_core {
128
129 + i2c1_pins: pinmux_i2c1_pins {
130 + pinctrl-single,pins = <
131 + OMAP3_CORE1_IOPAD(0x21ba, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_scl */
132 + OMAP3_CORE1_IOPAD(0x21bc, PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_sda */
133 + >;
134 + };
135 +
136 wl12xx_buffer_pins: pinmux_wl12xx_buffer_pins {
137 pinctrl-single,pins = <
138 OMAP3_CORE1_IOPAD(0x2156, PIN_OUTPUT | MUX_MODE4) /* mmc1_dat7.gpio_129 */
139 diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
140 index bda22700110cd..287566e09a673 100644
141 --- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
142 +++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
143 @@ -217,6 +217,12 @@
144 wm8731: wm8731@1b {
145 compatible = "wm8731";
146 reg = <0x1b>;
147 +
148 + /* PCK0 at 12MHz */
149 + clocks = <&pmc PMC_TYPE_SYSTEM 8>;
150 + clock-names = "mclk";
151 + assigned-clocks = <&pmc PMC_TYPE_SYSTEM 8>;
152 + assigned-clock-rates = <12000000>;
153 };
154 };
155
156 diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
157 index 7c4ad541c3f5e..b165bd6ea53b6 100644
158 --- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
159 +++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
160 @@ -314,6 +314,8 @@
161 codec: sgtl5000@a {
162 compatible = "fsl,sgtl5000";
163 reg = <0x0a>;
164 + pinctrl-names = "default";
165 + pinctrl-0 = <&pinctrl_sgtl5000>;
166 clocks = <&clks IMX6QDL_CLK_CKO>;
167 VDDA-supply = <&reg_module_3v3_audio>;
168 VDDIO-supply = <&reg_module_3v3>;
169 @@ -543,8 +545,6 @@
170 MX6QDL_PAD_DISP0_DAT21__AUD4_TXD 0x130b0
171 MX6QDL_PAD_DISP0_DAT22__AUD4_TXFS 0x130b0
172 MX6QDL_PAD_DISP0_DAT23__AUD4_RXD 0x130b0
173 - /* SGTL5000 sys_mclk */
174 - MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x130b0
175 >;
176 };
177
178 @@ -810,6 +810,12 @@
179 >;
180 };
181
182 + pinctrl_sgtl5000: sgtl5000grp {
183 + fsl,pins = <
184 + MX6QDL_PAD_GPIO_5__CCM_CLKO1 0x130b0
185 + >;
186 + };
187 +
188 pinctrl_spdif: spdifgrp {
189 fsl,pins = <
190 MX6QDL_PAD_GPIO_16__SPDIF_IN 0x1b0b0
191 diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi b/arch/arm/boot/dts/imx6ull-colibri.dtsi
192 index d56728f03c35f..c83323b9ea53c 100644
193 --- a/arch/arm/boot/dts/imx6ull-colibri.dtsi
194 +++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi
195 @@ -37,7 +37,7 @@
196
197 reg_sd1_vmmc: regulator-sd1-vmmc {
198 compatible = "regulator-gpio";
199 - gpio = <&gpio5 9 GPIO_ACTIVE_HIGH>;
200 + gpios = <&gpio5 9 GPIO_ACTIVE_HIGH>;
201 pinctrl-names = "default";
202 pinctrl-0 = <&pinctrl_snvs_reg_sd>;
203 regulator-always-on;
204 diff --git a/arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts b/arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts
205 index f7a841a288654..270e4986b6e64 100644
206 --- a/arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts
207 +++ b/arch/arm/boot/dts/logicpd-som-lv-35xx-devkit.dts
208 @@ -11,3 +11,18 @@
209 model = "LogicPD Zoom OMAP35xx SOM-LV Development Kit";
210 compatible = "logicpd,dm3730-som-lv-devkit", "ti,omap3";
211 };
212 +
213 +&omap3_pmx_core2 {
214 + pinctrl-names = "default";
215 + pinctrl-0 = <&hsusb2_2_pins>;
216 + hsusb2_2_pins: pinmux_hsusb2_2_pins {
217 + pinctrl-single,pins = <
218 + OMAP3430_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */
219 + OMAP3430_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */
220 + OMAP3430_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */
221 + OMAP3430_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */
222 + OMAP3430_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */
223 + OMAP3430_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */
224 + >;
225 + };
226 +};
227 diff --git a/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts b/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
228 index a604d92221a4f..c757f0d7781c1 100644
229 --- a/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
230 +++ b/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
231 @@ -11,3 +11,18 @@
232 model = "LogicPD Zoom DM3730 SOM-LV Development Kit";
233 compatible = "logicpd,dm3730-som-lv-devkit", "ti,omap3630", "ti,omap3";
234 };
235 +
236 +&omap3_pmx_core2 {
237 + pinctrl-names = "default";
238 + pinctrl-0 = <&hsusb2_2_pins>;
239 + hsusb2_2_pins: pinmux_hsusb2_2_pins {
240 + pinctrl-single,pins = <
241 + OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */
242 + OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */
243 + OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */
244 + OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */
245 + OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */
246 + OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */
247 + >;
248 + };
249 +};
250 diff --git a/arch/arm/boot/dts/logicpd-som-lv.dtsi b/arch/arm/boot/dts/logicpd-som-lv.dtsi
251 index b56524cc7fe27..55b619c99e24d 100644
252 --- a/arch/arm/boot/dts/logicpd-som-lv.dtsi
253 +++ b/arch/arm/boot/dts/logicpd-som-lv.dtsi
254 @@ -265,21 +265,6 @@
255 };
256 };
257
258 -&omap3_pmx_core2 {
259 - pinctrl-names = "default";
260 - pinctrl-0 = <&hsusb2_2_pins>;
261 - hsusb2_2_pins: pinmux_hsusb2_2_pins {
262 - pinctrl-single,pins = <
263 - OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */
264 - OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */
265 - OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */
266 - OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */
267 - OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */
268 - OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */
269 - >;
270 - };
271 -};
272 -
273 &uart2 {
274 interrupts-extended = <&intc 73 &omap3_pmx_core OMAP3_UART2_RX>;
275 pinctrl-names = "default";
276 diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi
277 index 186b2af7743e3..089e9f1f442b5 100644
278 --- a/arch/arm/boot/dts/omap3-gta04.dtsi
279 +++ b/arch/arm/boot/dts/omap3-gta04.dtsi
280 @@ -31,6 +31,8 @@
281 aliases {
282 display0 = &lcd;
283 display1 = &tv0;
284 + /delete-property/ mmc2;
285 + /delete-property/ mmc3;
286 };
287
288 ldo_3v3: fixedregulator {
289 diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
290 index 5c3845730dbf5..0b80f8bcd3047 100644
291 --- a/arch/arm/mach-omap2/omap4-common.c
292 +++ b/arch/arm/mach-omap2/omap4-common.c
293 @@ -314,10 +314,12 @@ void __init omap_gic_of_init(void)
294
295 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-gic");
296 gic_dist_base_addr = of_iomap(np, 0);
297 + of_node_put(np);
298 WARN_ON(!gic_dist_base_addr);
299
300 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-twd-timer");
301 twd_base = of_iomap(np, 0);
302 + of_node_put(np);
303 WARN_ON(!twd_base);
304
305 skip_errata_init:
306 diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
307 index d61f43052a344..8e9ad1e51d665 100644
308 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
309 +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-a311d.dtsi
310 @@ -11,26 +11,6 @@
311 compatible = "operating-points-v2";
312 opp-shared;
313
314 - opp-100000000 {
315 - opp-hz = /bits/ 64 <100000000>;
316 - opp-microvolt = <731000>;
317 - };
318 -
319 - opp-250000000 {
320 - opp-hz = /bits/ 64 <250000000>;
321 - opp-microvolt = <731000>;
322 - };
323 -
324 - opp-500000000 {
325 - opp-hz = /bits/ 64 <500000000>;
326 - opp-microvolt = <731000>;
327 - };
328 -
329 - opp-667000000 {
330 - opp-hz = /bits/ 64 <667000000>;
331 - opp-microvolt = <731000>;
332 - };
333 -
334 opp-1000000000 {
335 opp-hz = /bits/ 64 <1000000000>;
336 opp-microvolt = <761000>;
337 @@ -71,26 +51,6 @@
338 compatible = "operating-points-v2";
339 opp-shared;
340
341 - opp-100000000 {
342 - opp-hz = /bits/ 64 <100000000>;
343 - opp-microvolt = <731000>;
344 - };
345 -
346 - opp-250000000 {
347 - opp-hz = /bits/ 64 <250000000>;
348 - opp-microvolt = <731000>;
349 - };
350 -
351 - opp-500000000 {
352 - opp-hz = /bits/ 64 <500000000>;
353 - opp-microvolt = <731000>;
354 - };
355 -
356 - opp-667000000 {
357 - opp-hz = /bits/ 64 <667000000>;
358 - opp-microvolt = <731000>;
359 - };
360 -
361 opp-1000000000 {
362 opp-hz = /bits/ 64 <1000000000>;
363 opp-microvolt = <731000>;
364 diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi
365 index 046cc332d07f9..f2543da63c39d 100644
366 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi
367 +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-s922x.dtsi
368 @@ -11,26 +11,6 @@
369 compatible = "operating-points-v2";
370 opp-shared;
371
372 - opp-100000000 {
373 - opp-hz = /bits/ 64 <100000000>;
374 - opp-microvolt = <731000>;
375 - };
376 -
377 - opp-250000000 {
378 - opp-hz = /bits/ 64 <250000000>;
379 - opp-microvolt = <731000>;
380 - };
381 -
382 - opp-500000000 {
383 - opp-hz = /bits/ 64 <500000000>;
384 - opp-microvolt = <731000>;
385 - };
386 -
387 - opp-667000000 {
388 - opp-hz = /bits/ 64 <667000000>;
389 - opp-microvolt = <731000>;
390 - };
391 -
392 opp-1000000000 {
393 opp-hz = /bits/ 64 <1000000000>;
394 opp-microvolt = <731000>;
395 @@ -71,26 +51,6 @@
396 compatible = "operating-points-v2";
397 opp-shared;
398
399 - opp-100000000 {
400 - opp-hz = /bits/ 64 <100000000>;
401 - opp-microvolt = <751000>;
402 - };
403 -
404 - opp-250000000 {
405 - opp-hz = /bits/ 64 <250000000>;
406 - opp-microvolt = <751000>;
407 - };
408 -
409 - opp-500000000 {
410 - opp-hz = /bits/ 64 <500000000>;
411 - opp-microvolt = <751000>;
412 - };
413 -
414 - opp-667000000 {
415 - opp-hz = /bits/ 64 <667000000>;
416 - opp-microvolt = <751000>;
417 - };
418 -
419 opp-1000000000 {
420 opp-hz = /bits/ 64 <1000000000>;
421 opp-microvolt = <771000>;
422 diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
423 index 8ba3555ca3693..dd62a608c805a 100644
424 --- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
425 +++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
426 @@ -55,26 +55,6 @@
427 compatible = "operating-points-v2";
428 opp-shared;
429
430 - opp-100000000 {
431 - opp-hz = /bits/ 64 <100000000>;
432 - opp-microvolt = <730000>;
433 - };
434 -
435 - opp-250000000 {
436 - opp-hz = /bits/ 64 <250000000>;
437 - opp-microvolt = <730000>;
438 - };
439 -
440 - opp-500000000 {
441 - opp-hz = /bits/ 64 <500000000>;
442 - opp-microvolt = <730000>;
443 - };
444 -
445 - opp-667000000 {
446 - opp-hz = /bits/ 64 <666666666>;
447 - opp-microvolt = <750000>;
448 - };
449 -
450 opp-1000000000 {
451 opp-hz = /bits/ 64 <1000000000>;
452 opp-microvolt = <770000>;
453 diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
454 index 9ad1d43b8ce75..4fa39654b695d 100644
455 --- a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
456 +++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
457 @@ -213,6 +213,10 @@
458 interrupts = <3 GPIO_ACTIVE_LOW>;
459 rohm,reset-snvs-powered;
460
461 + #clock-cells = <0>;
462 + clocks = <&osc_32k 0>;
463 + clock-output-names = "clk-32k-out";
464 +
465 regulators {
466 buck1_reg: BUCK1 {
467 regulator-name = "BUCK1";
468 diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
469 index 2b7cc5397f80d..91a06cef50c1b 100644
470 --- a/arch/x86/include/asm/microcode.h
471 +++ b/arch/x86/include/asm/microcode.h
472 @@ -133,11 +133,13 @@ extern void load_ucode_ap(void);
473 void reload_early_microcode(void);
474 extern bool get_builtin_firmware(struct cpio_data *cd, const char *name);
475 extern bool initrd_gone;
476 +void microcode_bsp_resume(void);
477 #else
478 static inline int __init microcode_init(void) { return 0; };
479 static inline void __init load_ucode_bsp(void) { }
480 static inline void load_ucode_ap(void) { }
481 static inline void reload_early_microcode(void) { }
482 +static inline void microcode_bsp_resume(void) { }
483 static inline bool
484 get_builtin_firmware(struct cpio_data *cd, const char *name) { return false; }
485 #endif
486 diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
487 index 4a4198b806b4e..c95a27513a30c 100644
488 --- a/arch/x86/kernel/cpu/microcode/core.c
489 +++ b/arch/x86/kernel/cpu/microcode/core.c
490 @@ -772,9 +772,9 @@ static struct subsys_interface mc_cpu_interface = {
491 };
492
493 /**
494 - * mc_bp_resume - Update boot CPU microcode during resume.
495 + * microcode_bsp_resume - Update boot CPU microcode during resume.
496 */
497 -static void mc_bp_resume(void)
498 +void microcode_bsp_resume(void)
499 {
500 int cpu = smp_processor_id();
501 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
502 @@ -786,7 +786,7 @@ static void mc_bp_resume(void)
503 }
504
505 static struct syscore_ops mc_syscore_ops = {
506 - .resume = mc_bp_resume,
507 + .resume = microcode_bsp_resume,
508 };
509
510 static int mc_cpu_starting(unsigned int cpu)
511 diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
512 index 1847e993ac63a..f3f7f4cb15a6b 100644
513 --- a/arch/x86/lib/usercopy_64.c
514 +++ b/arch/x86/lib/usercopy_64.c
515 @@ -142,7 +142,7 @@ void __memcpy_flushcache(void *_dst, const void *_src, size_t size)
516
517 /* cache copy and flush to align dest */
518 if (!IS_ALIGNED(dest, 8)) {
519 - unsigned len = min_t(unsigned, size, ALIGN(dest, 8) - dest);
520 + size_t len = min_t(size_t, size, ALIGN(dest, 8) - dest);
521
522 memcpy((void *) dest, (void *) source, len);
523 clean_cache_range((void *) dest, len);
524 diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
525 index 1bff0f68f0273..20dd7023132fb 100644
526 --- a/arch/x86/power/cpu.c
527 +++ b/arch/x86/power/cpu.c
528 @@ -25,6 +25,7 @@
529 #include <asm/cpu.h>
530 #include <asm/mmu_context.h>
531 #include <asm/cpu_device_id.h>
532 +#include <asm/microcode.h>
533
534 #ifdef CONFIG_X86_32
535 __visible unsigned long saved_context_ebx;
536 @@ -263,6 +264,13 @@ static void notrace __restore_processor_state(struct saved_context *ctxt)
537 x86_platform.restore_sched_clock_state();
538 mtrr_bp_restore();
539 perf_restore_debug_store();
540 +
541 + microcode_bsp_resume();
542 +
543 + /*
544 + * This needs to happen after the microcode has been updated upon resume
545 + * because some of the MSRs are "emulated" in microcode.
546 + */
547 msr_restore_context(ctxt);
548 }
549
550 diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
551 index d5f64018044b0..503404f3280e3 100644
552 --- a/drivers/base/arch_topology.c
553 +++ b/drivers/base/arch_topology.c
554 @@ -457,7 +457,7 @@ void update_siblings_masks(unsigned int cpuid)
555 for_each_online_cpu(cpu) {
556 cpu_topo = &cpu_topology[cpu];
557
558 - if (cpuid_topo->llc_id == cpu_topo->llc_id) {
559 + if (cpu_topo->llc_id != -1 && cpuid_topo->llc_id == cpu_topo->llc_id) {
560 cpumask_set_cpu(cpu, &cpuid_topo->llc_sibling);
561 cpumask_set_cpu(cpuid, &cpu_topo->llc_sibling);
562 }
563 diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
564 index 9f6782329a237..8a08cbb958d12 100644
565 --- a/drivers/block/Kconfig
566 +++ b/drivers/block/Kconfig
567 @@ -39,6 +39,22 @@ config BLK_DEV_FD
568 To compile this driver as a module, choose M here: the
569 module will be called floppy.
570
571 +config BLK_DEV_FD_RAWCMD
572 + bool "Support for raw floppy disk commands (DEPRECATED)"
573 + depends on BLK_DEV_FD
574 + help
575 + If you want to use actual physical floppies and expect to do
576 + special low-level hardware accesses to them (access and use
577 + non-standard formats, for example), then enable this.
578 +
579 + Note that the code enabled by this option is rarely used and
580 + might be unstable or insecure, and distros should not enable it.
581 +
582 + Note: FDRAWCMD is deprecated and will be removed from the kernel
583 + in the near future.
584 +
585 + If unsure, say N.
586 +
587 config AMIGA_FLOPPY
588 tristate "Amiga floppy support"
589 depends on AMIGA
590 diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
591 index 02af4f109e59f..f24e3791e8400 100644
592 --- a/drivers/block/floppy.c
593 +++ b/drivers/block/floppy.c
594 @@ -3012,6 +3012,8 @@ static const char *drive_name(int type, int drive)
595 return "(null)";
596 }
597
598 +#ifdef CONFIG_BLK_DEV_FD_RAWCMD
599 +
600 /* raw commands */
601 static void raw_cmd_done(int flag)
602 {
603 @@ -3223,6 +3225,35 @@ static int raw_cmd_ioctl(int cmd, void __user *param)
604 return ret;
605 }
606
607 +static int floppy_raw_cmd_ioctl(int type, int drive, int cmd,
608 + void __user *param)
609 +{
610 + int ret;
611 +
612 + pr_warn_once("Note: FDRAWCMD is deprecated and will be removed from the kernel in the near future.\n");
613 +
614 + if (type)
615 + return -EINVAL;
616 + if (lock_fdc(drive))
617 + return -EINTR;
618 + set_floppy(drive);
619 + ret = raw_cmd_ioctl(cmd, param);
620 + if (ret == -EINTR)
621 + return -EINTR;
622 + process_fd_request();
623 + return ret;
624 +}
625 +
626 +#else /* CONFIG_BLK_DEV_FD_RAWCMD */
627 +
628 +static int floppy_raw_cmd_ioctl(int type, int drive, int cmd,
629 + void __user *param)
630 +{
631 + return -EOPNOTSUPP;
632 +}
633 +
634 +#endif
635 +
636 static int invalidate_drive(struct block_device *bdev)
637 {
638 /* invalidate the buffer track to force a reread */
639 @@ -3410,7 +3441,6 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int
640 {
641 int drive = (long)bdev->bd_disk->private_data;
642 int type = ITYPE(UDRS->fd_device);
643 - int i;
644 int ret;
645 int size;
646 union inparam {
647 @@ -3561,16 +3591,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int
648 outparam = UDRWE;
649 break;
650 case FDRAWCMD:
651 - if (type)
652 - return -EINVAL;
653 - if (lock_fdc(drive))
654 - return -EINTR;
655 - set_floppy(drive);
656 - i = raw_cmd_ioctl(cmd, (void __user *)param);
657 - if (i == -EINTR)
658 - return -EINTR;
659 - process_fd_request();
660 - return i;
661 + return floppy_raw_cmd_ioctl(type, drive, cmd, (void __user *)param);
662 case FDTWADDLE:
663 if (lock_fdc(drive))
664 return -EINTR;
665 diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
666 index 1bb00a959c67f..9b1a5e62417cb 100644
667 --- a/drivers/bus/sunxi-rsb.c
668 +++ b/drivers/bus/sunxi-rsb.c
669 @@ -224,6 +224,8 @@ static struct sunxi_rsb_device *sunxi_rsb_device_create(struct sunxi_rsb *rsb,
670
671 dev_dbg(&rdev->dev, "device %s registered\n", dev_name(&rdev->dev));
672
673 + return rdev;
674 +
675 err_device_add:
676 put_device(&rdev->dev);
677
678 diff --git a/drivers/clk/sunxi/clk-sun9i-mmc.c b/drivers/clk/sunxi/clk-sun9i-mmc.c
679 index 542b31d6e96dd..636bcf2439ef2 100644
680 --- a/drivers/clk/sunxi/clk-sun9i-mmc.c
681 +++ b/drivers/clk/sunxi/clk-sun9i-mmc.c
682 @@ -109,6 +109,8 @@ static int sun9i_a80_mmc_config_clk_probe(struct platform_device *pdev)
683 spin_lock_init(&data->lock);
684
685 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
686 + if (!r)
687 + return -EINVAL;
688 /* one clock/reset pair per word */
689 count = DIV_ROUND_UP((resource_size(r)), SUN9I_MMC_WIDTH);
690 data->membase = devm_ioremap_resource(&pdev->dev, r);
691 diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c
692 index 2deed8d8773fa..75e1bf3a08f7c 100644
693 --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c
694 +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c
695 @@ -98,8 +98,10 @@ static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev)
696 return -ENOMEM;
697
698 ret = sun50i_cpufreq_get_efuse(&speed);
699 - if (ret)
700 + if (ret) {
701 + kfree(opp_tables);
702 return ret;
703 + }
704
705 snprintf(name, MAX_NAME_LEN, "speed%d", speed);
706
707 diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
708 index 11a4c4029a902..acc2c307c871b 100644
709 --- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
710 +++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
711 @@ -1140,6 +1140,7 @@ static struct clock_source *dcn21_clock_source_create(
712 return &clk_src->base;
713 }
714
715 + kfree(clk_src);
716 BREAK_TO_DEBUGGER();
717 return NULL;
718 }
719 diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c
720 index 1f55cd8abb558..5fbda0431d6ab 100644
721 --- a/drivers/iio/dac/ad5446.c
722 +++ b/drivers/iio/dac/ad5446.c
723 @@ -170,7 +170,7 @@ static int ad5446_read_raw(struct iio_dev *indio_dev,
724
725 switch (m) {
726 case IIO_CHAN_INFO_RAW:
727 - *val = st->cached_val;
728 + *val = st->cached_val >> chan->scan_type.shift;
729 return IIO_VAL_INT;
730 case IIO_CHAN_INFO_SCALE:
731 *val = st->vref_mv;
732 diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c
733 index 424922cad1e39..87a51a85a642d 100644
734 --- a/drivers/iio/dac/ad5592r-base.c
735 +++ b/drivers/iio/dac/ad5592r-base.c
736 @@ -530,7 +530,7 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st)
737 if (!ret)
738 st->channel_modes[reg] = tmp;
739
740 - fwnode_property_read_u32(child, "adi,off-state", &tmp);
741 + ret = fwnode_property_read_u32(child, "adi,off-state", &tmp);
742 if (!ret)
743 st->channel_offstate[reg] = tmp;
744 }
745 diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
746 index 82af903a765b2..c54eed3f4edce 100644
747 --- a/drivers/iio/magnetometer/ak8975.c
748 +++ b/drivers/iio/magnetometer/ak8975.c
749 @@ -391,6 +391,7 @@ static int ak8975_power_on(const struct ak8975_data *data)
750 if (ret) {
751 dev_warn(&data->client->dev,
752 "Failed to enable specified Vid supply\n");
753 + regulator_disable(data->vdd);
754 return ret;
755 }
756 /*
757 diff --git a/drivers/lightnvm/Kconfig b/drivers/lightnvm/Kconfig
758 index 4c2ce210c1237..95b09148167e8 100644
759 --- a/drivers/lightnvm/Kconfig
760 +++ b/drivers/lightnvm/Kconfig
761 @@ -5,7 +5,7 @@
762
763 menuconfig NVM
764 bool "Open-Channel SSD target support"
765 - depends on BLOCK
766 + depends on BLOCK && BROKEN
767 help
768 Say Y here to get to enable Open-channel SSDs.
769
770 diff --git a/drivers/mtd/nand/raw/mtk_ecc.c b/drivers/mtd/nand/raw/mtk_ecc.c
771 index 74595b644b7cd..57fa7807cd7d3 100644
772 --- a/drivers/mtd/nand/raw/mtk_ecc.c
773 +++ b/drivers/mtd/nand/raw/mtk_ecc.c
774 @@ -43,6 +43,7 @@
775
776 struct mtk_ecc_caps {
777 u32 err_mask;
778 + u32 err_shift;
779 const u8 *ecc_strength;
780 const u32 *ecc_regs;
781 u8 num_ecc_strength;
782 @@ -76,7 +77,7 @@ static const u8 ecc_strength_mt2712[] = {
783 };
784
785 static const u8 ecc_strength_mt7622[] = {
786 - 4, 6, 8, 10, 12, 14, 16
787 + 4, 6, 8, 10, 12
788 };
789
790 enum mtk_ecc_regs {
791 @@ -221,7 +222,7 @@ void mtk_ecc_get_stats(struct mtk_ecc *ecc, struct mtk_ecc_stats *stats,
792 for (i = 0; i < sectors; i++) {
793 offset = (i >> 2) << 2;
794 err = readl(ecc->regs + ECC_DECENUM0 + offset);
795 - err = err >> ((i % 4) * 8);
796 + err = err >> ((i % 4) * ecc->caps->err_shift);
797 err &= ecc->caps->err_mask;
798 if (err == ecc->caps->err_mask) {
799 /* uncorrectable errors */
800 @@ -449,6 +450,7 @@ EXPORT_SYMBOL(mtk_ecc_get_parity_bits);
801
802 static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = {
803 .err_mask = 0x3f,
804 + .err_shift = 8,
805 .ecc_strength = ecc_strength_mt2701,
806 .ecc_regs = mt2701_ecc_regs,
807 .num_ecc_strength = 20,
808 @@ -459,6 +461,7 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = {
809
810 static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = {
811 .err_mask = 0x7f,
812 + .err_shift = 8,
813 .ecc_strength = ecc_strength_mt2712,
814 .ecc_regs = mt2712_ecc_regs,
815 .num_ecc_strength = 23,
816 @@ -468,10 +471,11 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = {
817 };
818
819 static const struct mtk_ecc_caps mtk_ecc_caps_mt7622 = {
820 - .err_mask = 0x3f,
821 + .err_mask = 0x1f,
822 + .err_shift = 5,
823 .ecc_strength = ecc_strength_mt7622,
824 .ecc_regs = mt7622_ecc_regs,
825 - .num_ecc_strength = 7,
826 + .num_ecc_strength = 5,
827 .ecc_mode_shift = 4,
828 .parity_bits = 13,
829 .pg_irq_sel = 0,
830 diff --git a/drivers/mtd/nand/raw/sh_flctl.c b/drivers/mtd/nand/raw/sh_flctl.c
831 index e509c93737c4f..f0e2f2d652829 100644
832 --- a/drivers/mtd/nand/raw/sh_flctl.c
833 +++ b/drivers/mtd/nand/raw/sh_flctl.c
834 @@ -384,7 +384,8 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf,
835 dma_addr_t dma_addr;
836 dma_cookie_t cookie;
837 uint32_t reg;
838 - int ret;
839 + int ret = 0;
840 + unsigned long time_left;
841
842 if (dir == DMA_FROM_DEVICE) {
843 chan = flctl->chan_fifo0_rx;
844 @@ -425,13 +426,14 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf,
845 goto out;
846 }
847
848 - ret =
849 + time_left =
850 wait_for_completion_timeout(&flctl->dma_complete,
851 msecs_to_jiffies(3000));
852
853 - if (ret <= 0) {
854 + if (time_left == 0) {
855 dmaengine_terminate_all(chan);
856 dev_err(&flctl->pdev->dev, "wait_for_completion_timeout\n");
857 + ret = -ETIMEDOUT;
858 }
859
860 out:
861 @@ -441,7 +443,7 @@ out:
862
863 dma_unmap_single(chan->device->dev, dma_addr, len, dir);
864
865 - /* ret > 0 is success */
866 + /* ret == 0 is success */
867 return ret;
868 }
869
870 @@ -465,7 +467,7 @@ static void read_fiforeg(struct sh_flctl *flctl, int rlen, int offset)
871
872 /* initiate DMA transfer */
873 if (flctl->chan_fifo0_rx && rlen >= 32 &&
874 - flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE) > 0)
875 + !flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE))
876 goto convert; /* DMA success */
877
878 /* do polling transfer */
879 @@ -524,7 +526,7 @@ static void write_ec_fiforeg(struct sh_flctl *flctl, int rlen,
880
881 /* initiate DMA transfer */
882 if (flctl->chan_fifo0_tx && rlen >= 32 &&
883 - flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE) > 0)
884 + !flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE))
885 return; /* DMA success */
886
887 /* do polling transfer */
888 diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
889 index 60e36f46f8abe..0c191d395f8f3 100644
890 --- a/drivers/net/dsa/lantiq_gswip.c
891 +++ b/drivers/net/dsa/lantiq_gswip.c
892 @@ -1607,9 +1607,6 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port,
893 break;
894 case PHY_INTERFACE_MODE_RMII:
895 miicfg |= GSWIP_MII_CFG_MODE_RMIIM;
896 -
897 - /* Configure the RMII clock as output: */
898 - miicfg |= GSWIP_MII_CFG_RMII_CLK;
899 break;
900 case PHY_INTERFACE_MODE_RGMII:
901 case PHY_INTERFACE_MODE_RGMII_ID:
902 diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
903 index cff64e43bdd80..b5f58c62e7d20 100644
904 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
905 +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
906 @@ -14267,10 +14267,6 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
907
908 /* Stop Tx */
909 bnx2x_tx_disable(bp);
910 - /* Delete all NAPI objects */
911 - bnx2x_del_all_napi(bp);
912 - if (CNIC_LOADED(bp))
913 - bnx2x_del_all_napi_cnic(bp);
914 netdev_reset_tc(bp->dev);
915
916 del_timer_sync(&bp->timer);
917 @@ -14375,6 +14371,11 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev)
918 bnx2x_drain_tx_queues(bp);
919 bnx2x_send_unload_req(bp, UNLOAD_RECOVERY);
920 bnx2x_netif_stop(bp, 1);
921 + bnx2x_del_all_napi(bp);
922 +
923 + if (CNIC_LOADED(bp))
924 + bnx2x_del_all_napi_cnic(bp);
925 +
926 bnx2x_free_irq(bp);
927
928 /* Report UNLOAD_DONE to MCP */
929 diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
930 index 2affdddc12bf6..e03e2bfcc6a10 100644
931 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
932 +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
933 @@ -1547,6 +1547,11 @@ static struct sk_buff *bcmgenet_put_tx_csum(struct net_device *dev,
934 return skb;
935 }
936
937 +static void bcmgenet_hide_tsb(struct sk_buff *skb)
938 +{
939 + __skb_pull(skb, sizeof(struct status_64));
940 +}
941 +
942 static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
943 {
944 struct bcmgenet_priv *priv = netdev_priv(dev);
945 @@ -1655,6 +1660,8 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
946 }
947
948 GENET_CB(skb)->last_cb = tx_cb_ptr;
949 +
950 + bcmgenet_hide_tsb(skb);
951 skb_tx_timestamp(skb);
952
953 /* Decrement total BD count and advance our write pointer */
954 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
955 index 23a706a1765a7..410a9bf7bf0ab 100644
956 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
957 +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
958 @@ -64,6 +64,13 @@ static int hclge_send_mbx_msg(struct hclge_vport *vport, u8 *msg, u16 msg_len,
959 enum hclge_cmd_status status;
960 struct hclge_desc desc;
961
962 + if (msg_len > HCLGE_MBX_MAX_MSG_SIZE) {
963 + dev_err(&hdev->pdev->dev,
964 + "msg data length(=%u) exceeds maximum(=%u)\n",
965 + msg_len, HCLGE_MBX_MAX_MSG_SIZE);
966 + return -EMSGSIZE;
967 + }
968 +
969 resp_pf_to_vf = (struct hclge_mbx_pf_to_vf_cmd *)desc.data;
970
971 hclge_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_PF_TO_VF, false);
972 diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
973 index b14b164c9601f..5799b434165e0 100644
974 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
975 +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
976 @@ -903,7 +903,8 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
977 /* Tx IPsec offload doesn't seem to work on this
978 * device, so block these requests for now.
979 */
980 - if (!(sam->flags & XFRM_OFFLOAD_INBOUND)) {
981 + sam->flags = sam->flags & ~XFRM_OFFLOAD_IPV6;
982 + if (sam->flags != XFRM_OFFLOAD_INBOUND) {
983 err = -EOPNOTSUPP;
984 goto err_out;
985 }
986 diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
987 index 72e47621d27c7..934c34e98d55f 100644
988 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
989 +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
990 @@ -65,8 +65,9 @@ static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed)
991 struct phy_device *phy_dev = ndev->phydev;
992 u32 val;
993
994 - writew(SGMII_ADAPTER_DISABLE,
995 - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
996 + if (sgmii_adapter_base)
997 + writew(SGMII_ADAPTER_DISABLE,
998 + sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
999
1000 if (splitter_base) {
1001 val = readl(splitter_base + EMAC_SPLITTER_CTRL_REG);
1002 @@ -88,10 +89,11 @@ static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed)
1003 writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG);
1004 }
1005
1006 - writew(SGMII_ADAPTER_ENABLE,
1007 - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
1008 - if (phy_dev)
1009 + if (phy_dev && sgmii_adapter_base) {
1010 + writew(SGMII_ADAPTER_ENABLE,
1011 + sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
1012 tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed);
1013 + }
1014 }
1015
1016 static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *dev)
1017 diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
1018 index 02d6f3ad9aca8..83dc1c2c3b84b 100644
1019 --- a/drivers/net/hamradio/6pack.c
1020 +++ b/drivers/net/hamradio/6pack.c
1021 @@ -311,7 +311,6 @@ static void sp_setup(struct net_device *dev)
1022 {
1023 /* Finish setting up the DEVICE info. */
1024 dev->netdev_ops = &sp_netdev_ops;
1025 - dev->needs_free_netdev = true;
1026 dev->mtu = SIXP_MTU;
1027 dev->hard_header_len = AX25_MAX_HEADER_LEN;
1028 dev->header_ops = &ax25_header_ops;
1029 @@ -679,9 +678,11 @@ static void sixpack_close(struct tty_struct *tty)
1030 del_timer_sync(&sp->tx_t);
1031 del_timer_sync(&sp->resync_t);
1032
1033 - /* Free all 6pack frame buffers. */
1034 + /* Free all 6pack frame buffers after unreg. */
1035 kfree(sp->rbuff);
1036 kfree(sp->xbuff);
1037 +
1038 + free_netdev(sp->dev);
1039 }
1040
1041 /* Perform I/O control on an active 6pack channel. */
1042 diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
1043 index a4b3fce69ecd9..6016e182f0089 100644
1044 --- a/drivers/net/hippi/rrunner.c
1045 +++ b/drivers/net/hippi/rrunner.c
1046 @@ -1346,7 +1346,9 @@ static int rr_close(struct net_device *dev)
1047
1048 rrpriv->fw_running = 0;
1049
1050 + spin_unlock_irqrestore(&rrpriv->lock, flags);
1051 del_timer_sync(&rrpriv->timer);
1052 + spin_lock_irqsave(&rrpriv->lock, flags);
1053
1054 writel(0, &regs->TxPi);
1055 writel(0, &regs->IpRxPi);
1056 diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c
1057 index 94a34cf75eb39..39d13f7e4cf33 100644
1058 --- a/drivers/phy/motorola/phy-mapphone-mdm6600.c
1059 +++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c
1060 @@ -628,7 +628,8 @@ idle:
1061 cleanup:
1062 if (error < 0)
1063 phy_mdm6600_device_power_off(ddata);
1064 -
1065 + pm_runtime_disable(ddata->dev);
1066 + pm_runtime_dont_use_autosuspend(ddata->dev);
1067 return error;
1068 }
1069
1070 diff --git a/drivers/phy/samsung/phy-exynos5250-sata.c b/drivers/phy/samsung/phy-exynos5250-sata.c
1071 index 4dd7324d91b26..ea46576404b8e 100644
1072 --- a/drivers/phy/samsung/phy-exynos5250-sata.c
1073 +++ b/drivers/phy/samsung/phy-exynos5250-sata.c
1074 @@ -190,6 +190,7 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
1075 return -EINVAL;
1076
1077 sata_phy->client = of_find_i2c_device_by_node(node);
1078 + of_node_put(node);
1079 if (!sata_phy->client)
1080 return -EPROBE_DEFER;
1081
1082 @@ -198,20 +199,21 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
1083 sata_phy->phyclk = devm_clk_get(dev, "sata_phyctrl");
1084 if (IS_ERR(sata_phy->phyclk)) {
1085 dev_err(dev, "failed to get clk for PHY\n");
1086 - return PTR_ERR(sata_phy->phyclk);
1087 + ret = PTR_ERR(sata_phy->phyclk);
1088 + goto put_dev;
1089 }
1090
1091 ret = clk_prepare_enable(sata_phy->phyclk);
1092 if (ret < 0) {
1093 dev_err(dev, "failed to enable source clk\n");
1094 - return ret;
1095 + goto put_dev;
1096 }
1097
1098 sata_phy->phy = devm_phy_create(dev, NULL, &exynos_sata_phy_ops);
1099 if (IS_ERR(sata_phy->phy)) {
1100 - clk_disable_unprepare(sata_phy->phyclk);
1101 dev_err(dev, "failed to create PHY\n");
1102 - return PTR_ERR(sata_phy->phy);
1103 + ret = PTR_ERR(sata_phy->phy);
1104 + goto clk_disable;
1105 }
1106
1107 phy_set_drvdata(sata_phy->phy, sata_phy);
1108 @@ -219,11 +221,18 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
1109 phy_provider = devm_of_phy_provider_register(dev,
1110 of_phy_simple_xlate);
1111 if (IS_ERR(phy_provider)) {
1112 - clk_disable_unprepare(sata_phy->phyclk);
1113 - return PTR_ERR(phy_provider);
1114 + ret = PTR_ERR(phy_provider);
1115 + goto clk_disable;
1116 }
1117
1118 return 0;
1119 +
1120 +clk_disable:
1121 + clk_disable_unprepare(sata_phy->phyclk);
1122 +put_dev:
1123 + put_device(&sata_phy->client->dev);
1124 +
1125 + return ret;
1126 }
1127
1128 static const struct of_device_id exynos_sata_phy_of_match[] = {
1129 diff --git a/drivers/phy/ti/phy-am654-serdes.c b/drivers/phy/ti/phy-am654-serdes.c
1130 index 6ef12017ff4e8..96e3426f9293b 100644
1131 --- a/drivers/phy/ti/phy-am654-serdes.c
1132 +++ b/drivers/phy/ti/phy-am654-serdes.c
1133 @@ -641,7 +641,7 @@ static int serdes_am654_probe(struct platform_device *pdev)
1134
1135 clk_err:
1136 of_clk_del_provider(node);
1137 -
1138 + pm_runtime_disable(dev);
1139 return ret;
1140 }
1141
1142 diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
1143 index 3d74629d7423c..471fe2e80f4ea 100644
1144 --- a/drivers/phy/ti/phy-omap-usb2.c
1145 +++ b/drivers/phy/ti/phy-omap-usb2.c
1146 @@ -157,7 +157,7 @@ static int omap_usb2_enable_clocks(struct omap_usb *phy)
1147 return 0;
1148
1149 err1:
1150 - clk_disable(phy->wkupclk);
1151 + clk_disable_unprepare(phy->wkupclk);
1152
1153 err0:
1154 return ret;
1155 diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c
1156 index 379e9a6a6d894..5f381e4c75779 100644
1157 --- a/drivers/pinctrl/pinctrl-pistachio.c
1158 +++ b/drivers/pinctrl/pinctrl-pistachio.c
1159 @@ -1370,10 +1370,10 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
1160 }
1161
1162 irq = irq_of_parse_and_map(child, 0);
1163 - if (irq < 0) {
1164 - dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq);
1165 + if (!irq) {
1166 + dev_err(pctl->dev, "No IRQ for bank %u\n", i);
1167 of_node_put(child);
1168 - ret = irq;
1169 + ret = -EINVAL;
1170 goto err;
1171 }
1172
1173 diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
1174 index f4fe73ce57108..c38f06139ccfa 100644
1175 --- a/drivers/tty/n_gsm.c
1176 +++ b/drivers/tty/n_gsm.c
1177 @@ -72,6 +72,8 @@ module_param(debug, int, 0600);
1178 */
1179 #define MAX_MRU 1500
1180 #define MAX_MTU 1500
1181 +/* SOF, ADDR, CTRL, LEN1, LEN2, ..., FCS, EOF */
1182 +#define PROT_OVERHEAD 7
1183 #define GSM_NET_TX_TIMEOUT (HZ*10)
1184
1185 /**
1186 @@ -823,7 +825,7 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, struct gsm_dlci *dlci)
1187 break;
1188 case 2: /* Unstructed with modem bits.
1189 Always one byte as we never send inline break data */
1190 - *dp++ = gsm_encode_modem(dlci);
1191 + *dp++ = (gsm_encode_modem(dlci) << 1) | EA;
1192 break;
1193 }
1194 WARN_ON(kfifo_out_locked(dlci->fifo, dp , len, &dlci->lock) != len);
1195 @@ -1300,11 +1302,12 @@ static void gsm_control_response(struct gsm_mux *gsm, unsigned int command,
1196
1197 static void gsm_control_transmit(struct gsm_mux *gsm, struct gsm_control *ctrl)
1198 {
1199 - struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 1, gsm->ftype);
1200 + struct gsm_msg *msg = gsm_data_alloc(gsm, 0, ctrl->len + 2, gsm->ftype);
1201 if (msg == NULL)
1202 return;
1203 - msg->data[0] = (ctrl->cmd << 1) | 2 | EA; /* command */
1204 - memcpy(msg->data + 1, ctrl->data, ctrl->len);
1205 + msg->data[0] = (ctrl->cmd << 1) | CR | EA; /* command */
1206 + msg->data[1] = (ctrl->len << 1) | EA;
1207 + memcpy(msg->data + 2, ctrl->data, ctrl->len);
1208 gsm_data_queue(gsm->dlci[0], msg);
1209 }
1210
1211 @@ -1327,7 +1330,6 @@ static void gsm_control_retransmit(struct timer_list *t)
1212 spin_lock_irqsave(&gsm->control_lock, flags);
1213 ctrl = gsm->pending_cmd;
1214 if (ctrl) {
1215 - gsm->cretries--;
1216 if (gsm->cretries == 0) {
1217 gsm->pending_cmd = NULL;
1218 ctrl->error = -ETIMEDOUT;
1219 @@ -1336,6 +1338,7 @@ static void gsm_control_retransmit(struct timer_list *t)
1220 wake_up(&gsm->event);
1221 return;
1222 }
1223 + gsm->cretries--;
1224 gsm_control_transmit(gsm, ctrl);
1225 mod_timer(&gsm->t2_timer, jiffies + gsm->t2 * HZ / 100);
1226 }
1227 @@ -1376,7 +1379,7 @@ retry:
1228
1229 /* If DLCI0 is in ADM mode skip retries, it won't respond */
1230 if (gsm->dlci[0]->mode == DLCI_MODE_ADM)
1231 - gsm->cretries = 1;
1232 + gsm->cretries = 0;
1233 else
1234 gsm->cretries = gsm->n2;
1235
1236 @@ -1810,7 +1813,6 @@ static void gsm_queue(struct gsm_mux *gsm)
1237 gsm_response(gsm, address, UA);
1238 gsm_dlci_close(dlci);
1239 break;
1240 - case UA:
1241 case UA|PF:
1242 if (cr == 0 || dlci == NULL)
1243 break;
1244 @@ -1961,7 +1963,8 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c)
1245 }
1246 /* Any partial frame was a runt so go back to start */
1247 if (gsm->state != GSM_START) {
1248 - gsm->malformed++;
1249 + if (gsm->state != GSM_SEARCH)
1250 + gsm->malformed++;
1251 gsm->state = GSM_START;
1252 }
1253 /* A SOF in GSM_START means we are still reading idling or
1254 @@ -2098,6 +2101,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm)
1255 gsm_dlci_release(gsm->dlci[i]);
1256 mutex_unlock(&gsm->mutex);
1257 /* Now wipe the queues */
1258 + tty_ldisc_flush(gsm->tty);
1259 list_for_each_entry_safe(txq, ntxq, &gsm->tx_list, list)
1260 kfree(txq);
1261 INIT_LIST_HEAD(&gsm->tx_list);
1262 @@ -2208,7 +2212,7 @@ static struct gsm_mux *gsm_alloc_mux(void)
1263 kfree(gsm);
1264 return NULL;
1265 }
1266 - gsm->txframe = kmalloc(2 * MAX_MRU + 2, GFP_KERNEL);
1267 + gsm->txframe = kmalloc(2 * (MAX_MTU + PROT_OVERHEAD - 1), GFP_KERNEL);
1268 if (gsm->txframe == NULL) {
1269 kfree(gsm->buf);
1270 kfree(gsm);
1271 @@ -2264,7 +2268,7 @@ static int gsm_config(struct gsm_mux *gsm, struct gsm_config *c)
1272 /* Check the MRU/MTU range looks sane */
1273 if (c->mru > MAX_MRU || c->mtu > MAX_MTU || c->mru < 8 || c->mtu < 8)
1274 return -EINVAL;
1275 - if (c->n2 < 3)
1276 + if (c->n2 > 255)
1277 return -EINVAL;
1278 if (c->encapsulation > 1) /* Basic, advanced, no I */
1279 return -EINVAL;
1280 @@ -2879,19 +2883,17 @@ static struct tty_ldisc_ops tty_ldisc_packet = {
1281
1282 static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk)
1283 {
1284 - u8 modembits[5];
1285 + u8 modembits[3];
1286 struct gsm_control *ctrl;
1287 int len = 2;
1288
1289 - if (brk)
1290 + modembits[0] = (dlci->addr << 2) | 2 | EA; /* DLCI, Valid, EA */
1291 + modembits[1] = (gsm_encode_modem(dlci) << 1) | EA;
1292 + if (brk) {
1293 + modembits[2] = (brk << 4) | 2 | EA; /* Length, Break, EA */
1294 len++;
1295 -
1296 - modembits[0] = len << 1 | EA; /* Data bytes */
1297 - modembits[1] = dlci->addr << 2 | 3; /* DLCI, EA, 1 */
1298 - modembits[2] = gsm_encode_modem(dlci) << 1 | EA;
1299 - if (brk)
1300 - modembits[3] = brk << 4 | 2 | EA; /* Valid, EA */
1301 - ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len + 1);
1302 + }
1303 + ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len);
1304 if (ctrl == NULL)
1305 return -ENOMEM;
1306 return gsm_control_wait(dlci->gsm, ctrl);
1307 diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
1308 index fd443bc4c2983..92e2ee2785239 100644
1309 --- a/drivers/tty/serial/8250/8250_pci.c
1310 +++ b/drivers/tty/serial/8250/8250_pci.c
1311 @@ -2907,7 +2907,7 @@ enum pci_board_num_t {
1312 pbn_panacom2,
1313 pbn_panacom4,
1314 pbn_plx_romulus,
1315 - pbn_endrun_2_4000000,
1316 + pbn_endrun_2_3906250,
1317 pbn_oxsemi,
1318 pbn_oxsemi_1_4000000,
1319 pbn_oxsemi_2_4000000,
1320 @@ -3434,10 +3434,10 @@ static struct pciserial_board pci_boards[] = {
1321 * signal now many ports are available
1322 * 2 port 952 Uart support
1323 */
1324 - [pbn_endrun_2_4000000] = {
1325 + [pbn_endrun_2_3906250] = {
1326 .flags = FL_BASE0,
1327 .num_ports = 2,
1328 - .base_baud = 4000000,
1329 + .base_baud = 3906250,
1330 .uart_offset = 0x200,
1331 .first_offset = 0x1000,
1332 },
1333 @@ -4345,7 +4345,7 @@ static const struct pci_device_id serial_pci_tbl[] = {
1334 */
1335 { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588,
1336 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
1337 - pbn_endrun_2_4000000 },
1338 + pbn_endrun_2_3906250 },
1339 /*
1340 * Quatech cards. These actually have configurable clocks but for
1341 * now we just use the default.
1342 diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
1343 index 87567515591e1..c1891c55897ad 100644
1344 --- a/drivers/tty/serial/8250/8250_port.c
1345 +++ b/drivers/tty/serial/8250/8250_port.c
1346 @@ -3184,7 +3184,7 @@ static void serial8250_console_restore(struct uart_8250_port *up)
1347
1348 serial8250_set_divisor(port, baud, quot, frac);
1349 serial_port_out(port, UART_LCR, up->lcr);
1350 - serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS);
1351 + serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS);
1352 }
1353
1354 /*
1355 diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
1356 index e5ed4ab2b08df..8b41a783b37ee 100644
1357 --- a/drivers/tty/serial/imx.c
1358 +++ b/drivers/tty/serial/imx.c
1359 @@ -1401,7 +1401,7 @@ static int imx_uart_startup(struct uart_port *port)
1360 imx_uart_writel(sport, ucr1, UCR1);
1361
1362 ucr4 = imx_uart_readl(sport, UCR4) & ~UCR4_OREN;
1363 - if (!sport->dma_is_enabled)
1364 + if (!dma_is_inited)
1365 ucr4 |= UCR4_OREN;
1366 imx_uart_writel(sport, ucr4, UCR4);
1367
1368 diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1369 index a118c44c70e1e..d5f233fa6f3b4 100644
1370 --- a/drivers/usb/core/quirks.c
1371 +++ b/drivers/usb/core/quirks.c
1372 @@ -404,6 +404,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1373 { USB_DEVICE(0x0b05, 0x17e0), .driver_info =
1374 USB_QUIRK_IGNORE_REMOTE_WAKEUP },
1375
1376 + /* Realtek Semiconductor Corp. Mass Storage Device (Multicard Reader)*/
1377 + { USB_DEVICE(0x0bda, 0x0151), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
1378 +
1379 /* Realtek hub in Dell WD19 (Type-C) */
1380 { USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM },
1381 { USB_DEVICE(0x0bda, 0x5487), .driver_info = USB_QUIRK_RESET_RESUME },
1382 @@ -508,6 +511,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1383 /* DJI CineSSD */
1384 { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
1385
1386 + /* VCOM device */
1387 + { USB_DEVICE(0x4296, 0x7570), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
1388 +
1389 /* INTEL VALUE SSD */
1390 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
1391
1392 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
1393 index 2c68ec60d39a3..8cc81f193e9c1 100644
1394 --- a/drivers/usb/dwc3/core.c
1395 +++ b/drivers/usb/dwc3/core.c
1396 @@ -1229,10 +1229,10 @@ static void dwc3_get_properties(struct dwc3 *dwc)
1397 u8 lpm_nyet_threshold;
1398 u8 tx_de_emphasis;
1399 u8 hird_threshold;
1400 - u8 rx_thr_num_pkt_prd;
1401 - u8 rx_max_burst_prd;
1402 - u8 tx_thr_num_pkt_prd;
1403 - u8 tx_max_burst_prd;
1404 + u8 rx_thr_num_pkt_prd = 0;
1405 + u8 rx_max_burst_prd = 0;
1406 + u8 tx_thr_num_pkt_prd = 0;
1407 + u8 tx_max_burst_prd = 0;
1408
1409 /* default to highest possible threshold */
1410 lpm_nyet_threshold = 0xf;
1411 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
1412 index a1d8cb69d229d..18a53a3dfac6c 100644
1413 --- a/drivers/usb/dwc3/gadget.c
1414 +++ b/drivers/usb/dwc3/gadget.c
1415 @@ -2728,6 +2728,7 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
1416 const struct dwc3_event_depevt *event,
1417 struct dwc3_request *req, int status)
1418 {
1419 + int request_status;
1420 int ret;
1421
1422 if (req->request.num_mapped_sgs)
1423 @@ -2757,7 +2758,35 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
1424 req->needs_extra_trb = false;
1425 }
1426
1427 - dwc3_gadget_giveback(dep, req, status);
1428 + /*
1429 + * The event status only reflects the status of the TRB with IOC set.
1430 + * For the requests that don't set interrupt on completion, the driver
1431 + * needs to check and return the status of the completed TRBs associated
1432 + * with the request. Use the status of the last TRB of the request.
1433 + */
1434 + if (req->request.no_interrupt) {
1435 + struct dwc3_trb *trb;
1436 +
1437 + trb = dwc3_ep_prev_trb(dep, dep->trb_dequeue);
1438 + switch (DWC3_TRB_SIZE_TRBSTS(trb->size)) {
1439 + case DWC3_TRBSTS_MISSED_ISOC:
1440 + /* Isoc endpoint only */
1441 + request_status = -EXDEV;
1442 + break;
1443 + case DWC3_TRB_STS_XFER_IN_PROG:
1444 + /* Applicable when End Transfer with ForceRM=0 */
1445 + case DWC3_TRBSTS_SETUP_PENDING:
1446 + /* Control endpoint only */
1447 + case DWC3_TRBSTS_OK:
1448 + default:
1449 + request_status = 0;
1450 + break;
1451 + }
1452 + } else {
1453 + request_status = status;
1454 + }
1455 +
1456 + dwc3_gadget_giveback(dep, req, request_status);
1457
1458 out:
1459 return ret;
1460 diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
1461 index 3d4710cc34bc1..2350e97a1662c 100644
1462 --- a/drivers/usb/gadget/configfs.c
1463 +++ b/drivers/usb/gadget/configfs.c
1464 @@ -1412,6 +1412,8 @@ static void configfs_composite_unbind(struct usb_gadget *gadget)
1465 usb_ep_autoconfig_reset(cdev->gadget);
1466 spin_lock_irqsave(&gi->spinlock, flags);
1467 cdev->gadget = NULL;
1468 + cdev->deactivations = 0;
1469 + gadget->deactivated = false;
1470 set_gadget_data(gadget, NULL);
1471 spin_unlock_irqrestore(&gi->spinlock, flags);
1472 }
1473 diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c
1474 index 61e2c94cc0b0c..cab1e30462c24 100644
1475 --- a/drivers/usb/gadget/function/uvc_queue.c
1476 +++ b/drivers/usb/gadget/function/uvc_queue.c
1477 @@ -242,6 +242,8 @@ void uvcg_queue_cancel(struct uvc_video_queue *queue, int disconnect)
1478 buf->state = UVC_BUF_STATE_ERROR;
1479 vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_ERROR);
1480 }
1481 + queue->buf_used = 0;
1482 +
1483 /* This must be protected by the irqlock spinlock to avoid race
1484 * conditions between uvc_queue_buffer and the disconnection event that
1485 * could result in an interruptible wait in uvc_dequeue_buffer. Do not
1486 diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
1487 index db65e1ad00deb..dd46c15c4853f 100644
1488 --- a/drivers/usb/host/xhci-hub.c
1489 +++ b/drivers/usb/host/xhci-hub.c
1490 @@ -1343,7 +1343,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
1491 }
1492 spin_unlock_irqrestore(&xhci->lock, flags);
1493 if (!wait_for_completion_timeout(&bus_state->u3exit_done[wIndex],
1494 - msecs_to_jiffies(100)))
1495 + msecs_to_jiffies(500)))
1496 xhci_dbg(xhci, "missing U0 port change event for port %d\n",
1497 wIndex);
1498 spin_lock_irqsave(&xhci->lock, flags);
1499 diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1500 index 7fa27b4037560..6cedae902adf9 100644
1501 --- a/drivers/usb/host/xhci-ring.c
1502 +++ b/drivers/usb/host/xhci-ring.c
1503 @@ -2932,6 +2932,8 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
1504 if (event_loop++ < TRBS_PER_SEGMENT / 2)
1505 continue;
1506 xhci_update_erst_dequeue(xhci, event_ring_deq);
1507 + event_ring_deq = xhci->event_ring->dequeue;
1508 +
1509 event_loop = 0;
1510 }
1511
1512 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1513 index 476dc6abd5a21..2f59d447411b5 100644
1514 --- a/drivers/usb/host/xhci.c
1515 +++ b/drivers/usb/host/xhci.c
1516 @@ -779,6 +779,17 @@ void xhci_shutdown(struct usb_hcd *hcd)
1517 if (xhci->quirks & XHCI_SPURIOUS_REBOOT)
1518 usb_disable_xhci_ports(to_pci_dev(hcd->self.sysdev));
1519
1520 + /* Don't poll the roothubs after shutdown. */
1521 + xhci_dbg(xhci, "%s: stopping usb%d port polling.\n",
1522 + __func__, hcd->self.busnum);
1523 + clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
1524 + del_timer_sync(&hcd->rh_timer);
1525 +
1526 + if (xhci->shared_hcd) {
1527 + clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags);
1528 + del_timer_sync(&xhci->shared_hcd->rh_timer);
1529 + }
1530 +
1531 spin_lock_irq(&xhci->lock);
1532 xhci_halt(xhci);
1533 /* Workaround for spurious wakeups at shutdown with HSW */
1534 diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
1535 index 748139d262633..0be8efcda15d5 100644
1536 --- a/drivers/usb/misc/uss720.c
1537 +++ b/drivers/usb/misc/uss720.c
1538 @@ -71,6 +71,7 @@ static void destroy_priv(struct kref *kref)
1539
1540 dev_dbg(&priv->usbdev->dev, "destroying priv datastructure\n");
1541 usb_put_dev(priv->usbdev);
1542 + priv->usbdev = NULL;
1543 kfree(priv);
1544 }
1545
1546 @@ -736,7 +737,6 @@ static int uss720_probe(struct usb_interface *intf,
1547 parport_announce_port(pp);
1548
1549 usb_set_intfdata(intf, pp);
1550 - usb_put_dev(usbdev);
1551 return 0;
1552
1553 probe_abort:
1554 @@ -754,7 +754,6 @@ static void uss720_disconnect(struct usb_interface *intf)
1555 usb_set_intfdata(intf, NULL);
1556 if (pp) {
1557 priv = pp->private_data;
1558 - priv->usbdev = NULL;
1559 priv->pp = NULL;
1560 dev_dbg(&intf->dev, "parport_remove_port\n");
1561 parport_remove_port(pp);
1562 diff --git a/drivers/usb/mtu3/mtu3_dr.c b/drivers/usb/mtu3/mtu3_dr.c
1563 index 08e18448e8b82..db30365345e0f 100644
1564 --- a/drivers/usb/mtu3/mtu3_dr.c
1565 +++ b/drivers/usb/mtu3/mtu3_dr.c
1566 @@ -41,10 +41,8 @@ static char *mailbox_state_string(enum mtu3_vbus_id_state state)
1567
1568 static void toggle_opstate(struct ssusb_mtk *ssusb)
1569 {
1570 - if (!ssusb->otg_switch.is_u3_drd) {
1571 - mtu3_setbits(ssusb->mac_base, U3D_DEVICE_CONTROL, DC_SESSION);
1572 - mtu3_setbits(ssusb->mac_base, U3D_POWER_MANAGEMENT, SOFT_CONN);
1573 - }
1574 + mtu3_setbits(ssusb->mac_base, U3D_DEVICE_CONTROL, DC_SESSION);
1575 + mtu3_setbits(ssusb->mac_base, U3D_POWER_MANAGEMENT, SOFT_CONN);
1576 }
1577
1578 /* only port0 supports dual-role mode */
1579 diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1580 index dfa7c504befe8..d5a1832aa48eb 100644
1581 --- a/drivers/usb/serial/cp210x.c
1582 +++ b/drivers/usb/serial/cp210x.c
1583 @@ -195,6 +195,8 @@ static const struct usb_device_id id_table[] = {
1584 { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */
1585 { USB_DEVICE(0x17A8, 0x0001) }, /* Kamstrup Optical Eye/3-wire */
1586 { USB_DEVICE(0x17A8, 0x0005) }, /* Kamstrup M-Bus Master MultiPort 250D */
1587 + { USB_DEVICE(0x17A8, 0x0101) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Int Ant) */
1588 + { USB_DEVICE(0x17A8, 0x0102) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Ext Ant) */
1589 { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
1590 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
1591 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
1592 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1593 index 839eac04b5e30..fa978412601aa 100644
1594 --- a/drivers/usb/serial/option.c
1595 +++ b/drivers/usb/serial/option.c
1596 @@ -432,6 +432,8 @@ static void option_instat_callback(struct urb *urb);
1597 #define CINTERION_PRODUCT_CLS8 0x00b0
1598 #define CINTERION_PRODUCT_MV31_MBIM 0x00b3
1599 #define CINTERION_PRODUCT_MV31_RMNET 0x00b7
1600 +#define CINTERION_PRODUCT_MV32_WA 0x00f1
1601 +#define CINTERION_PRODUCT_MV32_WB 0x00f2
1602
1603 /* Olivetti products */
1604 #define OLIVETTI_VENDOR_ID 0x0b3c
1605 @@ -1217,6 +1219,10 @@ static const struct usb_device_id option_ids[] = {
1606 .driver_info = NCTRL(0) | RSVD(1) },
1607 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff), /* Telit FD980 */
1608 .driver_info = NCTRL(2) | RSVD(3) },
1609 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1057, 0xff), /* Telit FN980 */
1610 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1611 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1058, 0xff), /* Telit FN980 (PCIe) */
1612 + .driver_info = NCTRL(0) | RSVD(1) },
1613 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1060, 0xff), /* Telit LN920 (rmnet) */
1614 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1615 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1061, 0xff), /* Telit LN920 (MBIM) */
1616 @@ -1233,6 +1239,8 @@ static const struct usb_device_id option_ids[] = {
1617 .driver_info = NCTRL(2) | RSVD(3) },
1618 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990 (ECM) */
1619 .driver_info = NCTRL(0) | RSVD(1) },
1620 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990 (PCIe) */
1621 + .driver_info = RSVD(0) },
1622 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910),
1623 .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) },
1624 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
1625 @@ -1969,6 +1977,10 @@ static const struct usb_device_id option_ids[] = {
1626 .driver_info = RSVD(3)},
1627 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_RMNET, 0xff),
1628 .driver_info = RSVD(0)},
1629 + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WA, 0xff),
1630 + .driver_info = RSVD(3)},
1631 + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_WB, 0xff),
1632 + .driver_info = RSVD(3)},
1633 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100),
1634 .driver_info = RSVD(4) },
1635 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120),
1636 diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
1637 index ca3bd58f2025a..5576cfa50bc80 100644
1638 --- a/drivers/usb/serial/whiteheat.c
1639 +++ b/drivers/usb/serial/whiteheat.c
1640 @@ -599,9 +599,8 @@ static int firm_send_command(struct usb_serial_port *port, __u8 command,
1641 switch (command) {
1642 case WHITEHEAT_GET_DTR_RTS:
1643 info = usb_get_serial_port_data(port);
1644 - memcpy(&info->mcr, command_info->result_buffer,
1645 - sizeof(struct whiteheat_dr_info));
1646 - break;
1647 + info->mcr = command_info->result_buffer[0];
1648 + break;
1649 }
1650 }
1651 exit:
1652 diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
1653 index f3934f2d3c443..0268e654cae68 100644
1654 --- a/drivers/usb/typec/ucsi/ucsi.c
1655 +++ b/drivers/usb/typec/ucsi/ucsi.c
1656 @@ -748,14 +748,18 @@ ucsi_dr_swap(const struct typec_capability *cap, enum typec_data_role role)
1657 if (ret < 0)
1658 goto out_unlock;
1659
1660 + mutex_unlock(&con->lock);
1661 +
1662 if (!wait_for_completion_timeout(&con->complete,
1663 - msecs_to_jiffies(UCSI_SWAP_TIMEOUT_MS)))
1664 - ret = -ETIMEDOUT;
1665 + msecs_to_jiffies(UCSI_SWAP_TIMEOUT_MS)))
1666 + return -ETIMEDOUT;
1667 +
1668 + return 0;
1669
1670 out_unlock:
1671 mutex_unlock(&con->lock);
1672
1673 - return ret < 0 ? ret : 0;
1674 + return ret;
1675 }
1676
1677 static int
1678 @@ -780,11 +784,13 @@ ucsi_pr_swap(const struct typec_capability *cap, enum typec_role role)
1679 if (ret < 0)
1680 goto out_unlock;
1681
1682 + mutex_unlock(&con->lock);
1683 +
1684 if (!wait_for_completion_timeout(&con->complete,
1685 - msecs_to_jiffies(UCSI_SWAP_TIMEOUT_MS))) {
1686 - ret = -ETIMEDOUT;
1687 - goto out_unlock;
1688 - }
1689 + msecs_to_jiffies(UCSI_SWAP_TIMEOUT_MS)))
1690 + return -ETIMEDOUT;
1691 +
1692 + mutex_lock(&con->lock);
1693
1694 /* Something has gone wrong while swapping the role */
1695 if (con->status.pwr_op_mode != UCSI_CONSTAT_PWR_OPMODE_PD) {
1696 diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c
1697 index e269b1391e146..8e8af408998ea 100644
1698 --- a/drivers/video/fbdev/udlfb.c
1699 +++ b/drivers/video/fbdev/udlfb.c
1700 @@ -1650,8 +1650,9 @@ static int dlfb_usb_probe(struct usb_interface *intf,
1701 const struct device_attribute *attr;
1702 struct dlfb_data *dlfb;
1703 struct fb_info *info;
1704 - int retval = -ENOMEM;
1705 + int retval;
1706 struct usb_device *usbdev = interface_to_usbdev(intf);
1707 + struct usb_endpoint_descriptor *out;
1708
1709 /* usb initialization */
1710 dlfb = kzalloc(sizeof(*dlfb), GFP_KERNEL);
1711 @@ -1665,6 +1666,12 @@ static int dlfb_usb_probe(struct usb_interface *intf,
1712 dlfb->udev = usb_get_dev(usbdev);
1713 usb_set_intfdata(intf, dlfb);
1714
1715 + retval = usb_find_common_endpoints(intf->cur_altsetting, NULL, &out, NULL, NULL);
1716 + if (retval) {
1717 + dev_err(&intf->dev, "Device should have at lease 1 bulk endpoint!\n");
1718 + goto error;
1719 + }
1720 +
1721 dev_dbg(&intf->dev, "console enable=%d\n", console);
1722 dev_dbg(&intf->dev, "fb_defio enable=%d\n", fb_defio);
1723 dev_dbg(&intf->dev, "shadow enable=%d\n", shadow);
1724 @@ -1674,6 +1681,7 @@ static int dlfb_usb_probe(struct usb_interface *intf,
1725 if (!dlfb_parse_vendor_descriptor(dlfb, intf)) {
1726 dev_err(&intf->dev,
1727 "firmware not recognized, incompatible device?\n");
1728 + retval = -ENODEV;
1729 goto error;
1730 }
1731
1732 @@ -1687,8 +1695,10 @@ static int dlfb_usb_probe(struct usb_interface *intf,
1733
1734 /* allocates framebuffer driver structure, not framebuffer memory */
1735 info = framebuffer_alloc(0, &dlfb->udev->dev);
1736 - if (!info)
1737 + if (!info) {
1738 + retval = -ENOMEM;
1739 goto error;
1740 + }
1741
1742 dlfb->info = info;
1743 info->par = dlfb;
1744 diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
1745 index defee1d208d22..7985fe25850b7 100644
1746 --- a/fs/cifs/smb2ops.c
1747 +++ b/fs/cifs/smb2ops.c
1748 @@ -1643,9 +1643,17 @@ smb2_copychunk_range(const unsigned int xid,
1749 int chunks_copied = 0;
1750 bool chunk_sizes_updated = false;
1751 ssize_t bytes_written, total_bytes_written = 0;
1752 + struct inode *inode;
1753
1754 pcchunk = kmalloc(sizeof(struct copychunk_ioctl), GFP_KERNEL);
1755
1756 + /*
1757 + * We need to flush all unwritten data before we can send the
1758 + * copychunk ioctl to the server.
1759 + */
1760 + inode = d_inode(trgtfile->dentry);
1761 + filemap_write_and_wait(inode->i_mapping);
1762 +
1763 if (pcchunk == NULL)
1764 return -ENOMEM;
1765
1766 diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
1767 index 358398b1fe0c9..7d039ba5ae28b 100644
1768 --- a/fs/hugetlbfs/inode.c
1769 +++ b/fs/hugetlbfs/inode.c
1770 @@ -38,6 +38,7 @@
1771 #include <linux/uio.h>
1772
1773 #include <linux/uaccess.h>
1774 +#include <linux/sched/mm.h>
1775
1776 static const struct super_operations hugetlbfs_ops;
1777 static const struct address_space_operations hugetlbfs_aops;
1778 @@ -200,6 +201,54 @@ out:
1779 */
1780
1781 #ifndef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
1782 +static unsigned long
1783 +hugetlb_get_unmapped_area_bottomup(struct file *file, unsigned long addr,
1784 + unsigned long len, unsigned long pgoff, unsigned long flags)
1785 +{
1786 + struct hstate *h = hstate_file(file);
1787 + struct vm_unmapped_area_info info;
1788 +
1789 + info.flags = 0;
1790 + info.length = len;
1791 + info.low_limit = current->mm->mmap_base;
1792 + info.high_limit = arch_get_mmap_end(addr);
1793 + info.align_mask = PAGE_MASK & ~huge_page_mask(h);
1794 + info.align_offset = 0;
1795 + return vm_unmapped_area(&info);
1796 +}
1797 +
1798 +static unsigned long
1799 +hugetlb_get_unmapped_area_topdown(struct file *file, unsigned long addr,
1800 + unsigned long len, unsigned long pgoff, unsigned long flags)
1801 +{
1802 + struct hstate *h = hstate_file(file);
1803 + struct vm_unmapped_area_info info;
1804 +
1805 + info.flags = VM_UNMAPPED_AREA_TOPDOWN;
1806 + info.length = len;
1807 + info.low_limit = max(PAGE_SIZE, mmap_min_addr);
1808 + info.high_limit = arch_get_mmap_base(addr, current->mm->mmap_base);
1809 + info.align_mask = PAGE_MASK & ~huge_page_mask(h);
1810 + info.align_offset = 0;
1811 + addr = vm_unmapped_area(&info);
1812 +
1813 + /*
1814 + * A failed mmap() very likely causes application failure,
1815 + * so fall back to the bottom-up function here. This scenario
1816 + * can happen with large stack limits and large mmap()
1817 + * allocations.
1818 + */
1819 + if (unlikely(offset_in_page(addr))) {
1820 + VM_BUG_ON(addr != -ENOMEM);
1821 + info.flags = 0;
1822 + info.low_limit = current->mm->mmap_base;
1823 + info.high_limit = arch_get_mmap_end(addr);
1824 + addr = vm_unmapped_area(&info);
1825 + }
1826 +
1827 + return addr;
1828 +}
1829 +
1830 static unsigned long
1831 hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
1832 unsigned long len, unsigned long pgoff, unsigned long flags)
1833 @@ -207,7 +256,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
1834 struct mm_struct *mm = current->mm;
1835 struct vm_area_struct *vma;
1836 struct hstate *h = hstate_file(file);
1837 - struct vm_unmapped_area_info info;
1838 + const unsigned long mmap_end = arch_get_mmap_end(addr);
1839
1840 if (len & ~huge_page_mask(h))
1841 return -EINVAL;
1842 @@ -223,18 +272,21 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
1843 if (addr) {
1844 addr = ALIGN(addr, huge_page_size(h));
1845 vma = find_vma(mm, addr);
1846 - if (TASK_SIZE - len >= addr &&
1847 + if (mmap_end - len >= addr &&
1848 (!vma || addr + len <= vm_start_gap(vma)))
1849 return addr;
1850 }
1851
1852 - info.flags = 0;
1853 - info.length = len;
1854 - info.low_limit = TASK_UNMAPPED_BASE;
1855 - info.high_limit = TASK_SIZE;
1856 - info.align_mask = PAGE_MASK & ~huge_page_mask(h);
1857 - info.align_offset = 0;
1858 - return vm_unmapped_area(&info);
1859 + /*
1860 + * Use mm->get_unmapped_area value as a hint to use topdown routine.
1861 + * If architectures have special needs, they should define their own
1862 + * version of hugetlb_get_unmapped_area.
1863 + */
1864 + if (mm->get_unmapped_area == arch_get_unmapped_area_topdown)
1865 + return hugetlb_get_unmapped_area_topdown(file, addr, len,
1866 + pgoff, flags);
1867 + return hugetlb_get_unmapped_area_bottomup(file, addr, len,
1868 + pgoff, flags);
1869 }
1870 #endif
1871
1872 diff --git a/include/linux/kernel.h b/include/linux/kernel.h
1873 index d83d403dac2ea..77c86a2236daf 100644
1874 --- a/include/linux/kernel.h
1875 +++ b/include/linux/kernel.h
1876 @@ -627,7 +627,7 @@ static inline char *hex_byte_pack_upper(char *buf, u8 byte)
1877 return buf;
1878 }
1879
1880 -extern int hex_to_bin(char ch);
1881 +extern int hex_to_bin(unsigned char ch);
1882 extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
1883 extern char *bin2hex(char *dst, const void *src, size_t count);
1884
1885 diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
1886 index 3a1d899019af0..ab0da04ac9ee7 100644
1887 --- a/include/linux/sched/mm.h
1888 +++ b/include/linux/sched/mm.h
1889 @@ -133,6 +133,14 @@ static inline void mm_update_next_owner(struct mm_struct *mm)
1890 #endif /* CONFIG_MEMCG */
1891
1892 #ifdef CONFIG_MMU
1893 +#ifndef arch_get_mmap_end
1894 +#define arch_get_mmap_end(addr) (TASK_SIZE)
1895 +#endif
1896 +
1897 +#ifndef arch_get_mmap_base
1898 +#define arch_get_mmap_base(addr, base) (base)
1899 +#endif
1900 +
1901 extern void arch_pick_mmap_layout(struct mm_struct *mm,
1902 struct rlimit *rlim_stack);
1903 extern unsigned long
1904 diff --git a/include/net/tcp.h b/include/net/tcp.h
1905 index b914959cd2c67..9237362e56065 100644
1906 --- a/include/net/tcp.h
1907 +++ b/include/net/tcp.h
1908 @@ -603,6 +603,7 @@ void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req);
1909 void tcp_reset(struct sock *sk);
1910 void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb);
1911 void tcp_fin(struct sock *sk);
1912 +void tcp_check_space(struct sock *sk);
1913
1914 /* tcp_timer.c */
1915 void tcp_init_xmit_timers(struct sock *);
1916 @@ -1030,6 +1031,7 @@ struct rate_sample {
1917 int losses; /* number of packets marked lost upon ACK */
1918 u32 acked_sacked; /* number of packets newly (S)ACKed upon ACK */
1919 u32 prior_in_flight; /* in flight before this ACK */
1920 + u32 last_end_seq; /* end_seq of most recently ACKed packet */
1921 bool is_app_limited; /* is sample from packet with bubble in pipe? */
1922 bool is_retrans; /* is sample from retransmission? */
1923 bool is_ack_delayed; /* is this (likely) a delayed ACK? */
1924 @@ -1139,6 +1141,11 @@ void tcp_rate_gen(struct sock *sk, u32 delivered, u32 lost,
1925 bool is_sack_reneg, struct rate_sample *rs);
1926 void tcp_rate_check_app_limited(struct sock *sk);
1927
1928 +static inline bool tcp_skb_sent_after(u64 t1, u64 t2, u32 seq1, u32 seq2)
1929 +{
1930 + return t1 > t2 || (t1 == t2 && after(seq1, seq2));
1931 +}
1932 +
1933 /* These functions determine how the current flow behaves in respect of SACK
1934 * handling. SACK is negotiated with the peer, and therefore it can vary
1935 * between different flows.
1936 diff --git a/lib/hexdump.c b/lib/hexdump.c
1937 index 147133f8eb2fc..c0a08ddcf94e2 100644
1938 --- a/lib/hexdump.c
1939 +++ b/lib/hexdump.c
1940 @@ -21,15 +21,33 @@ EXPORT_SYMBOL(hex_asc_upper);
1941 *
1942 * hex_to_bin() converts one hex digit to its actual value or -1 in case of bad
1943 * input.
1944 + *
1945 + * This function is used to load cryptographic keys, so it is coded in such a
1946 + * way that there are no conditions or memory accesses that depend on data.
1947 + *
1948 + * Explanation of the logic:
1949 + * (ch - '9' - 1) is negative if ch <= '9'
1950 + * ('0' - 1 - ch) is negative if ch >= '0'
1951 + * we "and" these two values, so the result is negative if ch is in the range
1952 + * '0' ... '9'
1953 + * we are only interested in the sign, so we do a shift ">> 8"; note that right
1954 + * shift of a negative value is implementation-defined, so we cast the
1955 + * value to (unsigned) before the shift --- we have 0xffffff if ch is in
1956 + * the range '0' ... '9', 0 otherwise
1957 + * we "and" this value with (ch - '0' + 1) --- we have a value 1 ... 10 if ch is
1958 + * in the range '0' ... '9', 0 otherwise
1959 + * we add this value to -1 --- we have a value 0 ... 9 if ch is in the range '0'
1960 + * ... '9', -1 otherwise
1961 + * the next line is similar to the previous one, but we need to decode both
1962 + * uppercase and lowercase letters, so we use (ch & 0xdf), which converts
1963 + * lowercase to uppercase
1964 */
1965 -int hex_to_bin(char ch)
1966 +int hex_to_bin(unsigned char ch)
1967 {
1968 - if ((ch >= '0') && (ch <= '9'))
1969 - return ch - '0';
1970 - ch = tolower(ch);
1971 - if ((ch >= 'a') && (ch <= 'f'))
1972 - return ch - 'a' + 10;
1973 - return -1;
1974 + unsigned char cu = ch & 0xdf;
1975 + return -1 +
1976 + ((ch - '0' + 1) & (unsigned)((ch - '9' - 1) & ('0' - 1 - ch)) >> 8) +
1977 + ((cu - 'A' + 11) & (unsigned)((cu - 'F' - 1) & ('A' - 1 - cu)) >> 8);
1978 }
1979 EXPORT_SYMBOL(hex_to_bin);
1980
1981 @@ -44,10 +62,13 @@ EXPORT_SYMBOL(hex_to_bin);
1982 int hex2bin(u8 *dst, const char *src, size_t count)
1983 {
1984 while (count--) {
1985 - int hi = hex_to_bin(*src++);
1986 - int lo = hex_to_bin(*src++);
1987 + int hi, lo;
1988
1989 - if ((hi < 0) || (lo < 0))
1990 + hi = hex_to_bin(*src++);
1991 + if (unlikely(hi < 0))
1992 + return -EINVAL;
1993 + lo = hex_to_bin(*src++);
1994 + if (unlikely(lo < 0))
1995 return -EINVAL;
1996
1997 *dst++ = (hi << 4) | lo;
1998 diff --git a/mm/mmap.c b/mm/mmap.c
1999 index 58cfd5b1e0b16..88e6863677768 100644
2000 --- a/mm/mmap.c
2001 +++ b/mm/mmap.c
2002 @@ -2077,14 +2077,6 @@ found_highest:
2003 }
2004
2005
2006 -#ifndef arch_get_mmap_end
2007 -#define arch_get_mmap_end(addr) (TASK_SIZE)
2008 -#endif
2009 -
2010 -#ifndef arch_get_mmap_base
2011 -#define arch_get_mmap_base(addr, base) (base)
2012 -#endif
2013 -
2014 /* Get an address range which is currently unmapped.
2015 * For shmat() with addr=0.
2016 *
2017 diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
2018 index a5502c5aa44e7..bf270b6a99b4f 100644
2019 --- a/net/core/lwt_bpf.c
2020 +++ b/net/core/lwt_bpf.c
2021 @@ -158,10 +158,8 @@ static int bpf_output(struct net *net, struct sock *sk, struct sk_buff *skb)
2022 return dst->lwtstate->orig_output(net, sk, skb);
2023 }
2024
2025 -static int xmit_check_hhlen(struct sk_buff *skb)
2026 +static int xmit_check_hhlen(struct sk_buff *skb, int hh_len)
2027 {
2028 - int hh_len = skb_dst(skb)->dev->hard_header_len;
2029 -
2030 if (skb_headroom(skb) < hh_len) {
2031 int nhead = HH_DATA_ALIGN(hh_len - skb_headroom(skb));
2032
2033 @@ -273,6 +271,7 @@ static int bpf_xmit(struct sk_buff *skb)
2034
2035 bpf = bpf_lwt_lwtunnel(dst->lwtstate);
2036 if (bpf->xmit.prog) {
2037 + int hh_len = dst->dev->hard_header_len;
2038 __be16 proto = skb->protocol;
2039 int ret;
2040
2041 @@ -290,7 +289,7 @@ static int bpf_xmit(struct sk_buff *skb)
2042 /* If the header was expanded, headroom might be too
2043 * small for L2 header to come, expand as needed.
2044 */
2045 - ret = xmit_check_hhlen(skb);
2046 + ret = xmit_check_hhlen(skb, hh_len);
2047 if (unlikely(ret))
2048 return ret;
2049
2050 diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
2051 index f67f1d27f5655..5b38d03f6d79a 100644
2052 --- a/net/ipv4/ip_gre.c
2053 +++ b/net/ipv4/ip_gre.c
2054 @@ -432,14 +432,12 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev,
2055 __be16 proto)
2056 {
2057 struct ip_tunnel *tunnel = netdev_priv(dev);
2058 -
2059 - if (tunnel->parms.o_flags & TUNNEL_SEQ)
2060 - tunnel->o_seqno++;
2061 + __be16 flags = tunnel->parms.o_flags;
2062
2063 /* Push GRE header. */
2064 gre_build_header(skb, tunnel->tun_hlen,
2065 - tunnel->parms.o_flags, proto, tunnel->parms.o_key,
2066 - htonl(tunnel->o_seqno));
2067 + flags, proto, tunnel->parms.o_key,
2068 + (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0);
2069
2070 ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol);
2071 }
2072 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2073 index c0fcfa2964686..b0e6fc2c5e108 100644
2074 --- a/net/ipv4/tcp_input.c
2075 +++ b/net/ipv4/tcp_input.c
2076 @@ -3717,7 +3717,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
2077 tcp_process_tlp_ack(sk, ack, flag);
2078
2079 if (tcp_ack_is_dubious(sk, flag)) {
2080 - if (!(flag & (FLAG_SND_UNA_ADVANCED | FLAG_NOT_DUP))) {
2081 + if (!(flag & (FLAG_SND_UNA_ADVANCED |
2082 + FLAG_NOT_DUP | FLAG_DSACKING_ACK))) {
2083 num_dupack = 1;
2084 /* Consider if pure acks were aggregated in tcp_add_backlog() */
2085 if (!(flag & FLAG_DATA))
2086 @@ -5230,7 +5231,17 @@ static void tcp_new_space(struct sock *sk)
2087 sk->sk_write_space(sk);
2088 }
2089
2090 -static void tcp_check_space(struct sock *sk)
2091 +/* Caller made space either from:
2092 + * 1) Freeing skbs in rtx queues (after tp->snd_una has advanced)
2093 + * 2) Sent skbs from output queue (and thus advancing tp->snd_nxt)
2094 + *
2095 + * We might be able to generate EPOLLOUT to the application if:
2096 + * 1) Space consumed in output/rtx queues is below sk->sk_sndbuf/2
2097 + * 2) notsent amount (tp->write_seq - tp->snd_nxt) became
2098 + * small enough that tcp_stream_memory_free() decides it
2099 + * is time to generate EPOLLOUT.
2100 + */
2101 +void tcp_check_space(struct sock *sk)
2102 {
2103 if (sock_flag(sk, SOCK_QUEUE_SHRUNK)) {
2104 sock_reset_flag(sk, SOCK_QUEUE_SHRUNK);
2105 diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
2106 index 194743bd3fc10..9b038cb0a43d2 100644
2107 --- a/net/ipv4/tcp_minisocks.c
2108 +++ b/net/ipv4/tcp_minisocks.c
2109 @@ -538,7 +538,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
2110 newtp->tsoffset = treq->ts_off;
2111 #ifdef CONFIG_TCP_MD5SIG
2112 newtp->md5sig_info = NULL; /*XXX*/
2113 - if (newtp->af_specific->md5_lookup(sk, newsk))
2114 + if (treq->af_specific->req_md5_lookup(sk, req_to_sk(req)))
2115 newtp->tcp_header_len += TCPOLEN_MD5SIG_ALIGNED;
2116 #endif
2117 if (skb->len >= TCP_MSS_DEFAULT + newtp->tcp_header_len)
2118 diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
2119 index 139e962d1aef3..67493ec6318ad 100644
2120 --- a/net/ipv4/tcp_output.c
2121 +++ b/net/ipv4/tcp_output.c
2122 @@ -81,6 +81,7 @@ static void tcp_event_new_data_sent(struct sock *sk, struct sk_buff *skb)
2123
2124 NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPORIGDATASENT,
2125 tcp_skb_pcount(skb));
2126 + tcp_check_space(sk);
2127 }
2128
2129 /* SND.NXT, if window was not shrunk or the amount of shrunk was less than one
2130 diff --git a/net/ipv4/tcp_rate.c b/net/ipv4/tcp_rate.c
2131 index 0de6935659635..6ab197928abbc 100644
2132 --- a/net/ipv4/tcp_rate.c
2133 +++ b/net/ipv4/tcp_rate.c
2134 @@ -73,26 +73,31 @@ void tcp_rate_skb_sent(struct sock *sk, struct sk_buff *skb)
2135 *
2136 * If an ACK (s)acks multiple skbs (e.g., stretched-acks), this function is
2137 * called multiple times. We favor the information from the most recently
2138 - * sent skb, i.e., the skb with the highest prior_delivered count.
2139 + * sent skb, i.e., the skb with the most recently sent time and the highest
2140 + * sequence.
2141 */
2142 void tcp_rate_skb_delivered(struct sock *sk, struct sk_buff *skb,
2143 struct rate_sample *rs)
2144 {
2145 struct tcp_sock *tp = tcp_sk(sk);
2146 struct tcp_skb_cb *scb = TCP_SKB_CB(skb);
2147 + u64 tx_tstamp;
2148
2149 if (!scb->tx.delivered_mstamp)
2150 return;
2151
2152 + tx_tstamp = tcp_skb_timestamp_us(skb);
2153 if (!rs->prior_delivered ||
2154 - after(scb->tx.delivered, rs->prior_delivered)) {
2155 + tcp_skb_sent_after(tx_tstamp, tp->first_tx_mstamp,
2156 + scb->end_seq, rs->last_end_seq)) {
2157 rs->prior_delivered = scb->tx.delivered;
2158 rs->prior_mstamp = scb->tx.delivered_mstamp;
2159 rs->is_app_limited = scb->tx.is_app_limited;
2160 rs->is_retrans = scb->sacked & TCPCB_RETRANS;
2161 + rs->last_end_seq = scb->end_seq;
2162
2163 /* Record send time of most recently ACKed packet: */
2164 - tp->first_tx_mstamp = tcp_skb_timestamp_us(skb);
2165 + tp->first_tx_mstamp = tx_tstamp;
2166 /* Find the duration of the "send phase" of this window: */
2167 rs->interval_us = tcp_stamp_us_delta(tp->first_tx_mstamp,
2168 scb->tx.first_tx_mstamp);
2169 diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
2170 index 5dbc280d43856..e550db28aabb5 100644
2171 --- a/net/ipv6/ip6_gre.c
2172 +++ b/net/ipv6/ip6_gre.c
2173 @@ -730,6 +730,7 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,
2174 struct ip_tunnel_info *tun_info;
2175 const struct ip_tunnel_key *key;
2176 __be16 flags;
2177 + int tun_hlen;
2178
2179 tun_info = skb_tunnel_info(skb);
2180 if (unlikely(!tun_info ||
2181 @@ -748,9 +749,9 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb,
2182 dsfield = key->tos;
2183 flags = key->tun_flags &
2184 (TUNNEL_CSUM | TUNNEL_KEY | TUNNEL_SEQ);
2185 - tunnel->tun_hlen = gre_calc_hlen(flags);
2186 + tun_hlen = gre_calc_hlen(flags);
2187
2188 - gre_build_header(skb, tunnel->tun_hlen,
2189 + gre_build_header(skb, tun_hlen,
2190 flags, protocol,
2191 tunnel_id_to_key32(tun_info->key.tun_id),
2192 (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++)
2193 diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
2194 index d1524ca4b90ef..a189079a6ea50 100644
2195 --- a/net/netfilter/ipvs/ip_vs_conn.c
2196 +++ b/net/netfilter/ipvs/ip_vs_conn.c
2197 @@ -1421,7 +1421,7 @@ int __init ip_vs_conn_init(void)
2198 pr_info("Connection hash table configured "
2199 "(size=%d, memory=%ldKbytes)\n",
2200 ip_vs_conn_tab_size,
2201 - (long)(ip_vs_conn_tab_size*sizeof(struct list_head))/1024);
2202 + (long)(ip_vs_conn_tab_size*sizeof(*ip_vs_conn_tab))/1024);
2203 IP_VS_DBG(0, "Each connection entry needs %zd bytes at least\n",
2204 sizeof(struct ip_vs_conn));
2205
2206 diff --git a/net/netfilter/nft_socket.c b/net/netfilter/nft_socket.c
2207 index 637ce3e8c575c..4026ec38526f6 100644
2208 --- a/net/netfilter/nft_socket.c
2209 +++ b/net/netfilter/nft_socket.c
2210 @@ -14,6 +14,32 @@ struct nft_socket {
2211 };
2212 };
2213
2214 +static struct sock *nft_socket_do_lookup(const struct nft_pktinfo *pkt)
2215 +{
2216 + const struct net_device *indev = nft_in(pkt);
2217 + const struct sk_buff *skb = pkt->skb;
2218 + struct sock *sk = NULL;
2219 +
2220 + if (!indev)
2221 + return NULL;
2222 +
2223 + switch (nft_pf(pkt)) {
2224 + case NFPROTO_IPV4:
2225 + sk = nf_sk_lookup_slow_v4(nft_net(pkt), skb, indev);
2226 + break;
2227 +#if IS_ENABLED(CONFIG_NF_TABLES_IPV6)
2228 + case NFPROTO_IPV6:
2229 + sk = nf_sk_lookup_slow_v6(nft_net(pkt), skb, indev);
2230 + break;
2231 +#endif
2232 + default:
2233 + WARN_ON_ONCE(1);
2234 + break;
2235 + }
2236 +
2237 + return sk;
2238 +}
2239 +
2240 static void nft_socket_eval(const struct nft_expr *expr,
2241 struct nft_regs *regs,
2242 const struct nft_pktinfo *pkt)
2243 @@ -27,20 +53,7 @@ static void nft_socket_eval(const struct nft_expr *expr,
2244 sk = NULL;
2245
2246 if (!sk)
2247 - switch(nft_pf(pkt)) {
2248 - case NFPROTO_IPV4:
2249 - sk = nf_sk_lookup_slow_v4(nft_net(pkt), skb, nft_in(pkt));
2250 - break;
2251 -#if IS_ENABLED(CONFIG_NF_TABLES_IPV6)
2252 - case NFPROTO_IPV6:
2253 - sk = nf_sk_lookup_slow_v6(nft_net(pkt), skb, nft_in(pkt));
2254 - break;
2255 -#endif
2256 - default:
2257 - WARN_ON_ONCE(1);
2258 - regs->verdict.code = NFT_BREAK;
2259 - return;
2260 - }
2261 + sk = nft_socket_do_lookup(pkt);
2262
2263 if (!sk) {
2264 regs->verdict.code = NFT_BREAK;
2265 @@ -123,6 +136,16 @@ static int nft_socket_dump(struct sk_buff *skb,
2266 return 0;
2267 }
2268
2269 +static int nft_socket_validate(const struct nft_ctx *ctx,
2270 + const struct nft_expr *expr,
2271 + const struct nft_data **data)
2272 +{
2273 + return nft_chain_validate_hooks(ctx->chain,
2274 + (1 << NF_INET_PRE_ROUTING) |
2275 + (1 << NF_INET_LOCAL_IN) |
2276 + (1 << NF_INET_LOCAL_OUT));
2277 +}
2278 +
2279 static struct nft_expr_type nft_socket_type;
2280 static const struct nft_expr_ops nft_socket_ops = {
2281 .type = &nft_socket_type,
2282 @@ -130,6 +153,7 @@ static const struct nft_expr_ops nft_socket_ops = {
2283 .eval = nft_socket_eval,
2284 .init = nft_socket_init,
2285 .dump = nft_socket_dump,
2286 + .validate = nft_socket_validate,
2287 };
2288
2289 static struct nft_expr_type nft_socket_type __read_mostly = {
2290 diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
2291 index 0d225f891b61b..8d32229199b96 100644
2292 --- a/net/sctp/sm_sideeffect.c
2293 +++ b/net/sctp/sm_sideeffect.c
2294 @@ -458,6 +458,10 @@ void sctp_generate_reconf_event(struct timer_list *t)
2295 goto out_unlock;
2296 }
2297
2298 + /* This happens when the response arrives after the timer is triggered. */
2299 + if (!asoc->strreset_chunk)
2300 + goto out_unlock;
2301 +
2302 error = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT,
2303 SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_RECONF),
2304 asoc->state, asoc->ep, asoc,
2305 diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
2306 index 5221092cc66d4..a5a8cca46bd5f 100644
2307 --- a/net/smc/af_smc.c
2308 +++ b/net/smc/af_smc.c
2309 @@ -816,6 +816,8 @@ static void smc_connect_work(struct work_struct *work)
2310 smc->sk.sk_state = SMC_CLOSED;
2311 if (rc == -EPIPE || rc == -EAGAIN)
2312 smc->sk.sk_err = EPIPE;
2313 + else if (rc == -ECONNREFUSED)
2314 + smc->sk.sk_err = ECONNREFUSED;
2315 else if (signal_pending(current))
2316 smc->sk.sk_err = -sock_intr_errno(timeo);
2317 sock_put(&smc->sk); /* passive closing */
2318 diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
2319 index 0f034c3bc37d7..abb93f7343c53 100644
2320 --- a/net/tls/tls_device.c
2321 +++ b/net/tls/tls_device.c
2322 @@ -470,11 +470,13 @@ handle_error:
2323 copy = min_t(size_t, size, (pfrag->size - pfrag->offset));
2324 copy = min_t(size_t, copy, (max_open_record_len - record->len));
2325
2326 - rc = tls_device_copy_data(page_address(pfrag->page) +
2327 - pfrag->offset, copy, msg_iter);
2328 - if (rc)
2329 - goto handle_error;
2330 - tls_append_frag(record, pfrag, copy);
2331 + if (copy) {
2332 + rc = tls_device_copy_data(page_address(pfrag->page) +
2333 + pfrag->offset, copy, msg_iter);
2334 + if (rc)
2335 + goto handle_error;
2336 + tls_append_frag(record, pfrag, copy);
2337 + }
2338
2339 size -= copy;
2340 if (!size) {
2341 diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
2342 index 6fd1bef848ed9..fa55d79b39b60 100644
2343 --- a/sound/soc/codecs/wm8731.c
2344 +++ b/sound/soc/codecs/wm8731.c
2345 @@ -601,7 +601,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
2346 ret = wm8731_reset(wm8731->regmap);
2347 if (ret < 0) {
2348 dev_err(dev, "Failed to issue reset: %d\n", ret);
2349 - goto err_regulator_enable;
2350 + goto err;
2351 }
2352
2353 /* Clear POWEROFF, keep everything else disabled */
2354 @@ -618,10 +618,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
2355
2356 regcache_mark_dirty(wm8731->regmap);
2357
2358 -err_regulator_enable:
2359 - /* Regulators will be enabled by bias management */
2360 - regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
2361 -
2362 +err:
2363 return ret;
2364 }
2365
2366 @@ -765,21 +762,27 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
2367 ret = PTR_ERR(wm8731->regmap);
2368 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
2369 ret);
2370 - return ret;
2371 + goto err_regulator_enable;
2372 }
2373
2374 ret = wm8731_hw_init(&i2c->dev, wm8731);
2375 if (ret != 0)
2376 - return ret;
2377 + goto err_regulator_enable;
2378
2379 ret = devm_snd_soc_register_component(&i2c->dev,
2380 &soc_component_dev_wm8731, &wm8731_dai, 1);
2381 if (ret != 0) {
2382 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
2383 - return ret;
2384 + goto err_regulator_enable;
2385 }
2386
2387 return 0;
2388 +
2389 +err_regulator_enable:
2390 + /* Regulators will be enabled by bias management */
2391 + regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
2392 +
2393 + return ret;
2394 }
2395
2396 static int wm8731_i2c_remove(struct i2c_client *client)